What are Azure resource providers and why should you care
Tags: arm, azurepolicy, resourceproviders
Published: 2020-03-31 21:02:25

---
title: What are Azure resource providers and why should you care
published: true
description: Resources providers are at the core of Azure Resource Manager. Let's understand what they are and how to work with them.
tags: #arm #azure-policy #resource-providers
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/86ix8fvn6g7c5ji39s45.png
---

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.

![](https://dev-to-uploads.s3.amazonaws.com/i/cbgp2ffehisbzg4hg9z5.png)

# 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:

![](https://dev-to-uploads.s3.amazonaws.com/i/mh4cca8ea0gu5ymhuz9d.PNG)

# 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:

![](https://dev-to-uploads.s3.amazonaws.com/i/d7plqngivrlnt8oy849e.png)

# 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:
``` powershell
Register-AzResourceProvider -ProviderNamespace $azureProviderName
```

To unregister a resource provider, use this command:
``` powershell
Unregister-AzResourceProvider -ProviderNamespace $azureProviderName
```

Remember to first be connected to Azure and your Azure context being positioned on the right subscription:
``` powershell
Connect-AzAccount
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!