The subscription is not registered to use namespace ‘Microsoft.AzureActiveDirectory’

Did you encounter the following error while creating a new tenant for Azure AD B2C?

The subscription is not registered to use namespace ‘Microsoft.AzureActiveDirectory’. See for how to register subscriptions. 

The error root cause

The reason for the error is Microsoft.AzureActiveDirectory namespace provider is not enabled by default for the subscription.

Similarly there are many namespace providers which we don’t need in many cases so they are disabled by default.

Let’s fix the error

We will try to fix the error using following two approaches:

Enabling the Microsoft.AzureActiveDirectory namespace provider from Azure Portal UI

In the Azure Portal, navigate to your subscription and select the Resource Providers as shown below.

In the Resource Providers you will see lot of namespace providers such as following, and many of them will be disabled.

In the search box search for Microsoft.AzureActiveDirectory.

Then select Microsoft.AzureActiveDirectory from the filtered option and click on Register.

It will start registering namespace provider, it will take some time to register.

Try refreshing to see the Registered status.

Try again creating the Azure AD B2C tenant, the error should be fixed now.

Enabling the Microsoft.AzureActiveDirectory namespace provider using Azure CLI

In this section we will see how we can enable the required namespace provider using Azure CLI.

If you have not already installed, then install Azure CLI from here.

When Azure CLI is installed you need to login to azure.

az login

This will open a new browser window to authenticate user.

We can list all subscriptions using following. We will need right subscription in next step.

az account list

Now set the subscription you are interested in. “Pay-As-You-Go” in this case.

az account set --subscription "Pay-As-You-Go"

Then finally register the required namespace provider.

az provider register --namespace Microsoft.AzureActiveDirectory

Once this is complete, the error will be fixed and you should be able to create Azure AD B2C tenant.


In this post we learned how to fix the following error.

The subscription is not registered to use namespace ‘Microsoft.AzureActiveDirectory’

We took two approaches to fix the error, from Azure portal UI and Azure CLI.