1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/cloud_experts_tutorials/cloud-experts-entra-id-idp.adoc

246 lines
10 KiB
Plaintext
Raw Permalink Normal View History

:_mod-docs-content-type: ASSEMBLY
[id="cloud-experts-entra-id-idp"]
= Tutorial: Configuring Microsoft Entra ID (formerly Azure Active Directory) as an identity provider
include::_attributes/attributes-openshift-dedicated.adoc[]
:context: cloud-experts-entra-id-idp
toc::[]
//Mobb content metadata
//Brought into ROSA product docs 2023-09-18
// ---
// date: '2022-09-23'
// title: Configure Azure AD as an OIDC identity provider for ROSA/OSD
// tags: ["Azure", "ROSA", "OSD"]
// authors:
// - Michael McNeill
// - Andrea Bozzoni
// - Steve Mirman
// - Thatcher Hubbard
// ---
2025-08-25 12:27:14 -07:00
You can configure Microsoft Entra ID (formerly Azure Active Directory) as the cluster identity provider in {product-title}.
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 {product-title} cluster to use Entra ID as the identity provider.
. Grant additional permissions to individual groups.
== Prerequisites
* You created a set of security groups and assigned users by following link:https://learn.microsoft.com/en-us/azure/active-directory/fundamentals/how-to-manage-groups[the Microsoft documentation].
== Registering a new application in Entra ID for authentication
To register your application in Entra ID, first create the OAuth callback URL, then register your application.
.Procedure
. Create the cluster's OAuth callback URL by changing the specified variables and running the following command:
+
[NOTE]
====
Remember to save this callback URL; it will be required later in the process.
====
+
[source,terminal]
----
$ domain=$(rosa describe cluster -c <cluster_name> | grep "DNS" | grep -oE '\S+.openshiftapps.com')
2025-01-20 11:53:04 -08:00
echo "OAuth callback URL: https://oauth.${domain}/oauth2callback/AAD"
----
+
The "AAD" directory at the end of the OAuth callback URL must match the OAuth identity provider name that you will set up later in this process.
. Create the Entra ID application by logging in to the Azure portal, and select the link:https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationsListBlade[App registrations blade]. Then, select *New registration* to create a new application.
+
image:azure-portal_app-registrations-blade.png[Azure Portal - App registrations blade]
. 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.
+
image:azure-portal_register-an-application-page.png[Azure Portal - Register an application page]
+
. Select the *Certificates & secrets* sub-blade and select *New client secret*.
+
image:azure-portal_certificates-secrets-page.png[Azure Portal - Certificates and secrets page]
. Complete the requested details and store the generated client secret value. This secret is required later in this process.
+
[IMPORTANT]
====
After initial setup, you cannot see the client secret. If you did not record the client secret, you must generate a new one.
====
+
image:azure-portal_add-a-client-secret-page.png[Azure Portal - Add a Client Secret page]
. Select the *Overview* sub-blade and note the `Application (client) ID` and `Directory (tenant) ID`. You will need these values in a future step.
+
image:azure-portal_copy-client-secret-page.png[Azure Portal - Copy Client Secret page]
== Configuring the application registration in Entra ID to include optional and group claims
So that {product-title} has enough information to create the user's account, you must configure Entra ID to give two optional claims: `email` and `preferred_username`. For more information about optional claims in Entra ID, see link:https://learn.microsoft.com/en-us/azure/active-directory/develop/optional-claims[the Microsoft documentation].
In addition to individual user authentication, {product-title} 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 {product-title}.
=== Configuring optional claims
You can configure the optional claims in Entra ID.
. Click the *Token configuration* sub-blade and select the *Add optional claim* button.
+
image:azure-portal_optional-claims-page.png[Azure Portal - Add Optional Claims Page]
. Select the *ID* radio button.
+
image:azure-portal_add-optional-claims-page.png[Azure Portal - Add Optional Claims - Token Type]
. Select the *email* claim checkbox.
+
image:azure-portal_add-optional-email-claims-page.png[Azure Portal - Add Optional Claims - email]
. Select the `preferred_username` claim checkbox. Then, click *Add* to configure the *email* and *preferred_username* claims your Entra ID application.
+
image:azure-portal_add-optional-preferred_username-claims-page.png[Azure Portal - Add Optional Claims - preferred_username]
. A dialog box appears at the top of the page. Follow the prompt to enable the necessary Microsoft Graph permissions.
+
image:azure-portal_add-optional-claims-graph-permissions-prompt.png[Azure Portal - Add Optional Claims - Graph Permissions Prompt]
=== Configuring group claims (optional)
Configure Entra ID to offer a groups claim.
.Procedure
. From the *Token configuration* sub-blade, click *Add groups claim*.
+
image:azure-portal_optional-group-claims-page.png[Azure Portal - Add Groups Claim Page]
. To configure group claims for your Entra ID application, select *Security groups* and then click the *Add*.
+
[NOTE]
====
In 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 groups that the group claim only includes groups that apply to {product-title}.
====
+
image:azure-portal_edit-group-claims-page.png[Azure Portal - Edit Groups Claim Page]
== Configuring the {product-title} cluster to use Entra ID as the identity provider
You must configure {product-title} to use Entra ID as its identity provider.
2025-08-25 12:27:14 -07:00
Although {product-title} offers the ability to configure identity providers by using {cluster-manager}, use the ROSA CLI to configure the cluster's OAuth provider to use Entra ID as its identity provider. Before configuring the identity provider, set the necessary variables for the identity provider configuration.
.Procedure
. Create the variables by running the following command:
+
[source,terminal]
----
$ CLUSTER_NAME=example-cluster <1>
$ IDP_NAME=AAD <2>
$ APP_ID=yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy <3>
$ CLIENT_SECRET=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx <4>
$ TENANT_ID=zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz <5>
----
+
--
2025-08-25 12:27:14 -07:00
<1> Replace this with the name of your cluster.
<2> Replace this value with the name you used in the OAuth callback URL that you generated earlier in this process.
<3> Replace this with the Application (client) ID.
<4> Replace this with the Client Secret.
<5> 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 groups` argument.
** If you enabled group claims, run the following command:
+
[source,terminal]
----
$ rosa create idp \
--cluster ${CLUSTER_NAME} \
--type openid \
--name ${IDP_NAME} \
2023-10-16 11:15:42 -04:00
--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 groups
----
** If you did not enable group claims, run the following command:
+
[source,terminal]
----
$ rosa create idp \
--cluster ${CLUSTER_NAME} \
--type openid \
--name ${IDP_NAME} \
2023-10-16 11:15:42 -04:00
--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
----
After a few minutes, the cluster authentication Operator reconciles your changes, and you can log in to the cluster by using Entra ID.
== Granting additional permissions to individual users and groups
When your first log in, you might notice that you have very limited permissions. By default, {product-title} 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.
=== Granting additional permissions to individual users
{product-title} includes a significant number of preconfigured roles, including the `cluster-admin` role that grants full access and control over the cluster.
.Procedure
* Grant a user access to the `cluster-admin` role by running the following command:
+
[source,terminal]
----
$ rosa grant user cluster-admin \
--user=<USERNAME> <1>
--cluster=${CLUSTER_NAME}
----
+
--
<1> Provide the Entra ID username that you want to have cluster admin permissions.
--
=== Granting additional permissions to individual groups
If you opted to enable group claims, the cluster OAuth provider automatically creates or updates the user's group memberships by using the group ID. The cluster OAuth provider does not automatically create `RoleBindings` and `ClusterRoleBindings` for the groups that are created; you are responsible for creating those bindings by using your own processes.
To grant an automatically generated group access to the `cluster-admin` role, you must create a `ClusterRoleBinding` to the group ID.
.Procedure
* Create the `ClusterRoleBinding` by running the following command:
+
[source,terminal]
----
$ oc create clusterrolebinding cluster-admin-group \
--clusterrole=cluster-admin \
--group=<GROUP_ID> <1>
----
+
--
<1> Provide the Entra ID group ID that you want to have cluster admin permissions.
--
+
Now, any user in the specified group automatically receives `cluster-admin` access.
[role="_additional-resources"]
== Additional resources
For more information about how to use RBAC to define and apply permissions in {product-title}, see link:https://docs.openshift.com/container-platform/latest/authentication/using-rbac.html[the {product-title} documentation].