Uredi

Deli z drugimi prek


Resolve errors for resource provider registration

This article describes resource provider registration errors that occur when you use a resource provider that you haven't already used in your Azure subscription. The errors are displayed when you deploy resources with a Bicep file or Azure Resource Manager template (ARM template). If Azure doesn't automatically register a resource provider, you can do a manual registration.

Symptom

When a resource is deployed, you might receive the following error code and message:

Code: NoRegisteredProviderFound
Message: No registered resource provider found for location {location}
and API version {api-version} for type {resource-type}.

Or, you might receive a similar message that states:

Code: MissingSubscriptionRegistration
Message: The subscription is not registered to use namespace {resource-provider-namespace}

The error message should give you suggestions for the supported locations and API versions. You can change your template to use a suggested value. Most providers are registered automatically by the Microsoft Azure portal or the command-line interface, but not all. If you haven't used a particular resource provider before, you might need to register that provider.

When virtual machine (VM) auto-shutdown is disabled, you might receive an error message similar to:

Code: AuthorizationFailed
Message: The client '<identifier>' with object id '<identifier>' does not have authorization to perform
action 'Microsoft.Compute/virtualMachines/read' over scope ...

An unexpected error can occur for a resource provider that's not in your ARM template or Bicep file. This error might happen when a resource is deployed that creates other supporting resources. For example, the resource in your template adds monitoring or security resources. The error message indicates the resource provider namespace you need to register is for the supporting resource.

Cause

You receive these errors for one of these reasons:

  • The required resource provider hasn't been registered for your subscription.
  • API version not supported for the resource type.
  • Location not supported for the resource type.
  • For VM auto-shutdown, the Microsoft.DevTestLab resource provider must be registered.

Solution

You can use Azure CLI to get information about a resource provider's registration status and register a resource provider.

Use az provider list to display the registration status for your subscription's resource providers. The examples use the --output table parameter to filter the output for readability. You can omit the parameter to see all properties.

The following command lists all the subscription's resource providers and whether they're Registered or NotRegistered.

az provider list --output table

You can filter the output by registration state. Replace the query value with Registered or NotRegistered.

az provider list --query "[?registrationState=='Registered']" --output table

Get the registration status for a specific resource provider:

az provider list --query "[?namespace=='Microsoft.Compute']" --output table

To register a resource provider, use the az provider register command, and specify the namespace to register.

az provider register --namespace Microsoft.Cdn

To get a resource type's supported locations, use az provider show:

az provider show --namespace Microsoft.Web --query "resourceTypes[?resourceType=='sites'].locations"

Get a resource type's supported API versions:

az provider show --namespace Microsoft.Web --query "resourceTypes[?resourceType=='sites'].apiVersions"