Azure: MissingRegistrationForLocation: The subscri

2019-06-17 01:23发布

This started out as a SubscriptionNotFound error.

var dnsClient = new DnsManagementClient(new Microsoft.Azure.TokenCloudCredentials(result.AccessToken));

var zone = dnsClient.Zones.CreateOrUpdate("someresourcegroup", "mydomain.com", new Microsoft.Azure.Management.Dns.Models.ZoneCreateOrUpdateParameters {
        IfNoneMatch = "*",
        Zone = new Microsoft.Azure.Management.Dns.Models.Zone {
            Name = "mydomain.com",
            Location = "northeurope"
        }
    });

Now I've fixed that, thanks to the reply on the original question. It's still the same code, and I have re-registered for the feature/provider with the follow powershell command:

Register-AzurermresourceProvider -ProviderNamespace Microsoft.Network

But that doesn't take an location parameter, and the error is about a resource in a location. What gives? And I have tried with "North Europe" instead of "northeurope", same result.

So what am I missing? Can't seem to find any data on this issue, not here and not on Google.

The complete error message is:

MissingRegistrationForLocation: The subscription is not registered for the resource type 'dnszones' in the location 'northeurope'. Please re-register for this provider in order to have access to this location.

3条回答
走好不送
2楼-- · 2019-06-17 02:08

Azure DNS is a global service. Please try changing your location from northeurope to global. That should fix the error.

var zone = dnsClient.Zones.CreateOrUpdate("someresourcegroup", "mydomain.com", new Microsoft.Azure.Management.Dns.Models.ZoneCreateOrUpdateParameters {
        IfNoneMatch = "*",
        Zone = new Microsoft.Azure.Management.Dns.Models.Zone {
            Name = "mydomain.com",
            Location = "global"
        }
    });
查看更多
成全新的幸福
3楼-- · 2019-06-17 02:18

Please refer to this: https://azure.microsoft.com/en-us/documentation/articles/resource-group-move-resources/

"The destination subscription must be registered for the resource provider of the resource being moved. If not, you will receive an error stating that the subscription is not registered for a resource type. You might encounter this problem when moving a resource to a new subscription, but that subscription has never been used with that resource type. To learn how to check the registration status and register resource providers, see Resource providers and types."

Expansion:

Although the question is specific to DNS configuration and valid locations (regions), this answer actually addresses the error message in the title. The root cause of this error is creating a resource in a location where the resource provider has not been register (or supported).

In my case, I found I could only create Application Insights resources in specific regions. The link to resource providers lead me to find this location constraint. If you see this error message in the title, make sure the resource you are trying to create is valid in the given location.

查看更多
孤傲高冷的网名
4楼-- · 2019-06-17 02:23

Just got this error message while trying to deploy through Visual Studio 2015. Upgrading to the latest Azure SDK, v2.9.6, fixed the problem.

查看更多
登录 后发表回答