Resolving Azure ARM REST API Versions Conflict In ARM Templates

Avatar

Pam

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:

clip_image001

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

clip_image002

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 ):

  1. Open Windows PowerShell ISE in Admin Mode
  2. Run this command to login to your Azure Account
  3. Login to your account using your Azure credentials
  4. Run the following command (Assuming Application Insights is the resource we want to create)

     

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.

Avatar
Pam Lahoud

Follow Pam   

0 comments

    Leave a comment