Azure - Update Resource Property with REST API

I use the REST API to create resources (WebApp + MySQL) using a template. It is working fine. Now I want to change the hostnames and add them, but I just get the Bad Request response (400).

The URL I'm linking to is:

"https://management.azure.com/subscriptions/<subscriptionId>/resourcegroups/<myResourceGroup>/providers/Microsoft.Web/sites/<instanceName>?api-version=2015-08-01" 

I am doing PUT and sending the next JSON object.

 { "properties": { "HostNames":"instanceName.azurewebsites.net, newHostName.com" } } 

My JSON may be wrong, but I have tried many formats and nobody is working. I also tried referring to another url:

 "https://management.azure.com/subscriptions/<subscriptionId>/resourcegroups/<myResourceGroup>/providers/Microsoft.Web/sites/<instanceName>/config/web?api-version=2015-08-01" 

And the answer is fine (200), but then I check the resource using powershell and the HostNames property has not changed.

I also tried to install HostNames with my template during deployment, but by default, Azure does not allow adding custom host names.

Has anyone come across this before?

+2
json c # api azure azure-resource-manager
source share

No one has answered this question yet.

See similar questions:

4
Adding a domain to an Azure site through code

or similar:

2480
How do I send JSON data using Curl from a terminal / command line in Test Spring REST?
4
Azure Management API - 429 Too many requests
one
BadRequest on / metrics Azure REST Endpoint
one
ASP.NET 5 Azure Template Deployment Failed to Create SQL Server
one
How do I get billing information for each Azure ruby ​​resource or API?
0
Failed to start Azure api application
0
How to get CloudService configuration (classic) using Azure ARM API
0
Create an Azure VM using the Azure Resource Manger API
0
Get Azure VM using Deployment Resource Manager and Rest api
0
Azure Resource Manager REST api - Value field returned inside response body is always empty

All Articles