Modifier

Partager via


Create a B2C application

This article describes how to create a Microsoft Dynamics 365 Commerce business-to-consumer (B2C) application in the Microsoft Azure portal.

Once you create your B2C tenant, you'll create a B2C application within your new Microsoft Entra tenant to interact with Commerce.

To create the B2C application, follow these steps.

  1. In the Azure portal, select App registrations, and then select New registration.
  2. Under Name, enter the name to give this Microsoft Entra B2C application.
  3. Under Supported account types, select Accounts in any identity provider or organizational directory (for authenticating users with user flows).
  4. For Redirect URI, enter your dedicated reply URLs as type Web. For information on reply URLs and how to format them, see Reply URLs below. A redirect URI/reply URL must be entered to enable redirections from Microsoft Entra B2C back to your site when a user authenticates. The reply URL can be added during the registration process, or can be added later by selecting the Add a Redirect URI link from the Overview menu in the B2C application's Overview section.
  5. For Permissions, select Grant admin consent to openid and offline_access permissions.
  6. Select Register.
  7. Select the newly created application and navigate to the Authentication menu.
  8. If a reply URL is entered, under Implicit grant and hybrid flows select both the Access tokens and ID tokens options to enable them for the application, and then select Save. If a reply URL wasn't entered during registration, it can also be added on this page by selecting Add a platform, selecting Web, and then entering the redirect URI of the application. The Implicit grant and hybrid flows section is then available to select both the Access tokens and ID tokens options.
  9. Go to the Overview menu of the Azure portal and copy the Application (client) ID. Note this ID for later setup steps (referenced later as the Client GUID).

For additional reference on App Registrations in Microsoft Entra ID B2C, see The new App registrations experience for Microsoft Entra ID B2C

Reply URLs

Reply URLs are important as they provide an allow list of the return domains when your site calls Microsoft Entra B2C to authenticate a user. This permits the return of the authenticated user back to the domain from which they're signing into (your site domain).

In the Reply URL box on the Microsoft Entra ID B2c - Applications > New application screen, you need to add separate lines for both your site domain and (once your environment is provisioned) the Commerce-generated URL. These URLs must always use a valid URL format and must be base URLs only (no trailing forward slashes or paths). The string /_msdyn365/authresp then needs to be appended to the base URLs, as in the following examples.

  • https://www.fabrikam.com/_msdyn365/authresp (The domain should match the e-commerce domain completely. If you have multiple domains, you need to add this URL for each domain.)
  • https://fabrikam-prod.commerce.dynamics.com/_msdyn365/authresp

Next steps

To continue the process of setting up a B2C tenant in Commerce, proceed to Create user flow policies.

Additional resources

Set up a B2C tenant in Commerce

Create or link to an existing Microsoft Entra B2C tenant in the Azure portal

Create user flow policies

Add social identity providers (Optional)

Update Commerce headquarters with the new Microsoft Entra B2C information

Configure your B2C tenant in Commerce site builder

Additional B2C information