How to find apiVersion used for REST API or ARM templates

I wrote a few articles that discuss how and or why you would need to know the apiVerion api-version when calling Azure REST APIs or making a deployment with an Azure Resource Manager (ARM) template.

If you are getting errors, you might want to use a more current or a different API Version to see if it then works, but how to find them?  Look no further.  There are 2 approaches I recommend:

PowerShell

I wrote this article “How to set Azure PowerShell to a specific Azure Subscription” that explains how to login and set your azure subscription using Azure PowerShell so I will not cover that again.

To get a list of available providers, execute the following cmdlet after logging in.

 
Get-AzureRmResourceProvider

You should see output similar to the following, Figure 1.

image

Figure 1, azure PowerShell finding resource providers

Then, find the ProviderNamespace for which you want the the apiVersion for and execute the following cmdlet, assume we want the apiVersion for Microsoft.Web.

 
((Get-AzureRmResourceProvider -ProviderNamespace Microsoft.Web).ResourceTypes 
| Where-Object ResourceTypeName -eq sites).ApiVersions

And you should see the output similar to Figure 2.

image

Figure 2, azure PowerShell finding resource providers and api versions

Then you can try the newest or different one.

Resource Explorer

This is a cool tool –> https://resources.azure.com

Select the AAD tenant, the Subscription then providers.  Search for your desired provider and you will see the same values, see Figure 3.

image

Figure 3, use resource explorer or azure PowerShell finding resource providers and api versions