Registering Azure Resource Providers to Enable Azure Features

Registering Azure Resource Providers to Enable Azure Features

To use Azure Resources in your Azure Subscription the corresponding Resource Provider needs to be registered first. There can be various scenarios where the Resource Providers may not be registered in a subscription. When you create your subscription, not all Resource Providers are registered from the beginning. And if there are new Azure features added, the resource provider for that feature may not also be Registered as well.

Also, when you are Owner or a Contributor to a subscription, when you create a resource that is not already Registered, the Resource Providers is automatically registered before the resource you requested is created. But if you do not have sufficient privileges then your resource will not be created and you will see an error message.

There are 3 ways you can register Resource Providers in Azure. You can use either the Azure Portal, Azure PowerShell or Azure CLI to register Resource Providers. We will look at all 3 options.

Using Azure Portal to Register a Resource Provider

In Azure Portal it’s really easy to register Resource Providers. All you have to do is to go to your Subscription blade (either by searching for ‘Subscription’ in the search bar or by clicking on the left navigation menu). Once in the Subscription blade, you can click on Resource Providers in the Settings section to see a list of available Resource Providers.

01-subscription-blade

Here you can see what Resource Providers are Register and what are not. To Register a Resource Provider in the Portal, simply click on the Register link in front of the Resource Provider you want to enable. It will take few minutes to complete, but once it does, the resource provider is registered and you can create the resources.

Using Azure PowerShell to Register a Resource Provider

It’s quite easy to Register a resource provider using PowerShell. Login to your Azure Subscription and execute the following commands.

# Login to Azure Subscription
Login-AzureRmAccount

# Check the registration Status of the Resource Provider
Get-AzureRmResourceProvider -ListAvailable | Where-Object { $_.ProviderNamespace -eq "Microsoft.Compute" }

# Register the Microsoft.Compute Resource Provider
Register-AzureRmResourceProvider -ProviderNamespace "Microsoft.Compute"

I want to enable Microsoft.Compute Resource Provider in this example, and using the Get-AzureRmResourceProvider command I am listing the available resource and filtering the list only to show the Microsoft.Compute resource provider. This will show the current state. Since my subscription is new and I don’t have any Compute resource created, mine is in NotRegistered State. In the Next line, Register-AzureRmResourceProvider command I am registering the resource provider just by supplying the Provider Namespace. It’s that simple.

Using Azure CLI to Register a Resource Provider

Just like using PowerShell you can register a resource provider using Azure CLI with just one command.

# Login to Azure
az login --use-device-code

# Check the registration Status of the Resource Provider
az provider list --query "[?namespace == 'Microsoft.Compute']" --output table

# Register the Microsoft.Compute Resource Provider
az provider register --namespace "Microsoft.Compute"

Same as in PowerShell, I am listing all the available resource providers and using JMESPath query to select the Microsoft.Compute resource provider and output as a table. I see that Microsoft.Compute is not Registered for me. And in the next command, I am registering the Resource Provider using the namespace name.

Important

Note that, you can un-register your resource providers at any time. But you are not able to Un-Register resource providers when you have resource types from that resource provider in your subscription. You need to remove those resources first and then need to Un-Register.

You Might Also Like
Comments