Chapter 9. Tutorial: Configure Microsoft Entra ID as an identity provider
Configure Microsoft Entra ID (formerly Azure Active Directory) as the cluster identity provider to enable user authentication and group-based access control for your Red Hat OpenShift Service on AWS cluster by using OpenID Connect (OIDC).
This tutorial guides you to complete the following tasks:
- Register a new application in Entra ID for authentication.
- Configure the application registration in Entra ID to include optional and group claims in tokens.
- Configure the Red Hat OpenShift Service on AWS cluster to use Entra ID as the identity provider.
- Grant additional permissions to individual groups.
9.1. Register a new application in Entra ID for authentication Copy linkLink copied to clipboard!
Register an application in Entra ID using your cluster OAuth callback URL to generate the credentials for cluster authentication.
Prerequisites
- You have created a set of security groups and assigned users by following the Microsoft documentation.
Procedure
Create the cluster’s OAuth callback URL by changing the specified variables and running the following command:
$ domain=$(rosa describe cluster -c <cluster_name> | grep "DNS" | grep -oE '\S+.openshiftapps.com') echo "OAuth callback URL: https://oauth.${domain}/oauth2callback/AAD"The
AADdirectory at the end of the OAuth callback URL must match the OAuth identity provider name that you will set up later in this process.NoteRemember to save this callback URL; it will be required later in the process.
Create the Entra ID application by logging in to the Azure portal, and select the App registrations blade. Then, select New registration to create a new application.
-
Name the application, for example
openshift-auth. - Select Web from the Redirect URI dropdown and enter the value of the OAuth callback URL you retrieved in the previous step.
After providing the required information, click Register to create the application.
Select the Certificates & secrets sub-blade and select New client secret.
Complete the requested details and store the generated client secret value. This secret is required later in this process.
ImportantAfter initial setup, you cannot see the client secret. If you did not record the client secret, you must generate a new one.
Select the Overview sub-blade and note the
Application (client) IDandDirectory (tenant) ID. You will need these values in a future step.
9.2. Optional and group claims for Entra ID application registration Copy linkLink copied to clipboard!
The email and preferred_username Entra ID optional claims provide Red Hat OpenShift Service on AWS with the information it needs to create user accounts. Group claims enable group-based access control.
In addition to individual user authentication, Red Hat OpenShift Service on AWS provides group claim functionality. This functionality allows an OpenID Connect (OIDC) identity provider, such as Entra ID, to offer a user’s group membership for use within Red Hat OpenShift Service on AWS.
9.2.1. Configure optional claims in Entra ID Copy linkLink copied to clipboard!
Configure the email and preferred_username optional claims in Entra ID so that Red Hat OpenShift Service on AWS can identify users during authentication.
Procedure
Click the Token configuration sub-blade and click Add optional claim.
Select the ID radio button.
Select the email claim checkbox.
Select the
preferred_usernameclaim checkbox. Then, click Add to configure the email and preferred_username claims your Entra ID application.
Follow the prompt in the dialog box to enable the necessary Microsoft Graph permissions.
9.2.2. Configure group claims Copy linkLink copied to clipboard!
Configure group claims in Entra ID to allow Red Hat OpenShift Service on AWS to manage user group memberships and enable group-based role bindings in the cluster.
Configuring group claims is an optional step.
Procedure
From the Token configuration sub-blade, click Add groups claim.
To configure group claims for your Entra ID application, select Security groups and then click Add.
NoteIn this example, the group claim includes all of the security groups that a user is a member of. In a real production environment, ensure that the group claim only includes groups that apply to Red Hat OpenShift Service on AWS.
9.3. Configure Entra ID as the cluster identity provider Copy linkLink copied to clipboard!
Use the ROSA command-line interface (CLI) (rosa) to configure the cluster’s OAuth provider to use Entra ID as its identity provider, enabling users to log in with their Microsoft credentials and optional group-based access control.
Procedure
Create the variables necessary for the identity provider configuration by running the following command:
$ CLUSTER_NAME=example-cluster $ IDP_NAME=AAD $ APP_ID=yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy $ CLIENT_SECRET=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx $ TENANT_ID=zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzzwhere:
example-cluster- Replace this with the name of your cluster.
AAD- Replace this value with the name you used in the OAuth callback URL that you generated earlier in this process.
yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy- Replace this with the Application (client) ID.
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx- Replace this with the Client Secret.
zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz- Replace this with the Directory (tenant) ID.
Configure the cluster’s OAuth provider by running the following command. If you enabled group claims, ensure that you use the
--group-claims groupsargument.If you enabled group claims, run the following command:
$ rosa create idp \ --cluster ${CLUSTER_NAME} \ --type openid \ --name ${IDP_NAME} \ --client-id ${APP_ID} \ --client-secret ${CLIENT_SECRET} \ --issuer-url https://login.microsoftonline.com/${TENANT_ID}/v2.0 \ --email-claims email \ --name-claims name \ --username-claims preferred_username \ --extra-scopes email,profile \ --groups-claims groupsIf you did not enable group claims, run the following command:
$ rosa create idp \ --cluster ${CLUSTER_NAME} \ --type openid \ --name ${IDP_NAME} \ --client-id ${APP_ID} \ --client-secret ${CLIENT_SECRET} \ --issuer-url https://login.microsoftonline.com/${TENANT_ID}/v2.0 \ --email-claims email \ --name-claims name \ --username-claims preferred_username \ --extra-scopes email,profileAfter a few minutes, the cluster authentication Operator reconciles your changes, and you can log in to the cluster by using Entra ID.
9.4. Additional permissions for individual users and groups Copy linkLink copied to clipboard!
When you first log in, you might notice that you have very limited permissions. By default, Red Hat OpenShift Service on AWS only grants you the ability to create new projects, or namespaces, in the cluster. Other projects are restricted from view.
You must grant these additional abilities to individual users and groups.
9.5. Grant additional permissions to individual users Copy linkLink copied to clipboard!
Grant the cluster-admin role to individual Entra ID users so that they have full access and control over the cluster.
Procedure
Grant a user access to the
cluster-adminrole by running the following command:$ rosa grant user cluster-admin --user=<USERNAME> --cluster=${CLUSTER_NAME}where:
<USERNAME>- Provide the Entra ID username that you want to have cluster admin permissions.
9.6. Grant additional permissions to individual groups Copy linkLink copied to clipboard!
When group claims are enabled, the cluster OAuth provider automatically creates or updates group memberships by using the group ID, but does not create RoleBindings or ClusterRoleBindings. You must create those bindings to grant group-based permissions.
To grant an automatically generated group access to the cluster-admin role, you must create a ClusterRoleBinding to the group ID.
Procedure
Create the
ClusterRoleBindingby running the following command:$ oc create clusterrolebinding cluster-admin-group --clusterrole=cluster-admin --group=<GROUP_ID>where:
<GROUP_ID>- Specifies the Entra ID group ID that you want to have cluster admin permissions.
Now, any user in the specified group automatically receives
cluster-adminaccess.