DEV Community

Cover image for What are Azure resource providers and why should you care
Tidjani Belmansour, Ph.D.
Tidjani Belmansour, Ph.D.

Posted on

What are Azure resource providers and why should you care

When working with Azure, you’ll most likely have to create Azure resources.

Whether you do this through the Azure portal, SDKs, Azure CLI or Azure PowerShell, you’re in fact asking the Azure Resource Manager to create these resources for you.

For that matter, the Azure Resource Manager relies on a variety of Resources Providers to create the resources you’ve asked for.

Why should I care?

Providers are registered at the subscription level.

If you’re the owner of or a contributor to the subscription, some kind of magic happens: the required providers will be registered for you under the cover.

But if you’re for example a contributor on a resource group then you won’t be able to create a resource for whom the corresponding providers isn’t registered.

What happens if the provider is not registered?

If you try to create a resource for whom the corresponding providers isn’t registered, you’ll face an error.

Here, the resource provider “Microsoft.SignalRService” is not registered. So, when I try to create a new instance of that service, I get this:

Registering and unregistering providers through the Azure portal

Login to your Azure account, then go to the “Subscriptions” blade and select your subscription.

From there, click on “Resource providers”, then locate the resource provider you want to register or unregister and click on the corresponding button:

Registering and unregistering providers through PowerShell

Here we’ll see how to register and unregister a provider by using Azure PowerShell, but the same goes for SDKs or Azure CLI.

You’ll need the PowerShell module "Az.Resources".

To register a resource provider, use this command:

Register-AzResourceProvider -ProviderNamespace $azureProviderName

To unregister a resource provider, use this command:

Unregister-AzResourceProvider -ProviderNamespace $azureProviderName

Remember to first be connected to Azure and your Azure context being positioned on the right subscription:

Get-AzSubscription -SubscriptionId $SubscriptionId | Set-AzContext

These commands are idempotent so you don’t need to first check whether the provider is already registered or not.

Why not simply register all the providers?

You don’t open every port in your firewall, do you?

Similarly, you don’t want to register every resource provider. This is a security practice that will allow you to have control over what kind or resources can or cannot be created within a given subscription.

This is not a replacement for Azure Blueprints and Azure Policy though as those services allow you to restrict more granular properties such as what are the allowed SKUs or which regions resources can be created in.

Custom Resource Providers

If you create a new type of Azure resource and want people to be able to create these kind of resources, you’ll have to create a custom resource provider on which the Azure Resource Manager will rely on to create this kind of resources.

Creating custom resource providers is out of the scope of this article. We may discuss this topic in an upcoming article.

As a conclusion…

In today’s article, we’ve dug a little bit deeper under the surface on Azure in order to better understand how the magic is happening.

This kind of information is not absolutely required and, in fact, you may have worked with Azure for years without the need to know that. However, if you’ve ever wanted to understand the magic behind how Azure creates its resources, I believe that this article has provided you with some answers.

See you soon!

Top comments (4)

igor1306 profile image

Really nice topic, thank you!

dwinchell profile image
Dillon Winchell

This was really helpful. Thank you!

path2webdev profile image

Could you please shed some light into the custom resource provider.

tidjani profile image
Tidjani Belmansour, Ph.D.

it's on my todo list. Probably somewhere in july I'd take a look at this. Please stay tuned ;)