Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
In this article, you use Azure portal to set up Microsoft Entra authentication for an Azure Red Hat OpenShift cluster. You create variables that are used in commands that create an OAuth
callback URL, create an application registration and client secret, and sign in to the cluster's web console using the Microsoft Entra authentication.
Prerequisites
- An existing Azure Red Hat OpenShift cluster. If you don't have a cluster, see create a new cluster.
- Azure CLI 2.30.0 or later installed on your computer. Use
az --version
to find the installed version of Azure CLI. If you need to install or upgrade, see Install Azure CLI. You can also use Azure Cloud Shell with Bash to run commands.
Create variables
Set the variables for resource group and cluster name. Replace <resourceGroupName>
with your resource group's name and <aroClusterName>
with your cluster's name.
resourceGroup=<resourceGroupName>
aroCluster=<aroClusterName>
Create the cluster's OAuth
callback URL and make note of it because you use it later. The entraID
section in the OAuth
callback URL must match the OAuth
identity provider name you set up later.
domain=$(az aro show --resource-group $resourceGroup --name $aroCluster --query clusterProfile.domain --output tsv)
location=$(az aro show --resource-group $resourceGroup --name $aroCluster --query location --output tsv)
echo "OAuth callback URL: https://oauth-openshift.apps.$domain.$location.aroapp.io/oauth2callback/entraID"
Create a Microsoft Entra application for authentication
Sign in to the Azure portal.
Use the search field to find Microsoft Entra ID and select it from the list.
Select App registrations > New registration.
Complete the Register an application form.
- Name: Enter an application name, for this example aro-entraid-auth.
- Supported account types: Select Accounts in this organizational directory only.
- Redirect URI: Select
Web
and enter yourOAuth
callback URL.
Select Register.
After the application is created, you're taken to its App registration page that displays aro-entraid-auth.
Select Certificates & secrets and select New client secret.
- Description: Enter a description for the client secret like aro-client-secret.
- Expires: Accept the default 180 days or select a different expiration value.
Select Add.
Copy the Value and store it in a safe location. You need it later and can't retrieve the value again.
Select Overview and copy the Application (client) ID and Directory (tenant) ID because you use it later.
Configure optional claims
Application developers can use optional claims in their Microsoft Entra applications to specify which claims they want in tokens sent to their application.
You can use optional claims to:
- Select other claims to include in tokens for your application.
- Change the behavior of certain claims that Microsoft Entra ID returns in tokens.
- Add and access custom claims for your application.
You can configure OpenShift to use the email
claim and fall back to upn
to set the Preferred Username by adding the upn
as part of the ID token returned by Microsoft Entra ID.
Go to Token configuration and select Add optional claim. Select ID then check the email and upn claims.
Assign users and groups to the cluster (optional)
Applications registered in a Microsoft Entra tenant are, by default, available to all users of the tenant who authenticate successfully. Microsoft Entra ID allows tenant administrators and developers to restrict an app to a specific set of users or security groups in the tenant.
For more information, see assign users and groups to the app.
Configure OpenShift OpenID authentication
Retrieve the kubeadmin
credentials. Run the following command to find the password for the kubeadmin
user.
az aro list-credentials \
--name $aroCluster \
--resource-group $resourceGroup
The output displays the cluster's user name and password.
{
"kubeadminPassword": "<generated password>",
"kubeadminUsername": "kubeadmin"
}
You can find the cluster console URL by running the following command.
az aro show \
--name $aroCluster \
--resource-group $resourceGroup \
--query "consoleProfile.url" --output tsv
The output looks like the following example.
https://console-openshift-console.apps.<domain>.<region>.aroapp.io/
Launch the console URL in a browser and sign in using the
kubeadmin
credentials.Go to Administration > Cluster Settings and select the Configuration tab.
Scroll down and select OAuth.
Scroll down to Identity Providers > Add and select OpenID Connect.
- Name: Enter
entraID
. - Client ID: Enter your app registrations Application (client) ID.
- Client secret: Enter your app's client secret.
- Issuer URL: Enter
https://login.microsoftonline.com/<tenantId>
and replace<tenantId>
with your tenant ID.
- Name: Enter
Scroll down to the Claims section and update the Preferred Username to use the value upn.
Select Add.
Verify sign in using Microsoft Entra ID
Sign out of the OpenShift Web Console and sign in again, and you see a new option to sign in with entraID. You might need to wait for a few minutes for the option to become available.
If you get the error AADSTS50011: The redirect URI https://oauth-openshift.apps.<domain>.<regions>.aroapp.io/oauth2callback/<identity> specified in the request doesn't match the redirect URIs configured
, you can follow the troubleshooting guide for the redirect URI and Error AADSTS50011 with OpenID authentication.