Reputation: 23
From our previous ask, we got to know how to create b2c tenant using ARM API. This is the reference: https://learn.microsoft.com/en-us/rest/api/activedirectory/b2c-tenants/create?tabs=HTTP#scopes
But when we tried this from our end it's not working. This failed with error "The subscription is not registered to use namespace 'Microsoft.AzureActiveDirectory' "
In order to check what's going wrong we tried to create b2c tenant from Portal. But there is no use, same error: Error
How to fix this error and where to register namespace in Azure?
Upvotes: 1
Views: 140
Reputation: 22512
This error usually occurs if you have not registered this provider before creating B2C tenant:
Microsoft.AzureActiveDirectory
You can check whether that provider is registered or not like this: Go to Azure Portal -> Subscriptions -> Your subscription -> Resource providers
I tried to reproduce the same in my environment and got below results:
After registering the provider, I ran the below ARM API call via Postman and got Status: 202 Accepted
like below:
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{b2ctenantdomain}?api-version=2021-04-01
{
"location": "United States",
"sku": {
"name": "Standard",
"tier": "A0"
},
"properties": {
"createTenantProperties": {
"displayName": "b2ctenantname",
"countryCode": "US"
}
}
}
Response:
To confirm that, I checked the same in Portal and B2C tenant
is created successfully like below:
When I opened B2C tenant in new tab, it took me to below screen:
Upvotes: 1