The subscription is not registered to use namespace Microsoft.AzureActiveDirectory

This morning, I tried setting up an Azure Active Directory B2C tenant and link it to a newly created Azure subscription. Everything seemed to be OK until I clicked on the "create button". Almost immediately, I got an error stating the following:

The subscription is not registered to use namespace Microsoft.AzureActiveDirectory

I thought it was related to the fact that it was a "new" subscription and waited for a bit before trying again and experiencing the same issue...

After looking around for a bit, I remembered that some resource providers need to be "activated" on subscription level.

If you have the same issue, then this is how you can solve it:

In this post, I'm going to show you how you can do this via the Azure CLI. You can also do this action via the Azure Portal itself by going to the subscription and then in by looking for the "Resource providers" tab under settings, where you can register with the click of a button... ➡️ But that is not what I wanted to show you today 😃

First open a PowerShell/bash window and with the help of Azure CLI, you can login and select the subscription that you need. (If you are using the cloud shell in Azure, then you don't need to execute the first command)

1# Not needed if you are using the cloud shell in the azure portal
2az login
3# use this to determine the name of the supbscrition that you are going to modify in the next command
4az account list
5az account set --subscription "<YourSubscription>"

Since the portal already states that your subscription is not registered for AAD linking, you can pretty much believe it, but for the sake of completeness, let us validate it for a second. It will also allow you to see the difference afterwards. The script below and the resulting screenshot show you what needs to be done. Also note that the registrationState of the provider on the subscription is...

1az provider show -n Microsoft.AzureActiveDirectory

Please note that the provider is unregistered

So, what this means is that you will need to do is to "Register" the azure active directory provider on your Azure subscription. This can be done with the following command:

1az provider register --namespace Microsoft.AzureActiveDirectory

After that you can, if you want to, run the command again to check if the provider is now "Registered"

1az provider show -n Microsoft.AzureActiveDirectory

Please note that the provider is now registered

At this point, all the stars should be aligned and you should be able to create your Azure Active Directory B2C tenant and link it to your Azure subscription.

If you also run into this problem, then I hope that this helps you too!

Tim

comments powered by Disqus