Learn Azure Administration
上QQ阅读APP看书,第一时间看更新

Managing resource providers

In Azure, each service is managed by a separate resource provider. By default, most of the providers are not registered in your subscription. This is a perfectly fine scenario as you will probably never use all the RPs inside a single subscription. In most cases, a resource provider is registered immediately when provisioning a resource of a specific type for the first time. There are, however, moments when you need to do this manually. Let's learn how to do so using both the portal and PowerShell cmdlets.

Any time your subscription tries to access a non-registered resource provider, you will see a notification saying that a provider of a specific type is required before you can provision a resource of a particular type. There are two ways to check what is registered inside your subscription – you can either use the portal or a specific PowerShell command.

To check RPs in the portal, follow these steps:

  1. Search for your subscription using the search field at the top of the portal, as shown in the following screenshot:
Figure 2.1: Searching for a subscription
  1. The next thing to do is select the Resource providers blade:
Figure 2.2: Resource providers blade
  1. You will see a complete list of supported RPs, along with information about whether it is available for your subscription:
Figure 2.3: Registered subscription resource providers

The same can be done by running the following Powershell cmdlet in your Powershell environment. With the following command, we list all the providers and pipe them to the Select-Object function, thus filtering the fields:

Get-AzureRmResourceProvider -ListAvailable | Select-Object ProviderNamespace, RegistrationState
Note that you may need to connect to your subscription before calling the preceding command. To do so, use the  Connect-AzureRmAccount  cmdlet.

The following is the result of calling the command for my subscription:

ProviderNamespace RegistrationState
----------------- -----------------
Microsoft.Blueprint Registered
Microsoft.EventGrid Registered
microsoft.insights Registered
Microsoft.Logic Registered
Microsoft.ManagedIdentity Registered
Microsoft.PolicyInsights Registered
Microsoft.Security Registered
Microsoft.Storage Registered
Microsoft.StreamAnalytics Registered
Microsoft.Web Registered
84codes.CloudAMQP NotRegistered
AppDynamics.APM NotRegistered
Aspera.Transfers NotRegistered
Auth0.Cloud NotRegistered
Citrix.Cloud NotRegistered
...

As you can see, I got the list of providers and their registration states. Now, we will try to register/unregister a provider from a subscription.

Managing available RPs is really simple using both the Azure portal and PowerShell. To change the state of a provider in the portal, simply click on the Register / Unregister button above the available providers. Once you've done that, the status will be displayed as Registering or Unregistering, as shown in the following screenshot:

Figure 2.4: Registering/unregistering resource providers

The same can be done in PowerShell with the following commands:

Register-AzResourceProvider -ProviderNamespace Microsoft.BotService

Unregister-AzResourceProvider -ProviderNamespace Microsoft.BotService

Under the hood, once you've initialized the process of registering a provider, a particular RP will be added to your subscription that you can manage and provision its resources. This includes registering its namespace, different types of resources (for example, if you want to deploy an Azure App Service with application settings, both the application and its configuration are managed via Azure Resource Manager separately), and the locations where it will be available.

This is also one way of limiting available services to users of your subscription – if you don't grant them the ability to register resource providers, they will not be able to provision services managed by them.

Resource providers are a simple way of separating your subscription from different kinds of resources and limiting access to them. If you are interested in how things really work, go to https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-overview, where you will find an overview of ARM. This is a great source of knowledge if you want to know how resources in Azure are deployed and managed behind the scenes.

In this section, you learned what resource providers are and how to use them to steer what can be used in a subscription. This will help you get started with the next section on resource groups, which are containers for Azure resources that are handled by registered RPs.