Ongoing digital relationships and connectivity with people and things are fundamental to the success of today's organizations.
Identity is the foundational technology enabling this. Regardless of their size, organizations need a single way to do identity, whether it be for employees, customers, partners or devices. Anything must be able to have a digital relationship - and connect to anything else.
Azure Active Directory (Azure AD) is Microsoft's vehicle for responding to this requirement by providing Identity Management as-a-Service (IDaaS) capabilities in a cloud or hybrid environment.
By leveraging efficiencies of the cloud and automation to get efficiencies in identity, IDaaS service can:
These requirements and capabilities will drive almost all organizations to subscribe to identity services that are cheaper, broader in scope, more unifying and more capable than the systems of today.
Because of its enterprise relationships, and its early commitment to build an enterprise grade identity service at cloud scale, Microsoft's approach to IDaaS is deeply grounded in – and extends – the proven concepts of on-premises Active Directory (AD).
AD is a Microsoft brand for identity related capabilities. Microsoft has earned widespread adoption of its on-premises identity technology, a suite of capabilities packaged and branded as Windows Server Active Directory (WSAD or simply AD).
In the on-premises world, AD provides a set of identity capabilities. AD is used extensively by governments and enterprises world-wide. AD is widely deployed in the Fortune 1000 and the Global 5000 today as their authoritative identity and access management system as well as in small and medium enterprises and we will not describe it further except to underline one essential point: to meet the requirements of hybrid deployment AD can be extended into public clouds and/or into private clouds.
Azure AD is AD reimagined for the cloud, hardened for the realities and dangers of the cloud environment, and designed to help you solving the new identity and access challenges that come with the shift to a cloud-centric world.
Azure AD is a comprehensive identity and access management cloud solution, utilizing the enterprise-grade quality and proven capabilities of AD on-premises. It combines core directory services, advanced identity governance, security and analytics, and application access management.
Azure AD has been designed to easily extend AD (in whole or in part) into the public Azure cloud as a directory whose content is owned and controlled by the organization providing the information.
Azure AD is NOT a monolithic directory of information belonging to Microsoft, but rather different directories belonging to and completely controlled by different organizations. This architecture and commitment is called "multi-tenant" and great care has been provided to insulate tenants (organizations) from each other and from their service operator – Microsoft. Azure AD is a vast network of independent identity systems and directories owned by organizations.
Azure AD is indeed trusted by millions of organizations serving hundreds of millions of identities for access to Software as a Service (SaaS) applications, including Office 365 and thousands of other partner applications.
We have indeed re-engineered AD, to support massive scale, devices based on any operating system or architecture, modern business applications, modern protocols, high availability, and integrated disaster recovery. Azure AD is delivered in a highly-available, fault-tolerant architecture from over 32 regions worldwide.
Note The service operates more than 10 million of tenants and actually processes more than 1.3 billion, with a B, authentications every week. Since the release of the service, Azure AD has processed 1 trillion identity authentications. This is a real testament to the level of scale we can handle. At a high level, Azure AD is a high availability, geo-redundant, multi-tenanted, multi-tiered cloud service that has delivered 99.99% uptime for over a year now.
As outlined above, we run it across 32 regions around the world. Azure AD has stateless gateways, front end servers, application servers, and sync servers in all of those data centers. Azure AD also has a distributed data tier that is at the heart of our high availability strategy. Our data tier holds more than 750 million objects.
Given the numbers cited in this note and its track record since we first talked about it in November 2011, Azure AD has shown itself to be a robust identity and access management service for Microsoft cloud services. No other cloud directory offers this level of enterprise reliability or proven scale.
Furthermore, last year, Gartner in their Magic Quadrant (MQ) for Identity Management as a Service (IDaaS) has placed Azure AD after its only first year of availability in the "Visionaries" MQ. As of this writing, Gartner has just released their MQ for IDaaS for 2016 and Azure AD Premium has been placed in the "Leaders" quadrant, and positioned very strongly for our completeness of vision.
Important note The above graphic was published by Gartner, Inc. as part of the larger research document - a complimentary access is provided here- and should be evaluated in the context of the entire document. Gartner does not endorse any vendor, product or service depicted in its research publications, and does not advise technology users to select only those vendors with the highest ratings or other designation. Gartner research publications consist of the opinions of Gartner's research organization and should not be construed as statements of fact. Gartner disclaims all warranties, expressed or implied, with respect to this research, including any warranties of merchantability or fitness for a particular purpose.
As Alex Simons, Director of Program Management, Microsoft Identity and Security Services Division, says, "we're thrilled with the result. It really validates our vision of providing a complete solution for hybrid identity and access for supporting employees, partners and customers all backed by world class security based on Microsoft's intelligent security graph. This result says a lot about our commitment in the identity and access management space but more importantly about our customers, implementation partners and ISV partners who have worked together with us. They have been awesome about sharing their time and energy every day, to make sure that the products and services we build meet their needs and are helping them position their companies to thrive in the emerging world of cloud and devices.
You might be surprised to know that Microsoft also is the only vendor in the Leader quadrant across Gartner's Magic Quadrants for IDaaS, Cloud Infrastructure as a Service (IaaS), Server Virtualization, Application Platform as a Service, Cloud Storage Services, and as a leader across the data platform and productivity services. This really shows you why customers are choosing Microsoft across the full spectrum of cloud computing – our services are well integrated and also among the best available in their individual categories."
Note For information on the available Azure AD editions, see later in this document and/or the article Azure Active Directory editions.
Alex Simons adds: "our effort doesn't stop here. We have a lot of hard work ahead of us and we are planning to deliver more innovative capabilities to further improve our position in the "leaders" quadrant.".
In this context, Azure AD extends its capabilities to embrace identity management (IDM) of individual consumers with a new service for Business-to-Consumer: Azure AD B2C, now in GA.
Azure AD B2C is a comprehensive, cloud-based, consumer identity management solution for your consumer-facing applications that can be easily integrated into any platform and accessed from any device.
As of this writing, Azure AD B2C is in GA in North America, and in public preview elsewhere.
Note For more information, see article Azure Active Directory B2C: Production-scale vs. preview B2C tenants.
This service is available on a pay-as-you-go (PAYG) basis. You can get with a free tier up to 50,000 users and 50,000 authentications per month, and when you will have more end users and traffic to your consumer-facing application(s), a fraction of a cent per stored identity and authentication will be charged. An Azure subscription is required.
Note For more information on usage model, see article Azure Active Directory B2C Pricing.
This document is intended as an overview document for discovering and understanding the benefits of Azure AD B2C, and how your application can leverage this new service.
While much of the technology of Azure AD must remain the same (e.g. directory), the IDM of employees and IDM of consumers also have many different requirements – thus the need for technologies that interact but are honed to specific problems. To master these requirements, Microsoft has worked closely with a number of customers during the private and public previews.
Built on existing Microsoft's documentation, knowledge base articles, and blog posts, this document provides a complete walkthrough to test, and evaluate Azure AD B2C. It provides additional guidance if any.
Note You can also share your thoughts on the Azure AD B2C using User Voice with the phrase "AzureADB2C:" in the title of your post so that it can be found.
This document is not intended as an overview document for the Azure AD offerings but rather focusses on this new Azure AD B2C identity service.
Note For additional information, see article Getting started with Azure AD. As well as the whitepapers Active Directory from the on-premises to the cloud and An overview of Azure AD as part of the same series of documents.
Likewise, it doesn't provide either in-depth description on how to implement a specific covered feature or capability. Where necessary, it instead refers to more detailed documents, articles, and blog posts that describe a specific feature or capability.
Note Please make sure you periodically check the Azure Active Directory B2C: FAQs, Azure AD community forum as well as the Enterprise Mobility + Security (EMS) Team blog for notification of upcoming enhancement and changes that pertain to Azure AD.
To cover the aforementioned objectives, this document is organized in the following four sections:
These sections provide the information details necessary to understand the new capabilities introduced in Azure AD for Business-to-Consumer (B2C) scenarios, and successfully evaluate all the available features.
This document is intended for IT professionals, system architects, and developers who are interested in understanding how Azure AD B2C help managing identities for their consumer-facing application(s) in their (hybrid) cloud environment and how to leverage the related features.
It is evident that enterprises and governments will use their (hybrid) IDaaS services to manage the authentication and authorization of internal employees.
But in the outward looking world that is emerging so quickly it will be just as important to manage access to services by an organization's supply chain, its customers (including individuals), its leads and prospects. In the same way, governments will benefit from these services when interacting with other government agencies, enterprises and citizens.
Today, enterprises and governments struggle to manage the accounts, credentials and entitlements of their huge populations of external users that are not well served by existing identity and access control systems.
From an organization's perspective, this population of "external users" represents all the people who interact with its online applications and APIs, but who are not directly members of the organization itself. Consumers, customers, clients, citizens, retirees, partners, etc. are chief amongst them. Typical populations of these "external users" dwarf the size of an organization's internal workforce.
Current best practices – maintaining local accounts and passwords – can lead to debilitating financial and personnel costs, and front-page security and privacy disasters. The on-premises solutions in place to sustain the above interactions indeed face a multitude of challenges.
This obviously starts with the security and privacy risks that must be adequately addressed when storing credentials and personally identify information (PII)/ or sensitive personal information (SPI) in various application databases.
From an implementation standpoint, organizations typically have to cope with heterogeneous stove-piped identity systems that are custom built, acquired from 3rd parties, part of legacy systems, etc. along with different data types and formats, different types of extensibility/states of modifications possible, different application platforms and systems (and even blurred system boundaries), etc.
Beyond the subsequent lack of a unified view, this usually results in high total cost of ownership (TCO) with not only the software licensing, maintenance, and upgrade costs implied with such an on-premises infrastructure but also with 7 x 24 operations and the support staff required to ensure the service.
This leads both to quality of service (QoS) challenges (given the absence of a high availability and/or disaster recovery infrastructure) and a lack of scalability (up to millions of these "external users") since legacy systems have no elasticity when it comes to demand spikes.
Organizations need a specialized service that handle identity at the appropriate scale while assuring the necessary security and privacy. – This demands an increased level of specialization and professionalization adequate to emerging cyber threats. Once this is understood it becomes obvious why you get more capability for less money by leveraging cloud capabilities.
A specialized identity service directly attacks the above challenges – simplifying life for enterprises, ISVs, government agencies and their "external identities".
Kim Cameron, Microsoft Chief Identity Architect, is convinced that "organizations will find they need new identity management capabilities to take full advantage of the cloud and integrate cloud services with their on-premises environment. They will also find that the most reliable and cost-effective way to obtain these capabilities is through using the cloud to master the cloud."
In addition to managing their employees and mobile workforce access the required SaaS and (cloud-based, hybrid, and on-premises) Line-Of-Business (LOB) applications, Azure AD can help organizations manage their external users, and thus deliver (web and mobile) applications, such as a retail store front to consumers.
Note The word "consumer" is used here to refer to the ultimate consumer, customer, client, citizen, retiree, or a supporter of a business, government or charity, someone who is acting as an individual, and not as a
This is what the new service Azure AD B2C should be used for to meet the growing needs organizations looking to connect their consumers via such applications. In the aforementioned research document, Gartner says that "B2C use cases have grown in importance as organizations look to replace a mixture of custom-developed IAM products and traditional on-premises IAM products".
While much of the technology of Azure AD must remain the same (e.g. directory), Azure AD B2C allows to accommodate many different requirements – thus the need for technologies that interact but are honed to specific problems. In fact, the Azure AD and Azure AD B2C services can be thought of as a continuum, so approaches need to be able to be mixed and deployed flexibly.
Azure AD B2C is designed to solve the identity management challenges that have emerged, as economic and competitive pressures drive commercial enterprises, ISVs, educational institutions, and government agencies to shift their service delivery channels from face-to-face engagements to online web applications, web API, as well as native mobile applications.
Azure AD B2C extends Azure AD to deliver all of the functionality required of a cloud era IDaaS solution for connecting all your consumer-facing modern applications, that can be integrated in any platform, and accessible from any device.
Azure AD B2C acts on behalf of a consumer-facing application (aka relying party or RP) by automating and managing all the mechanisms through which it obtains digital identity information to enable the RP to make informed access control and personalization decisions about a transaction requested by an external user. Consequently, Azure AD B2C supports a spectrum of identity services from high security (e.g. phone-based multi-factor authentication) to satisfy organizational "Know Your Consumer" (KYC) requirements.
Azure AD B2C has characteristics shaped by the importance of identity for both the protection of assets and the enhancement of relationships as we enter the era of the social enterprise. There is general agreement on the need to provide individuals and organizations with more "secure, efficient, easy-to-use, and interoperable identity solutions to access online services in a manner that promotes confidence, privacy, choice, and innovation".
Azure AD B2C service has been developed out of a broad dialog internationally and in conformance with requirements from a great many expert sources in government and industry, and is being exercised in multiple pilots globally, and even more like with the Real Madrid, the #1 sports franchise in the world, that needed to directly engage with its 450 million fans:
"For user authentication and profile storage, the solution uses a preview version of the Azure Active Directory Business to Consumer (B2C) identity service. Fans get simplified registration and login through use of social accounts like Facebook, or they can use traditional username/passwords for a seamless experience across mobile applications on any platform. Using a standard service built on the established Azure Active Directory platform significantly reduced custom code while giving Real Madrid customized branding and alleviating concerns about security, data breaches, and scalability."
Azure AD B2C can scale to large populations (up to hundreds of millions per organization) of consumers and is built on the same enterprise-grade (high-availability, geo-redundant, secure, etc.) Azure AD technology platform that supports Office 365. Built on an enterprise-grade secure platform, Azure AD B2C keeps your business and your consumers protected.
Considering all the objectives outlined in the previous section, the features of Azure AD B2C are articulated around five main pillars:
Let's consider them in the next sections where a specific section will be devoted to each pillar.
As a whole, these pillars enable Azure AD B2C to provide a unified view of the consumer (sign up, sign in, and profile editing) across all the consumer facing applications exposed by your organization.
For consumers, social media is emerging as a key source of identity. Real world examples of this include organizations that have internet-centric business models. Consider music download sites such as Spotify that allow users to login using their Facebook identities make it far easier for users to sign up.
Furthermore, usage of social identities appears to be expanding into more conservative areas; for example, the UK government has evaluated Facebook as part of the Identity Assurance (IDA) program, a way of better enabling secure transactions between public sector bodies and citizens.
At the same time these changes present new challenges for the consumer-facing applications (both on-premises and in the cloud) that represent identity lifecycle management, provisioning, role management, authentication and security of users and devices requiring granular access. The net result is to propel identity to first rank of importance.
In terms of authentication to a consumer-facing application, Azure AD B2C gives end users a choice between:
-or-
Beyond local accounts, enabling BYOI ensures user adoption, given that there are millions of consumer identities in use today from the aforementioned social identity providers and end users are more likely to remember a password they use daily rather than a few times a year.
Enabling BYOI is only the first part of the solution. Clearly these social identities are self-asserted and of such low identity assurance that they are not sufficient to authorize access to valuable or sensitive information.
To address this concern, Azure AD B2C can improve organizational security by requiring end users to employ an additional authentication method when the use case warrants it. Azure AD B2C indeed allows organizations to seamlessly benefit from an optional (phone-based) multi-factor authentication whenever needed.
Note For more information, see article Azure Active Directory B2C: Enable Multi-Factor Authentication in your consumer-facing applications.
This authentication is based on Azure Multi-Factor Authentication.
Note For more information, see related documentation as well as the whitepaper Leverage Multi-Factor Authentication with Azure AD in the same series of document.
To make it easy for your external users to get to your consumer-facing application(s), Azure AD B2C is as its core a flexible, policy-based, data-driven identity exchange service that orchestrates authentication with attribute requests. In this context, a flexible policy framework provides granular control over seamless user experiences and behaviors for your consumer-facing applications.
This policy framework allows the creation of these enterprise-level policies. These policies enable you to instantiate/refine supported out-of-the-box (OOB) user experiences or journeys for the consumer facing-applications.
Let's see how this works starting from the supported OOB user journeys, and what can be defined and configured.
Azure AD B2C supports the following five OOB user journeys: i) self-service sign-up (Sign-up), ii) single sign-on (Sign-in), iii) sign-up or sign-in (Sign-up or Sign-in), iv) profile editing (Edit your profile), and v) self-service password reset (Reset your password) for local accounts.
These OOB user journeys encompass as series of actions in sequence in terms of authentication and information collection.
As such, the Sign-up user journey provides self-service consumer registration. It allows the end user to:
Likewise, the Sign in user journey basically allows the end user to:
Note A phone number will be collected if no number is present in the B2C tenant for the user. (See later in this document).
Note Self-service password reset (SSPR) management can be provided for local accounts as part of the Sign in journey.
Above steps are skipped if the user is already signed in.
Based on the above journeys, the unified" Sign-up or Sign-in journey indeed allows the end user to switch into Sign-up mode the first time the end user employs a social identity.
The Edit your profile journey provides self-service capabilities such as self-service profile management. It notably allows to:
Steps are skipped if already signed in.
And eventually, the Reset your password journey provides self-service capabilities such as self-service password resets for local accounts. To get back a local account, it notably allows to:
As introduced above, from a practical standpoint, these OOB user journeys are defined through related enterprise-level policies created through a policy framework. As such, a corresponding policy category is provided for each type of supported OOB user journeys, i.e. i) sign-up policy, ii) sign-in policy, iii) sign-up or sign-in policy, iv) profile editing policy, and v) password reset policy.
From an application perspective, the developer just redirects to B2C specifying which policy he wants and gets back the authenticated result of the journey as a set of claims with zero app complexity. (see section later in this document). All of the logic resides in the policy and is orchestrated by Azure AD B2C's Identity Experience Engine. You don't need to code any of this.
Note For more information, see article Azure Active Directory B2C: Extensible policy framework.
Considering the above, a sign-up policy enables sign-up in your application and allows:
Note Sign up attributes can be built-in user attributes and/or custom user attributes via an extensible directory schema,
Likewise, a sign-in policy enables sign-in in your application and allows:
A "unified" sign-up or sign-in policy enables sign-up or sign-in in your application. Typically, an application provides two separate buttons for sign up and sign in that users have to pick from. With "unified" sign-up or sign-in policy, your application can provide a single click experience for sign up or sign in based on context. When both new and existing end-users click on a button called "Join / Sign in" they are given the choice to:
For that purpose, "unified" sign-up or sign-in policy allows all what the aforementioned policies allow. In addition, the UI on every page of this experience served by Azure AD B2C is fully customizable. (See section § Customizing the overall user experience.)
A profile editing policy allows:
And eventually, a reset password policy allows to create and use multiple, fully customizable password reset experiences. This means that all applications don't have to share a single common password reset experience. The UI on every page of this experience served by Azure AD B2C is fully customizable. (See section § Customizing the overall user experience.)
Policies have a consistent "developer" interface that allows a graphical and fully guided definition of the policies. Azure AD B2C supports the live run of the policy straight from the UI to test the policy without a single line of code.
Even more interestingly, policies are units of re-use for applications. In other words, such policies once created typically constitute reusable user journeys. You can create multiple policies of the same type and use any policy in any application at runtime.
Indeed, policies can be articulated on an application by application basis. In other words, a registered consumer facing-application can then in turn adhere to them – one policy per type of user journey - thus enabling to drive the application compliance.
You invoke them in your application using standard identity protocol requests to Azure AD B2C and you receive tokens with claims (customized by you) as responses. (See section § Seamlessly integrating your consumer facing applications.)
To ease the re-use and the modification of policies, policies can be exported and downloaded from the UI as an XML file. The following code snippet illustrates a sign-up policy named B2C_1_B2CSignUp.
<TrustFrameworkPolicy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/online/cpim/schemas/2013/06" PolicySchemaVersion="0.3.0.0" TenantId="contoso369b2c.onmicrosoft.com" PolicyId="B2C_1_B2CSignUp" PublicPolicyUri="http://contoso369b2c.onmicrosoft.com/"> <BasePolicy> <TenantId>contoso369b2c.onmicrosoft.com</TenantId> <PolicyId>base-v1</PolicyId> </BasePolicy> <ClaimsProviders> <ClaimsProvider> <DisplayName>PhoneFactor</DisplayName> <TechnicalProfiles> <TechnicalProfile Id="PhoneFactor-Common"> <EnabledForUserJourneys>OnClaimsExistence</EnabledForUserJourneys> </TechnicalProfile> </TechnicalProfiles> </ClaimsProvider> <ClaimsProvider> <DisplayName>Self Asserted</DisplayName> <TechnicalProfiles> <TechnicalProfile Id="SelfAsserted-Input"> <InputClaims> <InputClaim ClaimTypeReferenceId="state" /> <InputClaim ClaimTypeReferenceId="postalCode" /> <InputClaim ClaimTypeReferenceId="extension_LoyaltyNumber" /> <InputClaim ClaimTypeReferenceId="city" /> <InputClaim ClaimTypeReferenceId="displayName" /> </InputClaims> <OutputClaims> <OutputClaim ClaimTypeReferenceId="state" /> <OutputClaim ClaimTypeReferenceId="postalCode" /> <OutputClaim ClaimTypeReferenceId="extension_LoyaltyNumber" /> <OutputClaim ClaimTypeReferenceId="city" /> <OutputClaim ClaimTypeReferenceId="displayName" /> </OutputClaims> </TechnicalProfile> </TechnicalProfiles> </ClaimsProvider> <ClaimsProvider> <DisplayName>Azure Active Directory</DisplayName> <TechnicalProfiles> <TechnicalProfile Id="AAD-WriteCommon"> <PersistedClaims> <PersistedClaim ClaimTypeReferenceId="state" /> <PersistedClaim ClaimTypeReferenceId="postalCode" /> <PersistedClaim ClaimTypeReferenceId="extension_LoyaltyNumber" /> <PersistedClaim ClaimTypeReferenceId="city" /> <PersistedClaim ClaimTypeReferenceId="displayName" /> </PersistedClaims> </TechnicalProfile> </TechnicalProfiles> </ClaimsProvider> </ClaimsProviders> <UserJourneys> <UserJourney Id="B2CSignUp"> <OrchestrationSteps> <OrchestrationStep Order="1" Type="ClaimsProviderSelection" ContentDefinitionReferenceId="api.idpselections.signup"> <ClaimsProviderSelections> <ClaimsProviderSelection TargetClaimsExchangeId="GoogleExchange" /> <ClaimsProviderSelection TargetClaimsExchangeId="SignUpWithLogonEmailExchange" /> <ClaimsProviderSelection TargetClaimsExchangeId="FacebookExchange" /> </ClaimsProviderSelections> </OrchestrationStep> </OrchestrationSteps> </UserJourney> </UserJourneys> <RelyingParty> <DefaultUserJourney ReferenceId="B2CSignUp" /> <TechnicalProfile Id="PolicyProfile"> <DisplayName>PolicyProfile</DisplayName> <Protocol Name="OpenIdConnect" /> <OutputClaims> <OutputClaim ClaimTypeReferenceId="state" /> <OutputClaim ClaimTypeReferenceId="objectId" /> <OutputClaim ClaimTypeReferenceId="postalCode" /> <OutputClaim ClaimTypeReferenceId="identityProvider" /> <OutputClaim ClaimTypeReferenceId="extension_LoyaltyNumber" /> <OutputClaim ClaimTypeReferenceId="displayName" /> <OutputClaim ClaimTypeReferenceId="emails" /> <OutputClaim ClaimTypeReferenceId="city" /> <OutputClaim ClaimTypeReferenceId="sub" /> </OutputClaims> <SubjectNamingInfo ClaimType="sub" /> </TechnicalProfile> </RelyingParty> </TrustFrameworkPolicy>
If you want to, such an XML file can then serve as a template to define a new policy.
Considering the above, let's illustrate a typical logical provisioning workflow. Let's suppose that, at this stage, your organization is in the process to define, create and deploy suitable policies for its App1 consumer-facing application.
The workflow is as follows:
Let's see how Azure AD B2C orchestrates and enforces the above policies at runtime.
The Azure AD B2C policy enforcement engine receives a redirect from your App1 consumer-facing application which includes the B2CSignUp-1 policy to orchestrate, which in turn enforces it at runtime. The following example illustrates how Azure AD B2C orchestrates the various implied requests and operations to establish the claims as required by a sign-up policy:
Once all the requirements of the policy are met, Azure AD B2C returns as per sign-up policy the configured set of claims for the App1 application to evaluate. The App1 application may in turn confirm that the received set of claims match a dataset in its authoritative system of record, and if so, can use accordingly the now "verified" claims.
As a final step in the elevation flow, the App1 application may use the "verified" claims received to put the user through a final out of band proof process. Such a process can for instance consist in sending address confirmation mail to the user at the "verified" postal address. In the case of the above illustration, a confirmation code is simply sent by email.
UI customization for a relating seamless user experience is key for any Business-to-Consumer solution. By seamless user experience, we mean an experience, whether on device or browser, where a user's journey through our service cannot be distinguished from that of the customer service they are using.
Azure AD B2C allows you to customize the look-and-feel of user experience on the various pages that can be potentially served and displayed by a user journey via the defined policies.
For that purpose, Azure AD B2C code in your consumer's browser and uses the modern and standard approach Cross-Origin Resource Sharing (CORS) to load custom content from a specific URL that you specify in a policy to point to your own HTML5/CSS files: "Cross-origin resource sharing (CORS) is a mechanism that allows restricted resources (e.g. fonts) on a web page to be requested from another domain outside the domain from which the resource originated."
Compared to the old traditional way, where template pages are owned by the solution where you provided limited text and images, where limited control of layout and feel was offered leading to more than difficulties to achieve a seamless experience, the CORS way supports HTML5 and CSS and allow you to:
You can provide as many content pages as you like by crafting HTML5/CSS files as appropriate.
Note For security reasons, the use of JavaScript is currently blocked for customization.
In each of your HTML5 files, you provide an "anchor" element, which corresponds to the required <div id="api"> element in the HTML or the content page as illustrate hereafter. The request orchestration core function indeed requires that all content pages have this specific div.
<!DOCTYPE html> <html> <head> <title>Your page content's tile!</title> </head> <body>
<div id="api"></div>
</body> </html>
Azure AD B2C-related content for the page will be injected into this div, while the rest of the page is yours to control. The Azure AD B2C's JavaScript code pulls in your content and injects our HTML into this specific div element. Azure AD B2C injects the following controls as appropriate: account chooser control, login controls, multi-factor (currently phone-based) controls, and attribute collection controls. In terms of commitment, we will ensure that i) all our controls are HTML5 compliant and accessible, ii) all our controls can be fully styled, and iii) a control version will not regress.
Note For more information, see article Azure Active Directory B2C: Customize the Azure AD B2C user interface (UI).
The merged content is eventually displayed as the dynamic document to your consumer.
To ensure of the above works as expected, you must:
Note To verify that the site you are hosting your content on has CORS enabled and test CORS requests, you can use the site http://test-cors.org/. Thanks to this site, you can simply either send the CORS request to a remote server (to test if CORS is supported), or send the CORS request to a test server (to explore certain features of CORS).
Note The site http://enable-cors.org/ also constitutes a more than useful resources on CORS.
Thank to this CORS-based approach, the end users will then have consistent experiences between an application provided by a brand and the pages served by Azure AD B2C.
The aforementioned policies integrate for that purpose the definition of page templates for the user journey to accommodate the various organization's requirements in this space:
Note As of this writing, local account sign-in, and verification emails are only customizable using the company branding feature and not by the above mechanism. For more information, see articles Azure Active Directory B2C: Limitations and restrictions and Add company branding to your sign-in and Access Panel pages.
Note For more information, see article Azure Active Directory B2C: Customize the Azure AD B2C user interface (UI).
In today's world, consumer facing modern applications live in an environment that includes a broad spectrum of mobile and native clients, server to server communication, and web APIs, in addition to traditional browser-and-website interactions. Let's consider how Azure AD B2C allow to embrace the diversity of the situations in a standard fashion.
Interoperability with your consumer-facing applications is maintained with support for industry standard modern protocols, and notably the OpenID Connect 1.0 protocol and the OAuth 2.0 protocol.
Through such standards, Azure AD (B2C), as a next generation authentication platform, is designed to address new requirements that accompany the requirements of the above modern applications.
Note For more information, see article Azure AD B2C: Authentication protocols.
OAuth 2.0 is more than gaining popularity in the Internet as an authorization protocol for accessing information. This is the primarily protocol for authorization and delegated authentication. Generally speaking, using OAuth 2.0, an application can gain access (with consent from the resource owner – which could be the end user or the administrator user) to impersonate the user, or users in his organization to access the resource.
Note For more information, see article Authorize access to web applications using OAuth 2.0 and Azure Active Directory.
OpenID Connect 1.0 defines an identity layer on top of OAuth 2.0 and represents the state of the art in modern authentication protocols. It's a suite of lightweight specifications that provide a framework for identity interactions via REST like APIs. It is based on OAuth 2.0.
Note For more information, see article Authorize access to web applications using OpenID Connect and Azure Active Directory.
Note The OpenID Foundation has recently launched a certification program for OpenID Connect 1.0 implementations. For more information, see article The OpenID Foundation Launches OpenID Connect Certification Program. Azure AD has successfully passed the certification and is certified as an OpenID Connect 1.0 identity provider.
Having an OpenID Connect certification program provides confidence that certified implementations will "just work" together. This represents another important step on the road to widely-available secure interoperable digital identity for all the devices and applications that people use. Microsoft is proud to be a key contributor to the development of OpenID Connect 1.0 and now of its certification program.
Note Many of you might not realize it, but every time you log into the Azure portal you are using OpenID Connect 1.0 and OAuth 2.0 and to do so. OpenID Connect 1.0 is used to authenticate you and the management portal uses OAuth 2.0 to acquire an access token and a refresh token which it then uses to communicate with the Azure service management REST API (RDFE) on your behalf. For more information, see article Service Management REST API Reference.
Many of the tokens issued by Azure AD B2C via the OpenID Connect 1.0 and OAuth 2.0 protocols are implemented with the JSON Web Token (JWT) format. JWT is a compact token format that is especially apt for REST-based development. JWT use is growing, and products supporting the format are increasingly common in the industry.
Note For more information, see article Azure AD B2C: Token reference.
The ability to control the lifetimes of ID tokens, and refresh tokens (as well as access tokens) issued by Azure AD B2C is important both for user experience and for organizations to tune the consumption rate.
The same kind of considerations also applies on how sessions are handled across applications and policies. Azure AD B2C allows you to configure these knobs by editing your existing enterprise-level policies. A few use cases this feature enables are as follows:
Azure AD B2C supports the above standard protocols via a STS: the login.microsoftonline.com sign in service that serves all authentication requests from the consumer-facing applications.
For that purposes, login.microsoftonline.com publishes OpenID Connect 1.0 and OAuth 2.0 directory-specific endpoints for the consumer-facing applications. Once registered, these applications (can) communicate with Azure AD B2C by sending requests to theses endpoints.
As depicted hereafter, the above enterprise-level policies are simply specified as an additional p policy parameter at the end of the query string of the request. Such an extension to the aforementioned protocols allows to perform much more than simple authentication and authorization with a full description of the identity experiences such as sign-up, sign-in, and profile editing as you can expect with these policies.
Let's describe what are these endpoints.
First of all, Azure AD B2C publishes an OpenID Connect 1.0 provider configuration information endpoint, which allows an application to fetch information about Azure AD B2C at runtime. This endpoint is as follows;
https://login.microsoftonline.com/<YourDirectory>.onmicrosoft.com/v2.0/.well-known/openid-configuration?p=<YourPolicy>
Where <YourDirectory> is the name of your B2C tenant used to authenticate the user, and <YourPolicy> an enterprise-level sign-up, sign-in, or profile editing policy created in that B2C tenant and used to acquire a security token.
For example, for the B2C tenant contoso369b2c.onmicrosoft.com, and the B2C_1_B2CSignUp policy the that will be both later created in this document as part of the suggested walkthrough, this corresponds to:
https://login.microsoftonline.com/contoso369b2c.onmicrosoft.com/v2.0/.well-known/openid-configuration?p=b2c_1_b2csignup
This configuration information endpoint provides a JSON configuration document (openid-configuration.json) as per OpenID Connect Discovery specification. This metadata document in JSON format provides configuration information such as the OpenID Connect 1.0 and OAuth 2.0 endpoint locations for the considered policy, the token contents, the token signing key and issuer values to validate, etc.
{ "issuer": "https://login.microsoftonline.com/5de99415-f87f-4d44-b293-cac70508ba24/v2.0/", "authorization_endpoint": "https://login.microsoftonline.com/contoso369b2c.onmicrosoft.com/oauth2/v2.0/authorize?p=b2c_1_b2csignup", "token_endpoint": "https://login.microsoftonline.com/contoso369b2c.onmicrosoft.com/oauth2/v2.0/token?p=b2c_1_b2csignup", "end_session_endpoint": "https://login.microsoftonline.com/contoso369b2c.onmicrosoft.com/oauth2/v2.0/logout?p=b2c_1_b2csignup", "jwks_uri": "https://login.microsoftonline.com/contoso369b2c.onmicrosoft.com/discovery/v2.0/keys?p=b2c_1_b2csignup", { "response_modes_supported": [ "query", "fragment", "form_post" ], "response_types_supported": [ "code", "id_token", "code id_token" ], "scopes_supported": [ "openid" ], "subject_types_supported": [ "pairwise" ], "id_token_signing_alg_values_supported": [ "RS256" ], "token_endpoint_auth_methods_supported": [ "client_secret_post" ], "claims_supported": [ "state", "oid", "postalCode", "idp", "name", "emails", "city", "extension_LoyaltyNumber", "sub" ] }
As listed in the above JSON file, and to sustain the several flows defined in OAuth 2.0, 2 public endpoints are published:
https://login.microsoftonline.com/te/<YourDirectory>.onmicrosoft.com/oauth2/v2.0/authorize?p=<YourPolicy>
For the B2C tenant contoso369b2c.onmicrosoft.com and the B2C_1_B2CSignUp policy, this corresponds to:
https://login.microsoftonline.com/contoso369b2c.onmicrosoft.com/oauth2/v2.0/authorize?p=b2c_1_b2csignup
https://login.microsoftonline.com/<YourDirectory>.onmicrosoft.com/oauth2/v2.0/token?p=<YourPolicy>
For the B2C tenant contoso369b2c.onmicrosoft.com and the B2C_1_B2CSignUp policy, this corresponds to:
https://login.microsoftonline.com/contoso369b2c.onmicrosoft.com/oauth2/v2.0/token?p=b2c_1_b2csignup
After an application is authenticated, Azure AD B2C will issue the application an id_token that allows the application to call the requested web API.
In addition, for OpenID Connect 1.0, one sign-out endpoint is also published as follows:
https://login.microsoftonline.com/<YourDirectory>.onmicrosoft.com/oauth2/v2.0/logout?p=<YourPolicy>
For the B2C tenant contoso369b2c.onmicrosoft.com and the B2C_1_B2CSignUp policy, this corresponds to:
https://login.microsoftonline.com/contoso369b2c.onmicrosoft.com/oauth2/v2.0/logout?p=b2c_1_b2csignup
Such an endpoint is described in the OpenID Connect session management specification.
https://login.microsoftonline.com/<YourDirectory>.onmicrosoft.com/discovery/v2.0/keys?p=<YourPolicy>
For the B2C tenant contoso369b2c.onmicrosoft.com and the B2C_1_B2CSignUp policy, this corresponds to:
https://login.microsoftonline.com/contoso369b2c.onmicrosoft.com/discovery/v2.0/keys?p=b2c_1_b2csignup
This JSON document allows the applications to get the signing keys in order to validate signatures from the OpenID Connect provider of Azure AD B2C.
The following diagram synthetizes the above endpoints:
From an application perspective, a sign-up, sign-in, or profile editing request simply consists in a redirect to the OAuth 2.0 authorize endpoint to execute a policy, i.e. a HTTP GET request to the following URL:
https://login.microsoftonline.com/<YourDirectory>.onmicrosoft.com/oauth2/v2.0/authorize?p=<YourPolicy>&<ProtocolStandardQueryParameters>
Where <YourDirectory> is your B2C tenant, <YourPolicy> the name of respectively your sign-up, sign-in, or profile editing request, and <ProtocolStandardQueryParameters> the expected parameters for the protocol along with context and state information.
The user completes the policy in accordance to the policy definition. The application receives from the endpoint a response that contains a JWT security token, for example an ID token (id_token). A ID token represents the user's identity and provides information about the user in the form of claims. These claims are configured in the policy.
Likewise, a sign-out request for the application is as simply expressed as the following request:
https://login.microsoftonline.com/<YourDirectory>.onmicrosoft.com/oauth2/v2.0/logout?p=<YourPolicy>& ProtocolStandardQueryParameters>
Let's consider an actual example of a real query with all the parameters in lieu of p=<YourPolicy>& ProtocolStandardQueryParameters>. As illustrated later in this document with a sample web app, when an end user clicks on the sign-in button in the app, the OpenID Connect 1.0 sign-in request will look like (line split for readability):
GET https://login.microsoftonline.com/contoso369b2c.onmicrosoft.com/oauth2/v2.0/authorize
?p=b2c_1_b2csignin
&client_id=2a2681b1-ac24-4cb3-9829-ce2315500117
&redirect_uri=https%3a%2f%2flocalhost%3a44316%2f
&response_mode=form_post
&response_type=id_token
&scope=openid
&state=OpenIdConnect.AuthenticationProperties%3dhG6CwJrhmPWMS5n1kIGr6QwI3QwqdpGZ4Q8kcWE_ZX6cdtQgvMDXiXEOuPr9o4D6T2h0R2JuETB2NoMhmx327EiNVSI1abOUMNkjG87_WFOGuTOhqMkK2tQpTvmKhEWqcXbjUO73bN-wlLkSvBrLDFZHmCnbrEuIM-1rMjyqVluXW63BxUQACg8Z1xdbmR2KLgp_Rc79WIAzbSVNVEd7lQ
&nonce=635788649787252713.YjlmZjZmMzYtNzdmMi00N2FjLWEzOTEtY2VlNjgyZWJiMzIxMjY2M2JlOTctNjhlOS00Y2MzLTkxNTAtNGI1YWRiMjQxNjdj
HTTP/1.1
Note The values of state and nonce are opaque to Azure AD B2C. These values are inserted and interpreted by your web application, and more specifically by the code that generated the request, here the OWIN middleware (see below).
As you now understand, the p policy parameter in this illustration invokes a sign-in policy called b2c_1_b2csignin. The OpenID Connect 1.0 response from Azure AD B2C contains an id_token as usual and as expected, carrying the claims you'll configured later in the policy as part of the suggested walkthrough:
id_token= eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IklkVG9rZW5TaWduaW5nS2V5Q29udGFpbmVyIn0.eyJleHAiOjE0NDMyNzE3ODUsIm5iZiI6MTQ0MzI2ODE4NSwidmVyIjoiMS4wIiwiaXNzIjoiaHR0cHM6Ly9sb2dpbi5taWNyb3NvZnRvbmxpbmUuY29tLzVkZTk5NDE1LWY4N2YtNGQ0NC1iMjkzLWNhYzcwNTA4YmEyNC92Mi4wLyIsImFjciI6ImIyY18xX2IyY3NpZ25pbiIsInN1YiI6Ik5vdCBzdXBwb3J0ZWQgY3VycmVudGx5LiBVc2Ugb2lkIGNsYWltLiIsImF1ZCI6IjJhMjY4MWIxLWFjMjQtNGNiMy05ODI5LWNlMjMxNTUwMDExNyIsIm5vbmNlIjoiNjM1Nzg4NjQ5Nzg3MjUyNzEzLllqbG1aalptTXpZdE56ZG1NaTAwTjJGakxXRXpPVEV0WTJWbE5qZ3laV0ppTXpJeE1qWTJNMkpsT1RjdE5qaGxPUzAwWTJNekxUa3hOVEF0TkdJMVlXUmlNalF4TmpkaiIsImlhdCI6MTQ0MzI2ODE4NSwiYXV0aF90aW1lIjoxNDQzMjY4MTg1LCJuYW1lIjoiUGhpbGlwcGUgQmVyYXVkIChGYWNlYm9vaykiLCJpZHAiOiJmYWNlYm9vay5jb20iLCJvaWQiOiI5ZmE1OWZlYy04ZTMxLTRhMjYtOWIwOC0yY2NhMDUwNmMyZTciLCJzdGF0ZSI6IldBIiwicG9zdGFsQ29kZSI6Ijk4MDUyIn0.ACbKkxaXSm4ZqbjPqU74LTatTBENxV_9NysB88b0PAg0VNg3F2mTWEvynVGECpwi83K3AHoSSFEL2zrimPvwR5SbtQ-HmoASydyti12yzYM1Fso95uEvDK-GF0G56_HbqOizu2j7h_xQGl55aYrk5urCURFxIYZmLxEmIFsVr0z9kS8WiluOABxv6ItTgcc__2sCqaOimulABCVFPtOPkO1CePfnio34WUqMxkxVOeAvMXvR8VbvFUaiiGVOIAAcCnd7HBKRrnRpJSfyr4s4P6_vOhmgDQdsKnmPX4DBU747cYKxvLNn996CcdWJ4WI9M_dsG1MCJG8msvQvLLPXyg
Decoding the URLBase64 id_token from the response yields the following claims decoded in JSON:
Note Since the JWT tokens issued by Azure AD B2C are signed but not encrypted, you can easily inspect the content of such a token for debugging purposes. There are several tools available to do so sur as the JWT Decoder and JWT.io.
{ typ: "JWT", alg: "RS256", kid: "IdTokenSigningKeyContainer" }. { exp: 1443271785, nbf: 1443268185, ver: "1.0", iss: "https://login.microsoftonline.com/5de99415-f87f-4d44-b293-cac70508ba24/v2.0/", acr: "b2c_1_b2csignin", sub: "Not supported currently. Use oid claim.", aud: "2a2681b1-ac24-4cb3-9829-ce2315500117", nonce: "635788649787252713.YjlmZjZmMzYtNzdmMi00N2FjLWEzOTEtY2VlNjgyZWJiMzIxMjY2M2JlOTctNjhlOS00Y2MzLTkxNTAtNGI1YWRiMjQxNjdj", iat: 1443268185, auth_time: 1443268185, name: "Philippe Beraud (Facebook)", idp: "facebook.com", oid: "9fa59fec-8e31-4a26-9b08-2cca0506c2e7", state: "WA", postalCode: "98052" }
Since Azure AD B2C is in fact at the core Azure AD, it unsurprisingly has the programming model.
Azure AD B2C provides or will soon provide a support for the following primary scenarios:
Note For more information, see article Azure Active Directory B2C: Web sign-in with OpenID Connect.
Note For more information, see article Azure Active Directory B2C: OAuth 2.0 authorization code flow.
Azure AD B2C no longer only supports web APIs that are accessed by their own well-known clients. So, in other words, all components are no longer compelled to share a single Client ID/Application ID with the support in public preview of access tokens.
Note For more information, see blog post Azure AD B2C Access Tokens now in public preview and article Azure AD B2C: Requesting Access Tokens.
Note For more information, see article Azure Active Directory B2C: Sign-in for Single-Page Apps using OAuth 2.0 Implicit Flow.
Such applications can authenticate and get tokens using an application's identity (rather than using a user's delegated identity) with the OAuth 2.0 client credentials flow. This scenario isn't yet available in Azure AD B2C since applications can only get tokens after an interactive user flow has occurred.
Support for the client credentials flow will be added in the near future.
From a programming standpoint, Azure AD B2C conforms to Azure AD's next generation app model: the Azure AD v2.0 endpoints (a.k.a. Azure AD app model v2.0).
Note For more information, see articles What's different about the v2.0 endpoint?, App types for the Azure Active Directory v2.0 endpoint, v2.0 Protocols - OAuth 2.0 & OpenID Connect, and Azure Active Directory v2.0 tokens reference.
The Azure AD v2.0 endpoints allow you to make protocol calls directly by constructing the HTTP messages necessary to communicate with the Azure AD B2C endpoints. This makes identity management possible on virtually almost every platform and device.
Moreover, there are many open sources libraries available for validating JWT tokens depending on the language of your choice.
Many developers would rather use language-specific APIs rather than looking at the HTTP payload. Others work in organizations where use of APIs has been mandated,
For them, Azure AD B2C allows leveraging standard–based development platform and developer libraries that already support the app model v2.0 and that take care in this context of the "ugly" protocol details for you. The following table gives you some examples of such client libraries of server-side SDKs.
Library |
Description |
|
Active Directory Authentication Library (ADAL) |
The open-source Active Directory Authentication Library (ADAL) identity libraries that enable clients to acquire security tokens from any Azure AD endpoint including B2C, so that they can be used for accessing remote protected resources. These ADAL libraries available on GitHub at https://github.com/AzureAD/ for a variety of platforms: OSes or development stacks. A support for .NET, iOS, and Android is currently available for the Azure AD v2.0 endpoints. |
|
Open Web Interface (OWIN) |
The Open Web Interface (OWIN) specification that describes a standard interface between .NET web servers and .NET applications: by decoupling the two, OWIN makes it possible to write very portable code which is independent from the host it is going to be run on. Katana project is a collection of open-source NuGet packages, which i) makes it possible to run the OWIN middleware on classic ASP.NET/IIS and ii) provides various useful features in form of OWIN components. It adds the necessary security middleware from the Microsoft OWIN OpenID Connect 1.0 and OAuth 2.0 components to handle Azure AD (B2C) authentication and authorization, and generate the necessary initialization code to validate incoming security tokens according to the Azure AD (B2C) directory of choice. |
|
Restify-OAuth2 |
The open-source Restify-OAuth2 package available on GitHub provides a very simple OAuth 2.0 endpoint for the aforementioned Restify framework. (In particular, it implements the OAuth 2.0 client credentials and resource owner password credentials flows only.) |
|
Passport |
The extremely flexible and modular Passport authentication middleware for Node.js. can be unobtrusively dropped in to any Express-based or Restify web application. Note Express is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications. Restify is a REST framework specifically meant for RESTful web service intentionally borrows heavily from Express as that is more or less the de facto API for writing web applications on top of node.js. A comprehensive set of strategies support authentication using a username and password, Facebook, Twitter, and more. The passport-azure-ad plug-in available on GitHub provides a collection of strategies for Azure AD (B2C). This plug-in takes care of all of the ugly details of crafting authentication messages, validating tokens from Azure AD (B2C), and maintaining user session. All that remains is to give your users a way to sign in, sign out, and gather additional info on the logged in user. |
In addition, the same REST-based Azure AD Graph API based management capabilities as Azure AD - including users and groups - can be used in this context from any platform so that your application can make an informed access control decision about a transaction requested by the signed end user.
Note Azure AD Graph API is a RESTful API that provides a directory programming surface for querying and updating the directory, and thus to sustain the identities lifecycle management as whole. For more information, see articles Azure AD B2C: Use the Graph API and Azure AD Graph API REST.
You can complete one of the quick start tutorials provided by the Azure AD B2C documentation to get up and running with the above developer libraries.
Note For more information, see section § Build a Quick Start Application of the article Azure Active Directory B2C: how to Register your Application.
All the quick start applications are available on GitHub on at https://github.com/AzureADQuickStarts/.
To easily identify the code samples in the repo, their name starts with the B2C- prefix such as the B2C-WebApp-WebAPI-OpenIDConnect-DotNet project, a.NET MVC web application code sample, secured by Azure AD B2C, that calls a web API.
Now that you're equipped with some understanding on how to integrate your consumer facing applications, let's continue by an exploration of the service.
Note For the latest information that pertains to how to integrate applications and APIs in Azure AD B2C as covered in this document, please refer to the related section of the Azure AD B2C section of the Azure Active Directory Developer's Guide. This online developer's guide indeed constitutes the de-facto reference content on this subject by providing overviews on implementation, key features, and protocols of Azure AD (B2C).
Interestingly enough, it also provides a collection of quick start guides with complete instructions to perform fundamental development tasks with Azure AD (B2C), designed to help you getting up and running as efficiently as possible.
You can also see the whitepaper Leveraging Azure AD for modern business applications in the same series of document.
Important note if needed, and beyond and above information, you can get help on Stack Overflow using the azure-active-directory or adal tags.
You can use the Azure AD Graph API for programmatic user management, i.e., to create, read, update and delete (CRUD) local accounts in your B2C tenant.
The Azure AD Graph API provides REST interfaces for that purpose. This feature is available on a major version, e.g. 1.6 of the API.
Note For more information, see article Azure AD Graph API REST.
As an illustration, to create a local account in your B2C tenant, you can send a HTTP POST request to the "/users" endpoint on Azure AD Graph API:
POST https://graph.windows.net/contoso369b2c.onmicrosoft.com/users?api-version=1.6 { "accountEnabled": true, "SignInNames": [ // Controls what identifier the user uses to sign into their account { "type": "emailAddress", // Can be 'emailAddress' or 'userName' "value": "joedoe@gmail.com" } ], "creationType": "LocalAccount", // Always set to 'LocalAccount' "displayName": "Joe Doe", "mailNickname": "joe", "passwordProfile": { "password": "Pass@word1", "forceChangePasswordNextLogin": false }, "passwordPolicies": "DisablePasswordExpiration" }
Note A switch allows to disable password complexity checks during local account creation. This allows you to migrate local accounts from an on-premises database (with password complexity rules different from that of Azure AD B2C's) into your B2C tenant.
Note For more information, see article Azure AD B2C: Use the Graph API.
Finally, for this introduction of Azure AD B2C, you can leverage the REST-based Azure AD reporting API to get access to rich consumer activity reports.
Note For more information, see article Getting started with the Azure Active Directory reporting API of the Azure AD Reporting Guide.
You can easily pipe the data from these reports into business intelligence and analytics tools, such as Microsoft Power BI, for detailed analyses.
As of this writing, the following four activity reports are currently available:
Note For more information, see article Accessing usage reports in Azure AD B2C via the reporting API.
The following end-to-end walkthrough from creating a new B2C tenant to successfully running a B2C web application registered on that B2C tenant illustrates the various features of Azure AD B2C.
Note For more information, see article Azure Active Directory B2C: Sign up and sign in consumers in your applications, and the link https://azure.microsoft.com/en-us/trial/get-started-active-directory-b2c/.
An Azure AD B2C test directory can be created through an Azure Subscription. This subscription is only needed to access the Azure portal.
Note If you don't already have an Azure subscription, you can sign-up for a free one-month trial Azure account by following the link https://azure.microsoft.com/en-us/free/.
Note For more information, see article Azure Active Directory B2C: Create an Azure AD B2C tenant.
Important note As of this writing, B2C features can't be turned on in your existing directories, if you have any. It is thus required that you create a new directory to try out the Azure AD B2C service, rather than re-using one of your existing organizational tenants.
To create a new Azure AD B2C tenant, proceed with the following steps:
Your user account is included in that new B2C tenant, and you're assigned to the global administrator role. (Other administrator can be added later as required.)
This enables you to manage the B2C tenant you created without signing in as a different user of that directory.
For the course of this walkthrough, we've created the contoso369b2c.onmicrosoft.com B2C directory/tenant. You will have to choose in lieu of a B2C directory name of your choice whose name is currently not in used.
Whenever a reference to contoso369b2c.onmicrosoft.com is made in a procedure, it has to be replaced by the B2C directory name of your choice to reflect accordingly the change in naming.
You can directly navigate to the B2C settings blade of your B2C tenant using the following URL:
https://portal.azure.com/<NewlyCreatedDomain>.onmicrosoft.com/?Microsoft_AAD_B2CAdmin=true#blade/Microsoft_AAD_B2CAdmin/TenantManagementBlade/id/<NewlyCreatedDirectory>.onmicrosoft.com
And sign in with the Admin credentials, where <NewlyCreatedDirectory> is the B2C tenant you've created, for example in our illustration:
An enabled Browse entry point on the Azure Admin portal is also available to improve discoverability of B2C Admin features.
When signed in with the Admin credentials of your B2C tenant, click Browse on the left hand navigation, and then Azure AD B2C to access the B2C settings blade. If you are already signed in to a different tenant, switch tenants (on the top-right corner).
A local account provider is created by default on your newly created B2C tenant.
To select how to create local accounts, proceed with the following steps:
You now have to proceed with the configuration of the social identity providers you want to use on your B2C tenant. Before you complete the configuration, you need to create first application registrations on the related social identity provider developer portals and supply them with the right parameters to work properly with the Azure AD B2C service.
This section shows you how to configure Facebook and Google+ as social identity providers on your B2C tenant.
Note For more information, see articles Azure Active Directory B2C: Provide sign-up and sign-in to consumers with Facebook accounts, and Azure Active Directory B2C: Provide sign-up and sign-in to consumers with Google+ accounts.
Note For instructions on configuring Amazon, LinkedIn an Microsoft Accounts, see articles Azure Active Directory B2C: Provide sign-up and sign-in to consumers with Amazon accounts, Azure Active Directory B2C: Provide sign-up and sign-in to consumers with LinkedIn accounts, Azure Active Directory B2C: Provide sign-up and sign-in to consumers with Microsoft accounts.
To use Facebook as a social identity provider in Azure AD B2C, you will first need to create a Facebook application and supply it with the right parameters.
You need a Facebook account to perform the following steps. If you don't have one, create one at https://www.facebook.com/.
To create a Facebook application, proceed with the following steps:
Note App Secret is an important security credential.
https://login.microsoftonline.com/te/<YourDirectory>.onmicrosoft.com/oauth2/authresp
where <YourDirectory> is the B2C tenant you've created, for example in our illustration:
https://login.microsoftonline.com/te/contoso369b2c.onmicrosoft.com/oauth2/authresp
You need a Google account perform the following steps. If you don't have one, you can get it at https://accounts.google.com/SignUp.
To create a Google application, proceed with the following steps:
"https://login.microsoftonline.com/te/<YourDirectory>.onmicrosoft.com/oauth2/authresp"
where <YourDirectory> is the B2C tenant you've created, for example in our illustration:
https://login.microsoftonline.com/te/contoso369b2c.onmicrosoft.com/oauth2/authresp
Note URI must be all lower case. Upper case character cause redirect URI mismatch error.
Note Client Secret is an important security credential.
To configure both Facebook and Google on your B2C tenant, proceed with the following steps:
Note For more information, see article Azure Active Directory B2C: Register your application.
To register an application on your B2C tenant, proceed with the followings steps:
Note If you are rather writing a mobile application, toggle the Include native client switch to Yes. Copy down the default Redirect URI automatically created for you.
Note If the application top register also includes a web API that needs to be secured, you'll want to create (and copy) an Application Secret as well by clicking Generate key.
As covered before, you can create policies for the Sign up, Sign in, and Profile Editing user journeys. Such policies describe the experiences that users will go through during respectively sign up, sign in, and profile editing.
Let's start with the sign-up policy and the related operations and steps.
A sign-up policy describes the journeys that users will go through during sign up and the contents of tokens that the application will receive on successful sign ups.
Note For more information, see article Azure Active Directory B2C: Extensible policy framework.
To create a sign-up policy, proceed with the following steps:
A B2C_1_ fragment is added to the front of the policy name you've specified in the steps above: B2C_1_SignUp.
You can click on the policy that you just created and click Run Now to experience the self-service sign up flow without a single line of code.
To test the policy, proceed with the following steps:
https://login.microsoftonline.com/contoso369b2c.onmicrosoft.com/oauth2/v2.0/authorize
?p=B2C_1_B2CSignUp
&client_Id=2a2681b1-ac24-4cb3-9829-ce2315500117
&nonce=defaultNonce
&redirect_uri=https%3A%2F%2Flocalhost%3A44316
&scope=openid
&response_type=id_token
&prompt=login
Finally, the policy blade enables you to export and download the newly created policy as an XML file as mentioned before.
To download the policy, proceed with the following steps:
You're the invited to save an <YourDirectory>.onmicrosoft.com-B2C_1_<YourPolicyName>.xml file for the B2C_1_<YourPolicyName> policy in the <YourDirectory>.onmicrosoft.com tenant.
A sign-in policy describes the journeys that that users will go through during sign in and the contents of tokens that the application will receive on successful sign ins.
Note For more information, see article Azure Active Directory B2C: Extensible policy framework.
To create a sign-in policy, proceed with the following steps:
As previously outlined, the B2C_1_ fragment is automatically added as a prefix to the name of the policy: B2C_1_B2CSignIn. Run now allows you to test the policy you've just created and consequently to experience the sign in flow without a single line of code.
Creating a profile editing policy is similar to creating a self-service sign up policy.
Note For more information, see article Azure Active Directory B2C: Extensible policy framework.
To create a profile editing policy, proceed with the following steps:
The B2C_1_ fragment is automatically added as a prefix to the name of the policy: B2C_1_B2CUserProfileUpdate. As before, Run now allows you to test the policy you've just created Close the blade just opened. Leave the B2C features blade open.
Note All policies have the B2C_1_ fragment added to the front of all the policy names you created in the steps above.
Capture policy names to add to the web sample in the step below, for example in our illustration:
Now that you have an application registered with Azure AD B2C, and "suitable" policies defined, you can add, configure, and run a sample application on your favorite platform and IDE.
For that purpose, you can complete one of the quick start tutorials provided by the Azure AD B2C documentation to get up and running.
Note For more information, see section § Build a Quick Start Application of the article Azure Active Directory B2C: how to Register your Application.
For the purpose of this overview, we will use the .NET MVC sample application.
Note For more information, see article Azure AD B2C: Build a .NET web app.
Visual Studio Community 2015 is a free, fully-featured, and extensible IDE for creating modern applications for Windows, Android, and iOS, as well as web applications and APIs, and cloud services.
To install Visual Studio Community 2015, proceed with the following steps:
For the purpose of this walkthrough, we are going to build and add a sample .NET MVC web application. The code for this sample application is maintained on GitHub: B2C-WebApp-OpenIdConnect-DotNet.
However, for the sake of brevity, we will use an almost completed version for this sample application.
Note To build the sample as you go, you can instead download a skeleton project as a .zip or clone the skeleton:
git clone --branch skeleton https://github.com/AzureADQuickStarts/B2C-WebApp-OpenIdConnect-DotNet.git
Related instructions are provided in above article Azure AD B2C: Build a .NET web app.
To get this almost completed sample application, proceed with the following steps:
We will configure the sample to use the sign-up, sign-in, and update profile policies created in the B2C tenant. This will allow the sample B2C-WebApp-OpenIdConnect-DotNet application to issue sign-up and sign-in requests to the Azure AD B2C service.
The OpenID Connect OWIN middleware (Microsoft.Owin.Security.OpenIdConnect) enables the sample application to seamlessly use OpenID Connect for authentication. This middleware is available as NuGet package for the Visual Studio development environment.
To configure the sample application, proceed with the following steps:
<?xml version="1.0" encoding="utf-8"?> <!-- For more information on how to configure your ASP.NET application, please visit http://go.microsoft.com/fwlink/?LinkId=301880 --> <configuration> <appSettings> <add key="webpages:Version" value="3.0.0.0" /> <add key="webpages:Enabled" value="false" /> <add key="ClientValidationEnabled" value="true" /> <add key="UnobtrusiveJavaScriptEnabled" value="true" /> <add key="ida:Tenant" value="[Enter the name of your B2C tenant, e.g. contoso.onmicrosoft.com]" /> <add key="ida:ClientId" value="[Enter the Application Id assinged to your app by the Azure portal, e.g.580e250c-8f26- 49d0-bee8-1c078add1609]" /> <add key="ida:AadInstance" value="https://login.microsoftonline.com/{0}{1}{2}" /> <add key="ida:RedirectUri" value="https://localhost:44316/" /> <add key="ida:SignUpPolicyId" value="[Enter your sign up policy name, e.g. b2c_1_sign_up" /> <add key="ida:SignInPolicyId" value="[Enter your sign in policy name, e.g. b2c_1_sign_in]" /> <add key="ida:UserProfilePolicyId" value="[Enter your edit profile policy name, e.g. b2c_1_profile_edit" /> </appSettings> … </configuration>
<?xml version="1.0" encoding="utf-8"?> <!-- For more information on how to configure your ASP.NET application, please visit http://go.microsoft.com/fwlink/?LinkId=301880 --> <configuration> <appSettings> <add key="webpages:Version" value="3.0.0.0" /> <add key="webpages:Enabled" value="false" /> <add key="ClientValidationEnabled" value="true" /> <add key="UnobtrusiveJavaScriptEnabled" value="true" /> <add key="ida:Tenant" value="contoso369b2c.onmicrosoft.com" /> <add key="ida:ClientId" value="197da538-760c-4868-afca-94bd5e40b0c1" /> <add key="ida:AadInstance" value="https://login.microsoftonline.com/{0}{1}{2}" /> <add key="ida:RedirectUri" value="https://localhost:44316/" /> <add key="ida:SignUpPolicyId" value="B2C_1_B2CSignUp" /> <add key="ida:SignInPolicyId" value="B2C_1_B2CSignUp" /> <add key="ida:UserProfilePolicyId" value="B2C_1_B2CUserProfileUpdate" /> </appSettings> … </configuration>
You are almost done securing the sample application with Azure AD B2C.
To run the sample application, proceed with the following steps:
To sign up to sample application, click Sign up. You're redirected to an identity provider selection page provided by Azure AD B2C as per B2C_1_B2CSignUp policy.
To sign up as a Facebook account, proceed with the following step:
To sign up as a Google account, proceed with the following step:
To sign up as a local account, proceed with the following step:
If you've followed the instructions provided in the previous section, you should now have some users created in the B2C tenant.
To view the users of the B2C tenant, proceed with the following steps:
End users that signed up with a social identity are listed as cpim_<user#>@<YourDirectory>.onmicrosoft.com, where <YourDirectory> is the B2C tenant you created, and <user#> an allocated user number, for example in our configuration: cpim_964916140232284@contoso369b2c.onmicrosoft.com.
Likewise, end users that signed up locally with a verified address mail are listed as <VerifiedEmailAddress>1#EXT#@<YourDirectory>.onmicrosoft.com, <VerifiedEmailAddress> is the verified email address where @ is replaced by an underscore.
As previously depicted, Azure AD B2C integrates directly with Azure MFA to allow you to smoothly add an additional factor of authentication to sign-up and sign-in experiences in your consumer-facing applications
Note For more information, see article Azure Active Directory B2C: Enable Multi-Factor Authentication in your consumer-facing applications.
Let's modify both the previously configured sign-up and sign-in policies, and try the reconfigured policies.
To enable a multi-factor authentication in the sign-up policy, proceed with the following steps:
https://portal.azure.com/contoso369b2c.onmicrosoft.com/?Microsoft_AAD_B2CAdmin=true#blade/Microsoft_AAD_B2CAdmin/TenantManagementBlade/id/contoso369b2c.onmicrosoft.com
A consumer account gets created in your B2C tenant before the multifactor authentication step occurs. During the step, the consumer is asked to provide their phone number and verify it. If verification is successful, the phone number is attached to the consumer account for later use. Even if the consumer cancels or drops out, the consumer can be asked to verify a phone number again during next sign-in (with multifactor authentication enabled).
To enable a multi-factor authentication in the sign-in policy, repeat steps 1 to 6 of the previous section but select this time the previously configured B2C_1_B2CSignIn sign-in policy.
Let's see the user's experience since for the moment no phone number has been attached to the already created accounts.:
Since no phone number is attached to the account, you're asked to provide one and verify it.
Azure AD B2C provides a self-service password reset (SSRP). This feature allows the users who have signed up for local accounts to reset their passwords on their own.
As on can easily imagine, this significantly contributes to reduce the burden on your organization's support staff, especially if your application has millions of consumers using it on a regular basis. However, your B2C tenant will not have the self-service password reset capability turned on by default.
Note For more information, see article Azure Active Directory B2C: Set up self-service password reset for your consumers.
To turn it on, proceed with the following steps:
Leave it as-is.
To perform a self-service password reset, proceed with the following steps:
A password rest notification mail is sent in parallel to the verified email account.
As mentioned before, you can collect additional information from the user during sign-up in addition to standard built-in B2C tenant attributes.
To do that you first have to create custom attributes and then use them in your policies.
Note Custom attributes use Azure AD Graph API Directory schema extensions under the hood. For more information, see article Azure AD Graph API Directory Schema Extensions.
Note For more information, see article Azure Active Directory B2C: Use custom attributes to collect information about your consumers.
To create a custom user attribute, proceed with the following steps:
To use the newly created custom user attribute, proceed with the following steps:
You should now see LoyaltyNumber in the list of attributes being collected during consumer sign-up and see it in the token sent back to your application.
This concludes our walkthrough on Azure AD B2C. We hope that this gives you an idea of the power of Azure AD B2C whilst for the sake of brevity, it only scratches the surface of the possibilities.
As previously outlined, Microsoft has already worked with a number of developers to build consumer-facing applications using Azure AD B2C as part of the private and public preview programs before the GA.
This has enable to gather a backlog of features:
The above is just a fraction of the list… Towards the path to GA, you can track the progress made by following the Azure AD B2C documentation.
One can also expect a Premium edition in the future with even more advanced capabilities. Stay tuned ;-)