Azure AD B2C and B2B are now in Public Preview!

Published Sep 06 2018 08:28 PM 3,398 Views
First published on CloudBlogs on Sep, 16 2015
Howdy folks, I've been looking forward to this blog post for many weeks! It's definitely the coolest news we've shared with you since the GA of Azure AD Premium in April of last year. Since then we've talked to thousands of customers, and overwhelmingly they've all wanted to know when they could use one Directory Service for their employee, consumer and partner facing services and applications. So today I'm thrilled to make two big announcements:
  1. Our new Azure AD B2C service is now available in public preview.
  2. Our new Azure AD B2B Collaboration capabilities are now available in public preview.
Azure AD B2C Basic is a new service built on the Azure AD platform that helps you stay connected with your consumers. It is an enterprise grade, multi-tenant cloud service that supports authentication with top consumer identity services like Facebook and Google (and soon Microsoft Account). Additionally we have made it easy for you to store and manage hundreds of millions of consumer identities in a secure, reliable, scalable, cost effective service. And like the rest of Azure AD, it is open standards based and cross platform making it easy to add modern identity and security capabilities to your iOS, Android, Windows and browser based applications and services. Azure AD B2C is available on a pay-as-you-go basis. Your first 50,000 consumer identities are free, and then as you get more customers and traffic to your applications, you pay only a fraction of a cent per authentication and per stored identity. While we are kicking off the public preview today, our private preview customers are already using the service live in production. Real Madrid, the world's most popular soccer team uses it to power their mobile phone applications.

"Azure Active Directory B2C helps us bring the stadium closer to our 450 million fans around the globe with simplified registration and login through social accounts like Facebook, or traditional username/passwords login. We're able to provide a seamless experience across mobile applications on any platform. By using Azure Active Directory B2C we were able to build a fully customized login page without having to build custom code. Additionally, with a Microsoft solution in place, we alleviated all our concerns about security, data breaches, and scalability ."

Rafael de los Santos, Head of Digital, Real Madrid

Carl Zeiss, an international leader in the fields of optics and optoelectronics, use Azure Active Directory B2C to power their customer software download portal:

"Azure Active Directory B2C helped us bring our customer software download portal online within weeks instead of months. Support, scalability, and easy to handle software convinced us B2C was the right choice for this critical project. "

Fabian Peschel, Carl Zeiss Industrial Metrology

Azure AD B2B Collaboration is a new set of capabilities in Azure AD that enable secure collaborate between business-to-business partners. These new capabilities make it easy for organizations to create advanced trust relationships between Azure AD tenants so they can easily share business applications across companies without the hassle of managing additional directories or the overhead of managing partner identities. With 6 million organizations already ready using Azure AD, chances are good that your partner organization already has a AAD tenant, so you can start collaborating instantly. But even if they don't, Azure AD's B2B capabilities make it easy for you to send them an automated invitation which will get them up and running with Azure AD in a matter of minutes. Kodak Alaris, a company that is passionate about using technology to transform organizations and improve people's lives across the planet, uses Azure AD B2B collaboration to provide access to shared resources to all their partners:

"We needed to quickly and cost effectively stand up new IT infrastructure including extranet applications for thousands of business partners. Azure AD B2B provides a simple and secure way for partners, large and small, to use their own credentials to access Kodak Alaris systems. The Azure AD team has been an incredible partner in our re-creation of a more agile and cost-effective hybrid cloud IT infrastructure."

Steven C. Braunschweiger, Chief Enterprise Architect, Kodak Alaris

These new B2B Collaboration capabilities can be used with Azure AD Free, Azure AD Basic and Azure AD Premium. To walk you through Azure AD B2C, I've asked Stuart Kwan, the Principal Program Managers in our team responsible for the service to write up a deep dive blog post. You'll find it immediately below. Additionally, Arvind Suthar, the Principal Program Manager responsible for our new B2B capabilities has also written a deep dive post on our new B2B Collaboration capabilities which I hope you take a moment to read as well. We're incredibly pumped to make these services available and we're looking forward to receiving any feedback or suggestions you have! Best Regards, Alex Simons (Twitter: @Alex_A_Simons ) Director of Program Management Microsoft Identity Division ------------------------------------ Hi everyone! It's me, Stuart Kwan. As you've all experienced, there are a lot of places on the Internet where you sign in as a consumer. Your bank, your child's school, online shopping, online games, on the web or your phone or your PC, the list goes on. Today, developers who build the identity management function of these apps face growing challenges around cost, scalability, and security:
  • Cost: There's a lot of code to write for identity management. More than just sign in, you have to help people with things like remembering forgotten usernames and resetting forgotten passwords. Sign in with social networks, with multi-factor authentication, and lately with just an email account or phone number, there's constant innovation going to reduce friction and improve safety. It's a lot of resources to spend that are not working on the core function of your app. Buying off the shelf software is an option, but unfortunately the licensing and maintenance cost for this kind of software can be high.
  • Scalability: Your identity system has to be available 24/7 and it has to scale. Consumer traffic can be seasonal with a wide variation between average and peak load. When kids go back to school, when you launch a new version of your online game, when your team makes the playoffs, or on the biggest shopping days of the year – you have to be able to handle the traffic, which means your hardware has to be provisioned for peak load. That can be expensive.
  • Security: Breaches of consumer-facing applications seem to be getting more frequent. Increasingly, if you have a list of names and passwords in your app, you're a target. Many people use the same username and password with multiple apps. If an attacker can steal your list, they can use it to launch attacks on other sites. A breach hurts your users and can gravely damage your brand. At best you have a handful of developers to tackle this problem, and that doesn't feel like much in the face of ever more sophisticated attacks. But what could be more important to protect than your relationships with your users?
Microsoft is uniquely positioned to help. We have faced these same challenges because we run some of the biggest consumer services in the world in Office 365, Xbox Live, and Skype. We've made big investments to create industry-leading, cloud-scale identity technology with an unmatched quality of service. We've built state of the art anomaly detection and protection systems and we constantly evolve them to guard our users. Through the magic of the cloud, we are going to make these capabilities available for you to use in your applications, and under your control. You will own the data and you will control the user experience, and our service will be hidden under the covers. All you have to do is integrate your app with the service using industry standard protocols.

Introducing Microsoft Azure Active Directory B2C

With Azure Active Directory B2C we're extending Azure AD to address consumer identity management for YOUR applications:
  • Essential identity management for web, PC, and mobile apps: Support sign in to your application using popular social networks like Facebook or Google, or create accounts with usernames and passwords specifically for your application. Self-service password management and profile management are provided out of the box. Phone-based multi-factor authentication enables an extra measure of protection.
  • Highly customizable and under your control: Sign up and sign in experiences are in the critical path of the most important activities in your applications. B2C gives you a high degree of control over the look and feel of these experiences, while at the same time reducing the attack surface area of your application – you never have to handle a user's password. Microsoft is completely under the covers and not visible to your end users. Your user data belongs to you, not Microsoft, and is under your control.
  • Proven scalability and availability: Whether you have hundreds of users or hundreds of millions of users, B2C is designed to handle your load, anywhere in the world. Azure AD is deployed in more than two dozen datacenters, and services hundreds of millions of users with billions of authentications per day. Our engineers monitor the service 24/7.
  • Unique user protection features: Microsoft invests deeply in protection technology for our users. We have teams of domain experts that track the threat landscape. We're constantly monitoring sign up and sign in activity to identify attacks and adapt our protection mechanisms. With B2C we'll apply these anomaly, anti-fraud, and account compromise detection systems to your users.
  • Pay as you go: Azure Active Directory is a global service benefiting from tremendous economies of scale, allowing us to pass these savings along to you. We offer the B2C service on a consumption basis - you only pay for the resources that you use. Developers can take advantage of the free tier of the service when building their application.
B2C uses the same familiar programming model of Azure Active Directory. You can quickly and easily connect your application to B2C using industry standards OAuth 2.0 and OpenID Connect for authentication, and OData v3 for user management via our Graph API. Web app, web API, mobile and PC app scenarios are fully supported. The same open source libraries that are used with Azure Active Directory can be used with B2C to accelerate development. If you want, you can get started right now ! The rest of this post takes a look at how B2C works in detail.

How it works

The best way to describe B2C is to see it in action. Let's look at an example. Our heroes, Proseware, have a consumer-facing web site. The site uses B2C for identity management. In this case that means sign in, and user self-service sign up, profile management, and password reset. Here's the Proseware homepage:

A new user would click sign up to create a new account. They have the choice of creating an account using Google, Facebook, or by creating a Proseware account:

One quick note. The Microsoft button doesn't work yet, but it will soon. It isn't available at the start of the preview as we have more work to do in our converged programming model before we enable this. What's a Proseware account? As it turns out, there are many people out there who don't always want to use a social account to sign in. You probably have your own personal decision tree for when you use your Facebook, Google, Microsoft or other social account to sign in, or when you create an account specifically for a site or app. In B2C a Proseware account is what we call a local account . It's an account that gets created in the B2C tenant using an email address or a flat string as a username, and a password that is stored in the tenant. It's local because it only works with apps registered in your B2C tenant. It can't be used to sign in to Office 365, for example. If a person decides to sign up with a social account, B2C uses information from the social account to pre-fill the user object that will be created in the B2C tenant, and asks the user for any other attributes configured by the developer:

Here we can see the user is also asked to enter a Membership Number and Offering Type. These are custom attributes the Proseware developer has added to the schema of the B2C tenant. If a person decides to sign up with a Proseware account, B2C gathers the attributes configured by the developer plus information needed to create a local account. In this case the developer has configured local accounts using email as username, so the person signing up is also asked to verify their email address:

B2C takes care of verifying the person signing up has control of that email address before allowing them to proceed. Voila, the user is signed up and signed in to Proseware! You might ask yourself, how much code did I need to write to make this elaborate sign up screen? Actually, almost none. The sign up page is being rendered by Azure AD B2C, not by the Proseware application. I didn't have to write any code at all for the logic on that page. I only had to write the HTML and CSS so the page rendered with a Proseware look and feel. The logic for verifying the user's email address and everything else on the page is B2C code. All I had to do was send an OpenID Connect request to B2C requesting the user sign up flow. I'll go into more detail on this later when I talk about how I wrote the app and configured the B2C tenant. Let's look at a return visit. The user returns and clicks sign-in :

If the user clicks one of the social network providers, B2C will direct the person to the provider to sign in. Upon their return B2C also picks up attributes stored in the directory and returns them to the app, signing the user in. If the user clicks the Proseware account button, they'll see the local account sign in page, enter their name and password, and sign in:

That's it! Now I'll show you how I built this example.

Configuring Azure AD B2C

Step one was to get an Azure AD B2C tenant. You can do this by going to the Azure AD section of the Azure management portal and creating a B2C tenant (for a shortcut, see the B2C getting started page ). B2C tenants are a little different from regular Azure AD tenants. For example, in a regular tenant, by default users can see each other in the address book. That's what you'd expect in a company or school – people can look each other up. In a B2C tenant, by default users cannot see each other in the address book. That's what you'd expect – your consumer users shouldn't be able to browse each other! Once you have a B2C tenant, you register applications in the tenant and configure policies which drive the behavior of sign in, sign up, and other user experiences. Policies are the secret sauce of Azure AD B2C. To configure these policies, you jump through a link to the new Azure management portal:

This is also the place where you find controls for setting up applications, social network providers, and custom attributes. I'm going to focus on sign up policy for this example. Here's the list of sign up policies in the tenant. You can create more than one, each driving different behavior:

For the Proseware example I created the B2C_1_StandardSignUp policy. This policy allows a user to sign up using Facebook, Google, or email-named local accounts:

In sign up attributes I indicated what attributes should be gathered from the user during sign up. The list includes custom attributes I created earlier, Membership Number and Offering Type:

When a user completes sign up they are automatically signed in to the application. Using Application Claims I select what attributes I want to send to the application from the directory at that moment:

I'm not using multifactor authentication in this example, but if I did it's just a simple on/off switch. During sign up the user would be prompted to enter their phone number and we would verify it in that moment. Finally, I configured user experience customizations. You might have noticed that the sign up and sign-in experiences have a Proseware look and feel, and there isn't much if any visual evidence of Microsoft or Azure AD. We know that for you to build compelling consumer-facing experiences you have to have as much control as possible over look and feel, so B2C is very customizable even in this initial preview. We do this by enabling you to specify HTML and CSS for the pages rendered by B2C. Here's what the sign up page would look like with the default look and feel:

But if I configure a B2C with a URL to a web page I created with Proseware-specific look and feel:

Then the sign up experience looks like this:

You can probably imagine a number of different approaches for this kind of customization. We're partial to this approach, as opposed to say an API-based approach, because it means our servers are responsible for correct handling of things like passwords, and our protection systems can gather the maximum signal from the client for anomaly detection. In an API-based approach, your app would need to gather and handle passwords, and some amount of valuable signal would be lost. One quick side note. In the initial preview it is possible to do HTML/CSS customization of all the pages except the local account sign in page. That page currently supports Azure AD tenant-branding style customization. We'll be adding the HTML/CSS customization of the sign in page before GA. Also, we currently block the use of JavaScript for customization, but we expect to enable this later. That's a quick look at how I set up a sign up policy. Configuring other policies like sign in and profile management is very similar. As I mentioned earlier, you can create as many policies as you want, so you can trigger different behaviors even within the same app. How to do that? By requesting a specific policy at runtime! Let's look at the code.

Building an app that uses B2C

The programming model for Azure AD B2C is super simple. Every request you send to B2C is an OAuth 2.0 or OpenID Connect request with one additional parameter, the policy parameter "p=". This instructs B2C which policy you want to apply to the request. When someone clicks the sign up button on the Proseware web app, the app sends this OpenID Connect sign-in request:

GET / response_type=id_token& client_id=9bdade37-a70b-4eee-ae7a-b38e2c8a1416& redirect_uri= response_mode=form_post& nonce= WzRMD9LC95HeHvDz& scope=openid& p=b2c_1_standardsignup HTTP/1.1

The policy parameter in this example invokes the sign up policy called b2c_1_standardsignup. The OpenID Connect response contains an id_token as usual, carrying the claims I configured in the policy:



Decoding the id_token from the response yields:

{ typ: "JWT", alg: "RS256", kid: "IdTokenSigningKeyContainer" }. { exp: 1442127696, nbf: 1442124096, ver: "1.0", iss: "", acr: "b2c_1_standardsignup", sub: "Not supported currently. Use oid claim.", aud: "9bdade37-a70b-4eee-ae7a-b38e2c8a1416", nonce: "WzRMD9LC95HeHvDz", iat: 1442124096, auth_time: 1442124096, oid: "2c75d1d5-59af-479b-a9c3-d841ff298216", emails: [ ], idp: "localAccountAuthentication", name: "Stuart Kwan", extension_MembershipNumber: "1234", extension_OfferingType: "1" } Here you can see the usual claims returned by Azure Active Directory and also a few more. The custom attributes I added to the directory and requested of the user during sign up are returned in the token as extension_MembershipNumber and extension_OfferingType. You can also see the name of the policy that generated this token in the acr claim. By the way, we are in the process of taking feedback on claim type names and aligning ourselves better with the standard claim types in the OpenID Connect 1.0 specification. You should expect things to change here during the preview. Since Azure AD B2C is in fact, Azure AD, it has the same programming model as Azure AD. Which means full support for web app, web API, mobile and PC app scenarios. Data in the directory is managed with the REST Graph API, so you can create, read, update, and delete objects the same way you can in a regular tenant. And this is super important – you can pick and choose what features and policies you want to use. If you want to build the user sign up process entirely yourself and manage users via the Graph API, you can absolutely do so. B2C conforms to Azure AD's next generation app model, the v2 app model. To build your application you can make protocol calls directly, or you can use the latest Azure Active Directory libraries that support v2. To find out more visit the B2C section of the Azure AD developer guide – we've got quickstart samples, libraries, and reference documentation waiting for you. Just for fun, I built the Proseware example using Node.js on an Ubuntu Linux virtual machine running on Microsoft Azure (shout out to @brandwe for helping me with the code!).

How much will it cost?

B2C will be charged on a consumption basis. You pay only for the resources you use. There will be three meters, billed monthly:
  1. Number of user accounts in the directory
  2. Number of authentications
  3. Number of multi-factor authentications
An authentication is defined as any time an application requests a token for a resource and successfully receives that token (we won't charge for unsuccessful requests). When you consider the OAuth 2.0 protocol, this counts as when a user signs in with a local account or social account, and also when an application uses a refresh token to get a new access token. You can find the B2C pricing tiers on the pricing page . There will be a free tier for developers who are experimenting with the service. The current B2C preview is free of charge and preview tenants are capped at 50,000 users. We can raise that cap for you on a case by case basis if you contact us . We'll lift the cap when billing is turned on. Do you have hundreds of millions of users? No problem. Bring 'em on!

What's next

We've already worked with many developers to build apps using Azure AD B2C as part of a private preview program. Along the way we've gathered a healthy backlog of features:
  1. Full UX customization: Not just the aforementioned HTML/CSS customization of the local account sign in page, but also the ability to have your URL appear in the browser for every page rendered by B2C. That will remove the last visible remnant of Microsoft from the UX.
  2. Localization: Of course you have users all over the world speaking many languages. Sign in, sign up, and other pages need to render appropriately using strings you provide in the languages you want to support.
  3. Token lifetime control: The ability to control the lifetimes of Access Tokens, ID Tokens and Refresh Tokens is important both for user experience and for you to tune your consumption rate.
  4. A hook at the end of sign up: A number of people have said they want the ability to check a user who is signing up against a record in a different system. A little hook at the end of sign up would allow them to do this, so we're considering it.
  5. Support for more social networks.
  6. Support for custom identity providers: This would be the ability to, say, add an arbitrary SAML or OpenID Connect identity provider to the tenant.
  7. A variety of predefined reports: So that you can review the activity in your tenant at a glance and without having to write code to call an audit log API.
  8. And more, this is just a fraction of the list…
You can track our progress by following the What's New topic in the B2C section of the Azure AD developer guide, which you can find in the documentation pages and also by following this blog. By the way, the proper name of this preview is the Azure Active Directory B2C Basic preview. We're planning a Premium offering as well, with features that take policies to the next level. But that's for another blog post!

Please write us

We're eager to hear your feedback! We monitor stackoverflow (tag: azure-active-directory) for development questions. If you have a feature suggestion, please post it in the Azure Active Directory User Voice site and put "AADB2C:" in the title of your suggestion. Developers of consumer-facing applications face growing challenges around cost, scalability, and security. At Microsoft, we are in a unique position to help. With Azure Active Directory B2C we can help you manage cost, handle scale, and protect your users thanks to the investments we've made in consumer identity management for some of the largest applications in the world. All while giving you full ownership of your data and full control of your user experience. We want to be an extension of your development team – identity domain experts guarding your users in an ever evolving threat landscape. Stuart Kwan (Twitter: @stuartkwan ) Principal Program Manager Azure Active Directory
Version history
Last update:
‎Sep 06 2018 08:28 PM
Updated by: