Enable authentication with Microsoft Azure

Configure Microsoft Azure as your Red Hat Developer Hub sign-in provider.

Before you begin

Procedure

  1. Enable the Microsoft authentication provider plugin in your dynamic-plugins.yaml file:
    plugins:
      - package: oci://quay.io/rhdh/backstage-plugin-auth-backend-module-microsoft-provider:{{inherit}}
        enabled: true
  2. Add the Microsoft authentication provider to your app-config.yaml file:
    auth:
      environment: production
      providers:
        microsoft:
          production:
            clientId: ${MICROSOFT_CLIENT_ID}
            clientSecret: ${MICROSOFT_CLIENT_SECRET}
            tenantId: ${MICROSOFT_TENANT_ID}
    signInPage: microsoft
    environment
    Enter production to disable the Guest login option in the Developer Hub login page.
    clientId
    Enter the configured secret variable name: ${MICROSOFT_CLIENT_ID}.
    clientSecret
    Enter the configured secret variable name: ${MICROSOFT_CLIENT_SECRET}.
    tenantId
    Enter the configured secret variable name: ${MICROSOFT_TENANT_ID}.
    signInPage
    Enter microsoft to set the Azure provider as your Developer Hub sign-in provider.
  3. Optional: Add optional fields to the Microsoft authentication provider section in your app-config.yaml file:
    auth:
      environment: production
      providers:
        microsoft:
          production:
            clientId: ${MICROSOFT_CLIENT_ID}
            clientSecret: ${MICROSOFT_CLIENT_SECRET}
            tenantId: ${MICROSOFT_TENANT_ID}
            domainHint: ${MICROSOFT_TENANT_ID}
            additionalScopes:
               - Mail.Send
            sessionDuration:
              hours: 24
            signIn:
              resolvers:
                - resolver: userIdMatchingUserEntityAnnotation
                  dangerouslyAllowSignInWithoutUserInCatalog: true
    signInPage: microsoft
    domainHint

    Leave this parameter empty, or enter the tenant ID when your application registration is single-tenant.

    Leave this parameter empty when your application registration is multitenant.

    Enter the tenant ID to reduce login friction for users with accounts in multiple tenants, by automatically filtering out accounts from other tenants. For more information, see Home Realm Discovery.

    additionalScopes
    Enter the list of additional scopes to add scopes for the application registration. The default and mandatory value lists following scopes: openid, offline_access, profile, email, User.Read.
    sessionDuration
    Lifespan of the user session. Enter a duration in ms library (such as '24h', '2 days'), ISO duration, or "human duration" format.
    signIn.resolvers

    After successful authentication, Developer Hub resolves the user signing in to an existing user in the Developer Hub catalog. To best match users securely for your use case, consider configuring a specific resolver.

    Enter the resolver list to override the default resolver: userIdMatchingUserEntityAnnotation.

    The authentication provider tries each sign-in resolver in order until it succeeds, and fails if none succeed.

    Warning

    In production mode, configure only one resolver to make sure users are securely matched.

    resolver

    Enter the sign-in resolver name. Available resolvers:

    userIdMatchingUserEntityAnnotation
    Use this resolver to look up the user by matching their immutable Microsoft user ID to the user entity annotation. This is the default resolver.
    emailMatchingUserEntityAnnotation
    Use this resolver to look up the user by matching their Microsoft email to the email entity annotation.
    emailLocalPartMatchingUserEntityName
    Use this resolver to look up the user by matching their Microsoft email user name to the user entity name.
    emailMatchingUserEntityProfileEmail
    Use this resolver to look up the user by matching their Microsoft email to the user entity profile email.
    dangerouslyAllowSignInWithoutUserInCatalog

    Enter true to configure the sign-in resolver to bypass the user provisioning requirement in the Developer Hub software catalog.

    Warning

    In production mode, do not enable dangerouslyAllowSignInWithoutUserInCatalog.

  4. To disable the guest login option, in the app-config.yaml file, set the authentication environment to production:
    auth:
      environment: production

Results

  1. Go to the Developer Hub login page.
  2. Your Developer Hub sign-in page displays Sign in using Microsoft and the Guest user sign-in is disabled.
  3. Log in with an Azure account.