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,390 points
2,522 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();
Hope it Helps!
To know more join our Azure Training in UAE today.
answered Apr 3, 2019 by Prerna
• 1,960 points

Related Questions In Azure

0 votes
1 answer

How to export the template used for a deployment in Azure?

Hi@akhtar, You can export the deployment available in ...READ MORE

answered Nov 16, 2020 in Azure by MD
• 95,460 points
704 views
0 votes
1 answer

How to add a node pool to the managed Kubernetes cluster in Azure?

Hi@akhtar, You can add an extra node pool ...READ MORE

answered Nov 17, 2020 in Azure by MD
• 95,460 points
880 views
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
• 58,100 points
13,937 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
21,602 views
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 7, 2019 in Azure by Prerna
• 1,960 points
2,679 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 16, 2019 in Azure by Prerna
• 1,960 points
1,638 views
0 votes
1 answer

Friendly filename when downloading Azure blob.

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

answered Mar 16, 2019 in Azure by Prerna
• 1,960 points
3,665 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 Prerna
• 1,960 points
1,018 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 Prerna
• 1,960 points
1,281 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP