How to add a body to a HttpWebRequest that is being used with the Azure Service management API?

0 votes

I want to add a body to a HttpWebRequest that is being used with the Azure Service management API. The body needs to be made up of the following:

<?xml version="1.0" encoding="utf-8"?>
<ChangeConfiguration xmlns="http://schemas.microsoft.com/windowsazure">
   <Configuration>base-64-encoded-configuration-file</Configuration>
   <TreatWarningsAsError>true|false</TreatWarningsAsError>
   <Mode>Auto|Manual</Mode>
</ChangeConfiguration>

Kindly help.

Apr 3, 2019 in Azure by sabby
• 4,370 points
106 views

1 answer to this question.

0 votes

The following code should help:

byte[] buf = Encoding.UTF8.GetBytes(xml);

request.Method = "POST";
request.ContentType = "text/xml";
request.ContentLength = buf.Length;
request.GetRequestStream().Write(buf, 0, buf.Length);

var HttpWebResponse = (HttpWebResponse)request.GetResponse();
answered Apr 3, 2019 by p
• 1,940 points

Related Questions In Azure

0 votes
2 answers

How can I download a .vhd image to my local machine from azure and upload the same to a different azure account?

From the Windows Azure Portal you can ...READ MORE

answered Aug 20, 2018 in Azure by Priyaj
• 57,530 points
6,948 views
0 votes
1 answer

How to get the list of names of Azure blob files in a container?

We can get some additional info like Size, ...READ MORE

answered Jun 27, 2018 in Azure by club_seesharp
• 3,450 points
5,614 views
0 votes
1 answer

How to calculate the used database space in SQL Azure?

I don't think its possible to find ...READ MORE

answered Mar 5, 2019 in Azure by Archana
• 5,600 points
90 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How to install Windows Azure Storage Emulator?

There may be an issue with the ...READ MORE

answered Mar 6, 2019 in Azure by p
• 1,940 points
786 views
0 votes
1 answer

Azure Storage Emulator shows error.

This blog might help with your query: http://blog.smarx.com/posts/windows-azure-storage-emulator-the-process-cannot-access-the-file-because-it-is-being-used-by-another-process Also, ...READ MORE

answered Mar 15, 2019 in Azure by p
• 1,940 points
358 views
0 votes
1 answer

Friendly filename when downloading Azure blob.

Azure blobs can be downloaded in four ...READ MORE

answered Mar 15, 2019 in Azure by p
• 1,940 points
332 views
0 votes
1 answer

I want to detect whether a request is being made over HTTPS or HTTP on Azure Websites.

It's looking like you can make use of ...READ MORE

answered Apr 2, 2019 in Azure by p
• 1,940 points
141 views
0 votes
1 answer

How to know the Azure backup frequency/retention range associated with Azure Backup Policy?

The following code snippet will provide you ...READ MORE

answered Apr 8, 2019 in Azure by p
• 1,940 points
351 views