Azure AD B2C — Hello World!

Siva Saripilli
4 min readSep 18, 2021

I’ve been to a few meetups lately about Azure AD B2C and started getting quite curious to get my hands dirty by trying to get this service working end-to-end. And thought may be it would be a good idea to jot my experience for anyone who might be on the same boat as I am. So here it is!

This article is the first of a few I am hoping to come up with. So, I’ll keep the scope of this article to just creating a B2C resource and setting it up. In the next article I’m hoping to create a web app and use B2C to do the Authorization and Authentication to register or log into the web app. I’ll try to keep this article simple with more screenshots and less of me blabbing 😊!

Jumping straight into it, firstly I wanted to create a Azure AD B2C resource and for doing that, I had to make sure if my Azure subscription had the `Microsoft.AzureActiveDirectory` setting activated. To do so -

Go to `Subscriptions`

Click on the subscription you’d like to use for creating the B2C resource, and then select `Resource Providers`

Locate `Microsoft.AzureActiveDirectory` in the list and make sure it is registered, if not, try clicking on `register` to register the resource.

Go to the portal dashboard by clicking on `Home`

Now try creating a new resource

Search for B2C and select “Azure Active Directory B2C” from the search results as below:

Here you will get to choose if you’d like to create B2C as a new Tenant or if you’d like to link it with an existing Azure subscription. In my case, I’m choosing the first option as I’d be able to safely delete the Tenant and so clean up any resources once I finish with my exercise as I’m doing this on my own account and I don’t want to pay for it 😊.

Tip: If you’re new to Azure and are confused about what a ‘Tenant’ is, consider it as a folder where other resources could be created. Or, if you have any experience with Active Directory, consider it as a Active Directory Forest.

You will be presented with a page where you’ll need to enter some information of how you want to create your B2C resource.

Organization name: Would be the name of your Azure B2C Tenant name

Initial domain name: This should be unique and initially all domain names will be succeeded with “.onmicrosoft.com”. However, in real world you wouldn’t want this to be so as in which case your endpoint would look more like <yourdomainname>.onmicrosoft.com, email maybe created as <youremail>.onmicrosoft.com etc. So, you may want to consider registering your own domain and point this to your domain instead of using the default one.

Country/Region: This would be the closest region available. In my case, it’s Australia.

Subscription: I’ve got only one default subscription, but you can select the subscription that you want the B2C tenant to be created in.

Resource group: Here I’ve created a new resource group or you could select an existing resource group within the subscription.

Resource group Location: Would be “Australia Southeast” in my case as it’s the closest for me. You could select the closest region for yourself.

Click “Review and Create”. Review the details you’ve entered and click “Create”. This will take a few minutes to provision your resource. Go grab a coffee and relax 😊!

Once the resource is provisioned, you’ll get a notification and once you click on it, Azure will take you to your Azure AD B2C tenant. If you have created this as a new tenant, you will be switched to that tenant and you should be able to confirm that at the top right corner. In my case, it switched from the “Default Directory” to “Siva’s B2C Org” as in the below screenshot:

That’s it for this article. In my next article I’ll take the next step of creating a webapp and configure Azure AD B2C to do the authentication and authorization. Exciting times! 😉

Next article > Azure AD B2C — Part 2 (Create and Register User Flows)

--

--