I am trying to create a VM using the azure Rest API. I am trying to call the REST Api through Postman.
I am using the above REST API with my subscription ID and resouceGroupName.
In the Authorization section, I am providing the Type as Basic Authentication and passing my credentials in the username and password section. Along with this, I am also passing values in the Body section.
{
"properties": {
"templateLink": {
"uri": "https://mystoragename.blob.core.windows.net/templates/VMTemplate.json",
"contentVersion": "1.0.0.0"
},
"parametersLink": {
"uri": "https://mystoragename.blob.core.windows.net/templates/VMParam.json",
"contentVersion": "1.0.0.0"
},
"mode": "Incremental",
"debugSetting": {
"detailLevel": "requestContent, responseContent"
}
}
}
Whenever I am sending this request so it is giving me an error like 400 Bad Request and message in the body section is :
We're working to restore all services as soon as possible. Please check back soon.
0ddImXQAAAABmya8eHqWDRp1JX69tDGdATUFBMDFFREdFMDIyMABFZGdlPlease tell me what wrong I am Doing here. From last 1 day, I am trying this.
Looks like your resource is wrong, it should be https://management.azure.com
not https://management.dev.azure.com
.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}?api-version=2019-05-01
Reference - Deploy resources with Resource Manager templates and Resource Manager REST API
Besides, I notice you use the Basic Authentication, not sure if it works for azure rest API(I think may not), even the way will work, but if your account is MFA-enabled, then you will not be able to use that.
So for the Authentication, i recommend you to see this link to get an access token to call the rest api. Or you could try the easiest way -> click Try it
in this doc -> login in your account -> then you will be able to test the rest api like that in postman. Also, you can copy the Authorization token and test it in the postman.