Azure - Update Resource Property with REST API

混江龙づ霸主 提交于 2019-12-22 12:48:09

问题


I'm using the REST API to create resources (WebApp + MySQL) with a template. It works fine. I want now to modify the hostnames and add one but I just receive a Bad Request (400) response.

The URL I refer to is:

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

I'm doing a PUT, and sending the following JSON object.

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

It is possible that my JSON is wrong, but I tried many formats and no one works. I tried also 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 response is OK (200) but then I check the resource with powershell and my HostNames property didn't change.

I also tried to set the HostNames with my template upon deployment but by default Azure does not allow you to add custom hostnames.

Anyone faced this before?

来源:https://stackoverflow.com/questions/32789231/azure-update-resource-property-with-rest-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!