1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00

OSDOCS-8728: Reviewed the Entra ID as Identity Provider tutorial.

This commit is contained in:
Eric Ponvelle
2023-11-15 16:45:56 -05:00
parent f7abbce846
commit 494333cdb5
8 changed files with 118 additions and 56 deletions

View File

@@ -9,102 +9,143 @@ toc::[]
//Mobb content metadata
//Brought into ROSA product docs 2023-09-18
// ---
// date: '2022-09-19'
// title: Configure ROSA to use Entra ID Group Claims
// date: '2022-09-23'
// title: Configure Azure AD as an OIDC identity provider for ROSA/OSD
// tags: ["Azure", "ROSA", "OSD"]
// authors:
// - Michael McNeill
// - Paul Czarkowski
// - Andrea Bozzoni
// - Steve Mirman
// - Thatcher Hubbard
// ---
This tutorial demonstrates how to configure Microsoft Entra ID (formerly Azure Active Directory) as the cluster identity provider in {product-title} (ROSA). This tutorial walks through the creation of an Microsoft Entra ID (Entra ID) application and configure Red Hat OpenShift Service on AWS (ROSA) to authenticate using Azure AD.
You can configure Microsoft Entra ID (formerly Azure Active Directory) as the cluster identity provider in {product-title} (ROSA).
This tutorial walks through the following steps:
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 OpenShift cluster to use Entra ID as the identity provider.
. Configure the {product-title} cluster to use Entra ID as the identity provider.
. Grant additional permissions to individual groups.
[id="cloud-experts-entra-id-idp-prerequisites"]
== Prerequisites
Create a set of security groups and assign users by following link:https://learn.microsoft.com/en-us/azure/active-directory/fundamentals/how-to-manage-groups[the Microsoft documentation].
* 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].
[id="cloud-experts-entra-id-idp-register-application"]
== Register a new application in Entra ID for authentication
== Registering a new application in Entra ID for authentication
. Capture the OAuth callback URL
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:
+
First, construct the cluster's OAuth callback URL and make note of it. To do so, run the following command, making sure to replace the variable specified:
+
The "AAD" directory at the end of the OAuth callback URL should match the OAuth identity provider name you'll setup later.
[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')
$ echo "OAuth callback URL: https://oauth-openshift.apps.$domain/oauth2callback/AAD"
----
. Register a new application in Entra ID
+
You need to create the Entra ID application itself. To do so, log in to the Azure portal, and navigate to link:https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationsListBlade[App registrations blade], and click on "New registration" to create a new application.
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]
+
Provide a name for the application, for example `openshift-auth`. Select "Web" from the Redirect URI dropdown and fill in the Redirect URI using the value of the OAuth callback URL you retrieved in the previous step. Once you fill in the necessary information, click "Register" to create the 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.
+
image:azure-portal_register-an-application-page.png[Azure Portal - Register an application page]
+
Then, click on the "Certificates & secrets" sub-blade and select "New client secret". Fill in the details request and make note of the generated client secret value, as you'll use it in a later step. You won't be able to retrieve it again.
. 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_certificates-secrets-page.png[Azure Portal - Certificates & secrets page]
image:azure-portal_add-a-client-secret-page.png[Azure Portal - Add a Client Secret page]
image:azure-portal_copy-client-secret-page.png[Azure Portal - Copy 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.
+
Then, click on the "Overview" sub-blade and make note of the "Application (client) ID" and "Directory (tenant) ID". You'll need those values in a later step as well.
image:azure-portal_copy-client-secret-page.png[Azure Portal - Copy Client Secret page]
[id="rosa-mobb-entra-id-configure-claims"]
== 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}.
[discrete]
[id="rosa-mobb-entra-id-configure-optional-claims"]
== Configure optional claims
=== Configuring optional claims
To provide OpenShift with enough information about the user to create their account, we will configure Entra ID to provide two optional claims, specifically "email" and "preferred_username". For more information on optional claims in Entra ID, see link:https://learn.microsoft.com/en-us/azure/active-directory/develop/optional-claims[the Microsoft documentation].
Click on the "Token configuration" sub-blade and select the "Add optional claim" button.
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 ID then check the "email" and "preferred_username" claims and click the "Add" button to configure them for your Entra ID application.
. 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]
When prompted, follow the prompt to enable the necessary Microsoft Graph permissions.
. 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]
[discrete]
[id="rosa-mobb-entra-id-configure-group-claims"]
== Configure group claims (optional)
=== Configuring group claims (optional)
In addition to individual user authentication, OpenShift provides group claim functionality. This functionality allows an OpenID Connect identity provider, like Entra ID, to offer a users group membership for use within OpenShift. To enable group claims, we will configure Entra ID to provide a groups claim.
Next, select the "Add groups claim" button.
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]
Select the "Security groups" option and click the "Add" button to configure group claims for your Entra ID application.
. To configure group claims for your Entra ID application, select *Security groups* and then click the *Add*.
+
[NOTE]
====
In this example, we are providing all security groups a user is a member of via the group claim. In a real production environment, we highly recommend scoping the groups provided by the group claim to _only those groups which are applicable to OpenShift_.
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]
[id="cloud-experts-entra-id-idp-configure-cluster"]
== Configure the OpenShift cluster to use Entra ID as the identity provider
== Configuring the {product-title} cluster to use Entra ID as the identity provider
Finally, we need to configure OpenShift to use Entra ID as its identity provider. While Red Hat OpenShift Service on AWS (ROSA) offers the ability to configure identity providers via the OpenShift Cluster Manager (OCM), we will use the configure the cluster's OAuth provider to use Entra ID as its identity provider via the `rosa` CLI. Before we can do so, we need to set some variables that we will use for our IDP configuration by running the following command:
You must configure {product-title} to use Entra ID as its identity provider.
Although ROSA 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>
@@ -113,16 +154,18 @@ $ APP_ID=yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy <3>
$ CLIENT_SECRET=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx <4>
$ TENANT_ID=zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz <5>
----
+
--
<1> Replace this with the name of your ROSA cluster.
<2> Replace this with the name you used in the OAuth callback URL.
<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.
--
Next, run the following command to configure the cluster's OAuth provider if you opted to enable group claims:
. 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 \
@@ -139,8 +182,8 @@ $ rosa create idp \
--groups-claims groups
----
Otherwise, run the following command to configure the cluster's OAuth provider if you opted to not enable group claims:
** If you did not enable group claims, run the following command:
+
[source,terminal]
----
$ rosa create idp \
@@ -156,42 +199,61 @@ $ rosa create idp \
--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.
[id="rosa-mobb-azure-oidc-grant-permissions"]
== Grant additional permissions to individual users
== Granting additional permissions to individual users and groups
Once the cluster authentication Operator reconciles your changes (generally within a few minutes), you will be able to log in to the cluster using Entra ID.
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.
Once you log in, you will notice that you have very limited permissions. This is because, by default, OpenShift only grants you the ability to create new projects (namespaces) in the cluster. Other projects (namespaces) are restricted from view.
You must grant these additional abilities to individual users and groups.
OpenShift includes a significant number of preconfigured roles, including the `cluster-admin` role that grants full access and control over the cluster. To grant your user access to the `cluster-admin` role, run the following command:
[discrete]
[id="rosa-mobb-azure-oidc-grant-permissions-users"]
=== 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 your Entra ID username that you would like to have cluster admin permissions.
<1> Provide the Entra ID username that you want to have cluster admin permissions.
--
[id="cloud-experts-entra-id-idp-additional-permissions"]
== Grant additional permissions to individual groups
[discrete]
[id="cloud-experts-entra-id-idp-additional-permissions-groups"]
=== Granting additional permissions to individual groups
If you opted to enable group claims, the cluster OAuth provider will automatically create or update the membership of groups the user is a member of (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 via your own processes.
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.
OpenShift includes a significant number of preconfigured roles, including the `cluster-admin` role that grants full access and control over the cluster. To grant an automatically generated group access to the `cluster-admin` role, you must create a ClusterRoleBinding to the group ID.
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 your Entra ID group ID that you would like to have cluster admin permissions.
<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.
Now, any user in the specified group will automatically be granted `cluster-admin` access.
[id="cloud-experts-entra-id-idp-additional-resources"]
[role="_additional-resources"]
== Additional resources
For more information on how to use RBAC to define and apply permissions in OpenShift, see link:https://docs.openshift.com/container-platform/latest/authentication/using-rbac.html[the OpenShift documentation].
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].

Binary file not shown.

Before

Width:  |  Height:  |  Size: 306 KiB

After

Width:  |  Height:  |  Size: 305 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 406 KiB

After

Width:  |  Height:  |  Size: 408 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 454 KiB

After

Width:  |  Height:  |  Size: 453 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 376 KiB

After

Width:  |  Height:  |  Size: 376 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 314 KiB

After

Width:  |  Height:  |  Size: 314 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 579 KiB

After

Width:  |  Height:  |  Size: 582 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 267 KiB

After

Width:  |  Height:  |  Size: 266 KiB