Configure Workforce Identity Federation with Microsoft Entra ID and sign in users

This document shows you how to configure Workforce Identity Federation with the Microsoft Entra ID identity provider (IdP) and manage access to Google Cloud. Federated users can then access Google Cloud services that support Workforce Identity Federation. You can use either the OIDC protocol or SAML 2.0 protocol to federate identities.

Before you begin

  1. Make sure that you have a Google Cloud organization set up.
  2. Install the Google Cloud CLI. After installation, initialize the Google Cloud CLI by running the following command:

    gcloud init

    If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

  3. In Microsoft Entra ID, make sure that ID tokens are enabled for implicit flow. For more information, see Enable ID token implicit grant.
  4. For sign-in, your IdP must provide signed authentication information: OIDC IdPs must provide a JWT, and SAML IdP responses must be signed.
  5. To receive important information about changes to your organization or Google Cloud products, you must provide Essential Contacts. For more information, see the Workforce Identity Federation overview.

Costs

Workforce Identity Federation is available as a no-cost feature. However, Workforce Identity Federation detailed audit logging uses Cloud Logging. To learn about Logging pricing, see Google Cloud Observability pricing.

Required roles

To get the permissions that you need to configure Workforce Identity Federation, ask your administrator to grant you the IAM Workforce Pool Admin (roles/iam.workforcePoolAdmin) IAM role on the organization. For more information about granting roles, see Manage access to projects, folders, and organizations.

You might also be able to get the required permissions through custom roles or other predefined roles.

If you're configuring permissions in a development or test environment—but not a production environment—you can grant the IAM Owner (roles/owner) basic role, which also includes permissions for Workforce Identity Federation.

Create a Microsoft Entra ID application

This section shows you how to create a Microsoft Entra ID application using the Microsoft Entra admin center. Alternatively, you can update your existing application. For additional details, see Establish applications in the Microsoft Entra ID ecosystem.

Workforce identity pools support federation using both OIDC and SAML protocols.

OIDC

To create a Microsoft Entra ID application registration that uses the OIDC protocol, do the following:

  1. Sign in to the Microsoft Entra admin center.

  2. Go to Entra ID > App registrations.

  3. To begin configuring the application registration, do the following:

    1. Click New registration.

    2. Enter a name for your application.

    3. In Supported account types, select an option.

    4. In the Redirect URI section, in the Select a platform drop-down list, select Web.

    5. In the text field, enter a redirect URL. Your users are redirected to this URL after they successfully sign in. If you are configuring access to the console (federated), use the following URL format:

      https://auth.cloud.google/signin-callback/locations/global/workforcePools/WORKFORCE_POOL_ID/providers/WORKFORCE_PROVIDER_ID
      

      Replace the following:

      • WORKFORCE_POOL_ID: a workforce identity pool ID that you use when creating the workforce identity pool later in this document—for example, entra-id-oidc-pool.
      • WORKFORCE_PROVIDER_ID: a workforce identity pool provider ID that you use when creating the workforce identity pool provider later in this document—for example, entra-id-oidc-pool-provider.

        For information on formatting the ID, see the Query parameters section in the API documentation.

    6. To create the application registration, click Register.

    7. To use the example attribute mapping that is provided later in this document, you must create a custom department attribute.

Recommended: As a security best practice, we recommend that you configure a group claim by doing the following:

  1. Go to your Microsoft Entra ID application registration.

  2. Click Token configuration.

  3. Click Add groups claim.

  4. Select the group types to return. For more details, refer to Configuring groups optional claims.

SAML

To create a Microsoft Entra ID application registration that uses the SAML protocol, do the following:

  1. Sign in to the Microsoft Entra admin center.

  2. Go to Entra ID > Enterprise applications.

  3. To begin configuring the enterprise application, do the following:

    1. Click New application > Create your own application.

    2. In the Create your own application pane that appears, enter a name for your application.

    3. Click Create.

    4. Go to Single sign-on > SAML.

    5. Update the Basic SAML Configuration as follows:

      1. In the Identifier (Entity ID) field, enter the following value:

        https://iam.googleapis.com/locations/global/workforcePools/WORKFORCE_POOL_ID/providers/WORKFORCE_PROVIDER_ID
        

        Replace the following:

        • WORKFORCE_POOL_ID: a workforce identity pool ID that you use when creating the workforce identity pool later in this document—for example, entra-id-saml-pool.
        • WORKFORCE_PROVIDER_ID: a workforce identity pool provider ID that you use when creating the workforce identity pool provider later in this document—for example, entra-id-saml-pool-provider.

          For information on formatting the ID, see the Query parameters section in the API documentation.

      2. In the Reply URL (Assertion Consumer Service URL) field, enter a redirect URL. Your users are redirected to this URL after they successfully sign in. If you are configuring access to the console (federated), use the following URL format:

        https://auth.cloud.google/signin-callback/locations/global/workforcePools/WORKFORCE_POOL_ID/providers/WORKFORCE_PROVIDER_ID
        

        Replace the following:

        • WORKFORCE_POOL_ID: the workforce identity pool ID.
        • WORKFORCE_PROVIDER_ID: the workforce identity pool provider ID.
      3. To enable IdP-initiated sign-on, set the Relay State field to the following value:

        https://console.cloud.google/
        
      4. To save the SAML application configuration, click Save.

    6. To use the example attribute mapping that is provided later in this document, you must create a custom department attribute.

  4. Assign users or groups to the application.

Recommended: As a security best practice, we recommend that you configure a group claim by doing the following:

  1. Go to your Microsoft Entra ID application.

  2. Click Single sign-on.

  3. In the Attributes & Claims section, click Edit.

  4. Click Add a group claim.

  5. Select the group type to return. For more details, refer to Add group claims to tokens for SAML applications using SSO configuration.

Create a workforce identity pool

gcloud

To create the workforce identity pool, run the following command:

gcloud iam workforce-pools create WORKFORCE_POOL_ID \
    --organization=ORGANIZATION_ID \
    --display-name="DISPLAY_NAME" \
    --description="DESCRIPTION" \
    --session-duration=SESSION_DURATION \
    --location=global

Replace the following:

  • WORKFORCE_POOL_ID: an ID that you choose to represent your Google Cloud workforce pool. The pool ID must be globally unique across all workforce identity pools in Google Cloud. For information on formatting the ID, see the Query parameters section in the API documentation.
  • ORGANIZATION_ID: the numeric organization ID of your Google Cloud organization for the workforce identity pool. Workforce identity pools are available across all projects and folders in the organization.
  • DISPLAY_NAME: Optional. A display name for your workforce identity pool.
  • DESCRIPTION: Optional. A workforce identity pool description.
  • SESSION_DURATION: Optional. The session duration, expressed as a number appended with s—for example, 3600s. Session duration determines how long the Google Cloud access tokens, console (federated) sign-in sessions, and gcloud CLI sign-in sessions from this workforce pool are valid. Session duration defaults to one hour (3600s). The session duration value must be between 15 minutes (900s) and 12 hours (43200s).

Console

To create the workforce identity pool, do the following:

  1. In the Google Cloud console, go to the Workforce Identity Pools page:

    Go to Workforce Identity Pools

  2. Select the organization for your workforce identity pool. Workforce identity pools are available across all projects and folders in an organization.

  3. Click Create pool and do the following:

    1. In the Name field, enter the display name of the pool. The pool ID is automatically derived from the name as you type, and it is displayed under the Name field. You can update the pool ID by clicking Edit next to the pool ID.

    2. Optional: In Description, enter a description of the pool.

    3. To create the workforce identity pool, click Next.

The workforce identity pool's session duration defaults to one hour (3600s). The session duration determines how long the Google Cloud access tokens, console (federated), and gcloud CLI sign-in sessions from this workforce pool are valid. After you create the pool, you can update the pool to set a custom session duration. The session duration must be from 15 minutes (900s) to 12 hours (43200s).

Create the Microsoft Entra ID workforce identity pool provider

This section describes how to create a workforce identity pool provider to enable your IdP users to access Google Cloud. You can configure the provider to use either the OIDC or SAML protocol.

Create an OIDC workforce identity pool provider

To create a workforce identity pool provider for your Microsoft Entra ID application integration, using the OIDC protocol, do the following:

  1. To get the issuer URI for your Microsoft Entra ID application, do the following:

    1. Go to the Overview page of your Microsoft Entra ID application registration.
    2. Click Endpoints.
    3. Find the OpenID Connect metadata document endpoint. The issuer URI is the OpenID Connect metadata document URI, omitting the trailing /.well-known/openid-configuration.

      For example, if the OpenID Connect metadata document URI is https://login.microsoftonline.com/d41ad248-019e-49e5-b3de-4bdfe1fapple/v2.0/.well-known/openid-configuration, the issuer URI is https://login.microsoftonline.com/d41ad248-019e-49e5-b3de-4bdfe1fapple/v2.0/. Alternatively, you can copy the OpenID Connect metadata document URL, open it in a browser tab, and copy the value of issuer from the JSON response.

  2. To get the client ID for your Microsoft Entra ID application, do the following:

    1. Go to the Overview page of your Microsoft Entra ID application registration.
    2. In Application (client) ID, copy the value.
  3. To create an OIDC workforce identity pool provider for web-based sign-in, do the following:

    gcloud

    To create a provider that supports the OIDC protocol, do the following:

    Code flow

    To create an OIDC provider that uses authorization code flow for web-based sign-in, do the following:

    1. In your Microsoft Entra ID application, to get your client secret, do the following:

      1. Go to your Microsoft Entra ID app registration.

      2. In Certificates & secrets, click the Client secrets tab.

      3. To add a client secret, click + New client secret.

      4. In the Add a client secret dialog, enter information, as needed.

      5. To create the client secret, click Add.

      6. In the Client secrets tab, find your new client secret.

      7. In the Value column for your new client secret, click Copy.

    2. To create the provider, run the following command:

      gcloud iam workforce-pools providers create-oidc WORKFORCE_PROVIDER_ID \
          --workforce-pool=WORKFORCE_POOL_ID \
          --display-name="DISPLAY_NAME" \
          --description="DESCRIPTION" \
          --issuer-uri="ISSUER_URI" \
          --client-id="OIDC_CLIENT_ID" \
      --client-secret-value="OIDC_CLIENT_SECRET" \ --web-sso-response-type="code" \ --web-sso-assertion-claims-behavior="merge-user-info-over-id-token-claims" \ --web-sso-additional-scopes="WEB_SSO_ADDITIONAL_SCOPES" \ --attribute-mapping="ATTRIBUTE_MAPPING" \ --attribute-condition="ATTRIBUTE_CONDITION" \ --jwk-json-path="JWK_JSON_PATH" \ --detailed-audit-logging \ --location=global

      Replace the following:

      • WORKFORCE_PROVIDER_ID: A unique workforce identity pool provider ID. The prefix gcp- is reserved and can't be used in a workforce identity pool or workforce identity pool provider ID.
      • WORKFORCE_POOL_ID: The workforce identity pool ID to connect your IdP to.
      • DISPLAY_NAME: An optional user-friendly display name for the provider; for example, idp-eu-employees.
      • DESCRIPTION: An optional workforce provider description; for example, IdP for Partner Example Organization employees.
      • ISSUER_URI: The OIDC issuer URI, in a valid URI format, that starts with https; for example, https://example.com/oidc. Note: For security reasons, ISSUER_URI must use the HTTPS scheme.
      • OIDC_CLIENT_ID: The OIDC client ID that is registered with your OIDC IdP; the ID must match the aud claim of the JWT that is issued by your IdP.
      • OIDC_CLIENT_SECRET: The OIDC client secret.
      • WEB_SSO_ADDITIONAL_SCOPES: Optional additional scopes to send to the OIDC IdP for console (federated) or gcloud CLI browser-based sign-in.
      • ATTRIBUTE_MAPPING: An attribute mapping. For Microsoft Entra ID with OIDC authentication, we recommend the following attribute mappings:

      google.subject=assertion.oid,
      google.groups=assertion.groups,
      google.display_name=assertion.preferred_username
      

      This example maps the IdP attributes assertion.oid, assertion.groups, and assertion.preferred_username to the Google Cloud attributes google.subject, google.groups, and google.display_name, respectively.

    3. ATTRIBUTE_CONDITION: An attribute condition; for example, to limit the ipaddr attribute to a certain IP range you can set the condition assertion.ipaddr.startsWith('98.11.12.') .
    4. JWK_JSON_PATH: An optional path to a locally uploaded OIDC JWKs. If this parameter isn't supplied, Google Cloud instead uses your IdP's /.well-known/openid-configuration path to source the JWKs containing the public keys. For more information about locally uploaded OIDC JWKs, see manage OIDC JWKs.
    5. Workforce Identity Federation detailed audit logging logs information received from your IdP to Logging. Detailed audit logging can help you troubleshoot your workforce identity pool provider configuration. To learn how to troubleshoot attribute mapping errors with detailed audit logging, see General attribute mapping errors. To learn about Logging pricing, see Google Cloud Observability pricing.

      To disable detailed audit logging for a workforce identity pool provider, omit the --detailed-audit-logging flag when you run gcloud iam workforce-pools providers create. To disable detailed audit logging, you can also update the provider.

    6. In the command response, POOL_RESOURCE_NAME is the name of the pool; for example, locations/global/workforcePools/enterprise-example-organization-employees.