Resolving "Subscription Is Not Registered" Error While Publishing A Solution To Azure Webapps Or Mobile Apps

Scenario

When someone tries to publish a solution to Azure WebApps or Mobile Apps using Visual Studio an error is reported while publishing:

“The subscription is not registered for the resource type 'components' in the location 'centralus'.

Please re-register for this provider in order to have access to this location. (Code: MissingRegistrationForLocation)”

Cause

This is caused by recent changes in Azure Application Insight GA in two regions, “North Europe” and “West Europe”.

The Application Insight location to store analytics in Azure was previously managed by Microsoft. This was hidden from users. During recent changes to Azure this data has been moved to new locations but Azure resources and Visual Studio Templates still point to old locations, hence we get an error.

Application Insights resources included in Microsoft.Insights. AlertRules and AutoScaleSettings were not moved, because these can already be located in most Azure regions.

Most Azure Resource Manager templates for Application Insights were written with the location set to “centralus” or “Central US.” This is a causing the issue and publishing is failing with the below error,

“The subscription is not registered for the resource type 'components' in the location 'centralus'.

Please re-register for this provider in order to have access to this location. (Code: MissingRegistrationForLocation)”

Troubleshooting

  1. Tried to change the resource location in Azure portal, tried to move resources from one resource group to other
  2. Tried to create a new resource group in different locations and publish the webApp. The error is still there.

Solution

Finally Microsoft came to help accepting the change here.

One has to change the location to the correct US location by running the below commands in Azure PowerShell to resolve the issue

Open Microsoft Azure PowerShell,

Use below commands to correct the resource location, 

  1. Login-AzureRmAccount // Enter credentials to correct to your subscription  
  2. $resource = Get-AzureRmResource  
  3. $resource | where { $_.ResourceType -eq 'Microsoft.insights/autoscalesettings' } | Remove-AzureRmResource  
  4. $resource | where { $_.ResourceType -eq 'Microsoft.insights/alertrules' } | Remove-AzureRmResource   

Hope this helps someone.

Ebook Download
View all
Learn
View all