A cloud-based identity and access management service for securing user authentication and resource access
In Microsoft Entra ID, the equivalent of Cognito-style JWT issuance is to register an application, configure OAuth 2.0 / OpenID Connect, and then request tokens for that app. Custom claims like deep_product, deep_environment, application, and aws_account must be added by the token issuer (your app or an API) according to the standards.
At a high level, the secure and supported approach is:
- Register an app in Microsoft Entra ID
- Register the application so it can receive security tokens.
- The app registration gives an Application (client) ID and allows configuration of redirect URIs and endpoints used to obtain tokens.
- This app will be the OAuth/OIDC client that requests access tokens and ID tokens from Microsoft Entra ID.
- Use OAuth 2.0 / OpenID Connect flows to get tokens
- Use a standard OAuth or OpenID Connect flow to obtain tokens; do not create tokens directly from username/password.
- The Microsoft identity platform issues bearer tokens formatted as JWTs. These include:
- Access tokens – used to call APIs.
- ID tokens – used to sign in users and convey identity information.
- Refresh tokens – used to obtain new access/ID tokens.
- The app uses its client ID (and secret or certificate, depending on the flow) to authenticate when requesting tokens.
- Configure JWT bearer authentication in the API
- For an ASP.NET Core API, configure JWT Bearer Authentication so the API can validate the tokens issued by Microsoft Entra ID.
- The
JwtBearerHandlervalidates the token signature and extracts claims for authentication and authorization. - Use the issuer’s public keys (asymmetric keys) to validate tokens; this is the recommended pattern.
- Add custom claims instead of hand-crafting tokens
- Do not create production access tokens manually from a username/password request.
- Use standards (OpenID Connect / OAuth) and asymmetric keys to issue tokens.
- If custom claims like
deep_product,deep_environment,application, andaws_accountare needed, they should be added by the token-issuing component in accordance with these standards and then consumed by the API via JWT bearer authentication.
- Use secure storage and transport
- For web apps, store tokens on a trusted backend and use secure HTTP-only cookies to communicate with the browser when appropriate.
- Treat refresh tokens and access tokens as sensitive data.
This pattern gives an OAuth/OIDC-based JWT similar to Cognito, with Microsoft Entra ID as the identity provider and ASP.NET Core (or another platform) validating the JWT via standard JWT bearer authentication.
References: