Freigeben über


Learning Azure Service Management REST API through Powershell, and Azure CLI tools

Azure Service Management REST API is used by all the public tools provided by Microsoft to manage your Azure Subscription – Portal, New Portal, Powershell, X-Plat CLI. You can use the same APIs to build your own tools that would manage your Azure Subscription. Sometimes, it is little difficult to bring up all the necessary information needed to be passed on to the REST API call. MSDN documentation of all these REST APIs has all the information that you need. And, there are sometimes, you might need more help.

Azure Powershell, and Azure xplat CLI tools, both use the same REST API endpoints to manage the subscription. You could take help from them as well. They have their own debug switch that shows up the REST API endpoint, and the parameters that needs to be passed.

For example, if you want to list all the VMs, from Azure Powershell, you run Get-AzureVM. You can pass in -Debug switch to any Azure Powershell cmdlet, and that’ll emit the debug information which includes the REST API endpoint, and the parameters passed in.

image

Typically, you are always good in any GET operations, since you only have to pass in the right URIs. Any create/update operation is tricky, since that typically involves you sending an request body as an XML, or JSON. Try -Debug for any command, and you will be able to see the entire request payload that goes.

And, for Azure Cross Platform CLI, it is the –vv switch.

image

Hope this helps!