Resolving Azure ARM REST API Versions Conflict In ARM Templates

Pam

July 21st, 2017

This post is from Premier Developer consultant Adel Ghabboun.

Usually if you use the Azure Portal Automation Script feature to generate an ARM template and copy that to a new Visual Studio Azure Resource Group project, Visual Studio editor will complain about the API version that is used in the template and suggest a new version. It looks like this:

If you click Ctrl + Space, Visual Studio will show you all the possible values:

Now, if you change the value and try to deploy this template to your Azure resource group, the result will come back failed with a deployment error:

“error”: { “code”: “NoRegisteredProviderFound”, “message”: “No registered resource provider found for location ‘eastus’ and API version ‘2016-08-01’ for type ‘components’. The supported api-versions are ‘2014-04-01, 2014-08-01, 2015-05-01, 2014-12-01-preview’.

Now, which one should we use?

Let’s look at the PowerShell Azure SDK command Get-AzureRMResourceProvider to retrieve the API version information by following the below steps (Note that Azure SDK must be installed on your machine prior to running the Azure commands below, See Install and Configure Azure PowerShell ):

Open Windows PowerShell ISE in Admin Mode Run this command to login to your Azure Account Login-AzureRmAccount Login to your account using your Azure credentials Run the following command (Assuming Application Insights is the resource we want to create) (Get-AzureRmResourceProvider -ProviderNamespace Microsoft.Insights).ResourceTypes | Where {$_.ResourceTypeName -eq 'components'} | Select -ExpandProperty ApiVersions 2015-05-01 2014-12-01-preview 2014-08-01 2014-04-01

Now, using the API version that is provided by the PowerShell command will solve the issue.

Conclusion:

As a best practice and to avoid any deployment issue regardless if you are using Visual Studio or other tools to deploy your Azure templates, always run the PowerShell command mentioned above to retrieve the API versions information and use the latest one.