Skip to content

Commit 06ac46d

Browse files
authored
Merge pull request #198316 from leebeasley-v/openshift-service-principal-may-13-a
updates for openshift service principal-may-13-a
2 parents d024bc1 + 5e2684d commit 06ac46d

File tree

4 files changed

+36
-56
lines changed

4 files changed

+36
-56
lines changed

articles/openshift/howto-create-service-principal.md

Lines changed: 36 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -18,55 +18,34 @@ To interact with Azure APIs, an Azure Red Hat OpenShift cluster requires an Azur
1818

1919
This article explains how to create and use a service principal for your Azure Red Hat OpenShift clusters using the Azure command-line interface (Azure CLI) or the Azure portal.
2020

21-
## Before you begin
22-
23-
The user creating an Azure AD service principal must have permissions to register an application with your Azure AD tenant and to assign the application to a role in your subscription. You need **User Access Administrator** and **Contributor** permissions at the resource-group level to create service principals.
24-
25-
Use the following Azure CLI command to add these permissions.
26-
27-
```azurecli-interactive
28-
az role assignment create \
29-
--role 'User Access Administrator' \
30-
--assignee-object-id $SP_OBJECT_ID \
31-
--resource-group $RESOURCEGROUP \
32-
--assignee-principal-type 'ServicePrincipal'
33-
34-
az role assignment create \
35-
--role 'Contributor' \
36-
--assignee-object-id $SP_OBJECT_ID \
37-
--resource-group $RESOURCEGROUP \
38-
--assignee-principal-type 'ServicePrincipal'
39-
```
40-
41-
If you don't have the required permissions, you can ask your Azure AD or subscription administrator to assign them. Alternatively, your Azure AD or subscription administrator can create a service principal in advance for you to use with the Azure Red Hat OpenShift cluster.
42-
43-
If you're using a service principal from a different Azure AD tenant, there are more considerations regarding the permissions available when you deploy the cluster. For example, you may not have the appropriate permissions to read and write directory information.
44-
45-
For more information on user roles and permissions, see [What are the default user permissions in Azure Active Directory?](../active-directory/fundamentals/users-default-permissions.md).
46-
4721
> [!NOTE]
4822
> Service principals expire in one year unless configured for longer periods. For information on extending your service principal expiration period, see [Rotate service principal credentials for your Azure Red Hat OpenShift (ARO) Cluster](howto-service-principal-credential-rotation.md).
4923
5024
::: zone pivot="aro-azurecli"
5125

5226
## Create a service principal with Azure CLI
5327

54-
The following sections explain how to use the Azure CLI to create a service principal for your Azure Red Hat OpenShift cluster.
28+
The following sections explain how to use the Azure CLI to create a service principal for your Azure Red Hat OpenShift cluster
5529

5630
## Prerequisite
5731

5832
If you’re using the Azure CLI, you’ll need Azure CLI version 2.0.59 or later installed and configured. Run `az --version` to find the version. If you need to install or upgrade, see [Install Azure CLI](/cli/azure/install-azure-cli).
5933

34+
## Create a resource group
6035

61-
## Create a service principal - Azure CLI
36+
```azurecli-interactive
37+
AZ_RG=$(az group create -n test-aro-rg -l eastus2 --query name -o tsv)
38+
```
6239

63-
To create a service principal with the Azure CLI, run the `az ad sp create-for-rbac` command.
40+
## Create a service principal - Azure CLI
6441

65-
> [!NOTE]
66-
> When using a service principal to create a new cluster, you may need to assign a Contributor role here.
42+
To create a service principal with the Azure CLI, run the following command.
6743

68-
```azure-cli
69-
az ad sp create-for-rbac --name myAROClusterServicePrincipal
44+
```azurecli-interactive
45+
# Get Azure subscription ID
46+
AZ_SUB_ID=$(az account show --query id -o tsv)
47+
# Create a service principal with contributor role and scoped to the ARO resource group
48+
az ad sp create-for-rbac -n "test-aro-SP" --role contributor --scopes "/subscriptions/${AZ_SUB_ID}/resourceGroups/${AZ_RG}"
7049
```
7150

7251
The output is similar to the following example.
@@ -80,26 +59,21 @@ The output is similar to the following example.
8059
8160
"name": "http://myAROClusterServicePrincipal",
8261
83-
"password": "",
62+
"password": "yourpassword",
8463
85-
"tenant": ""
64+
"tenant": "yourtenantname" t
8665
8766
}
8867
```
8968

9069
Retain your `appId` and `password`. These values are used when you create an Azure Red Hat OpenShift cluster below.
70+
71+
> [!NOTE]
72+
> This service principal only allows a contributor over the resource group the ARO cluster is located in. If your VNet is in another resource group, you need to assign the service principal contributor role to that resource group as well.
9173
92-
## Grant permissions to the service principal - Azure CLI
93-
94-
Grant permissions to an existing service principal with Azure CLI, as shown in the following command.
74+
For more information, see [Manage service principal roles](/cli/azure/create-an-azure-service-principal-azure-cli#3-manage-service-principal-roles).
9575

96-
```azurecli-interactive
97-
az role assignment create \
98-
--role 'Contributor' \
99-
--assignee-object-id $SP_OBJECT_ID \
100-
--resource-group $RESOURCEGROUP \
101-
--assignee-principal-type 'ServicePrincipal'
102-
```
76+
To grant permissions to an existing service principal with the Azure portal, see [Create an Azure AD app and service principal in the portal](../active-directory/develop/howto-create-service-principal-portal.md#configure-access-policies-on-resources).
10377

10478
## Use the service principal to create a cluster - Azure CLI
10579

@@ -128,21 +102,17 @@ az aro create \
128102

129103
The following sections explain how to use the Azure portal to create a service principal for your Azure Red Hat OpenShift cluster.
130104

131-
## Create a service principal - Azure portal
105+
## Create a service principal - Azure portal
132106

133-
To create a service principal using the Azure portal, see [Create an Azure AD app and service principal in the portal](../active-directory/develop/howto-create-service-principal-portal.md).
134-
135-
## Grant permissions to the service principal - Azure portal
136-
137-
To grant permissions to an existing service principal with the Azure portal, see [Create an Azure AD app and service principal in the portal](../active-directory/develop/howto-create-service-principal-portal.md#configure-access-policies-on-resources).
107+
To create a service principal using the Azure portal, complete the following steps.
138108

139-
## Use the service principal - Azure portal
109+
1. On the Create Azure Red Hat OpenShift **Basics** tab, create a resource group for your subscription, as shown in the following example.
140110

141-
When deploying an Azure Red Hat OpenShift cluster using the Azure portal, configure the service principal on the **Authentication** page of the **Azure Red Hat OpenShift** dialog.
111+
:::image type="content" source="./media/basics-openshift-sp.png" alt-text="Screenshot that shows how to use the Azure Red Hat service principal with Azure portal to create a cluster." lightbox="./media/basics-openshift-sp.png":::
142112

143-
:::image type="content" source="./media/openshift-service-principal-portal.png" alt-text="Screenshot that shows how to use the Azure Red Hat service principal with Azure portal to create a cluster." lightbox="./media/openshift-service-principal-portal.png":::
113+
2. Click **Next: Authentication** to configure and deploy the service principal on the **Authentication** page of the **Azure Red Hat OpenShift** dialog.
144114

145-
Specify the following values, and then select **Review + Create**.
115+
:::image type="content" source="./media/openshift-service-principal-portal.png" alt-text="Screenshot that shows how to use the Authentication tab with Azure portal to create a service principal." lightbox="./media/openshift-service-principal-portal.png":::
146116

147117
In the **Service principal information** section:
148118

@@ -151,5 +121,15 @@ In the **Service principal information** section:
151121

152122
In the **Cluster pull secret** section:
153123

154-
- **Pull secret** is your cluster's pull secret's decrypted value.
124+
- **Pull secret** is your cluster's pull secret's decrypted value. If you don't have a pull secret, leave this field blank.
125+
126+
After completing this tab, select **Next: Networking** to continue creating your cluster. Select **Review + Create** when you complete the remaining tabs.
127+
128+
> [!NOTE]
129+
> This service principal only allows a contributor over the resource group the Azure Red Hat OpenShift cluster is located in. If your VNet is in another resource group, you need to assign the service principal contributor role to that resource group as well.
130+
131+
## Grant permissions to the service principal - Azure portal
132+
133+
To grant permissions to an existing service principal with the Azure portal, see [Create an Azure AD app and service principal in the portal](../active-directory/develop/howto-create-service-principal-portal.md#configure-access-policies-on-resources).
134+
155135
::: zone-end
104 KB
Loading
56.6 KB
Loading
0 Bytes
Loading

0 commit comments

Comments
 (0)