Get all the available API versions in Azure

Today a colleague came to me with an ARM template, asking me why certain elements did not seem to process properly when he was deploying this template to Azure.
We came to the conclusion that he was using an old apiVersion reference in his ARM template, that did not include this element yet.

While we mostly use Visual Studio to build ARM templates (and tend to be lazy) and use the ‘add a new resource’ button, this mostly never populates the actually latest avaialble Api version for the resource.

Using powershell to our advantage however, we can quickly retrieve all the latest available versions from Azure.

The “Get-AzureRmResourceProvider -ListAvailable” cmdlet will give you all the available AzureRm Resource Providers.
If you dig a bit deeper into the object, you will notice that the ResourceTypes will display the resource types, locations and API versions.

Lets grab all these details together and display them in a readable list.

$Namespaces = (Get-AzureRmResourceProvider -ListAvailable).ProviderNamespace
foreach ($Namespace in $Namespaces) {
(Get-AzureRmResourceProvider -ProviderNamespace $Namespace).ResourceTypes | select @{l='Namespace';e={$Namespace}},

Now we can get a full overview on AzureRM available API versions per resourcetype.

Tip: Would you only need to see the resources you are currently using? Try removing the -ListAvailable switch.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.