@@ -47,27 +47,29 @@ A conceptual overview of this feature is available in the [Azure RBAC on Azure A
47
47
1. Create a new Azure AD application and get its `appId` value. This value is used in later steps as `serverApplicationId`.
48
48
49
49
```azurecli
50
- az ad app create --display-name "<clusterName>Server" --identifier-uris "https://<clusterName>Server" --query appId -o tsv
50
+ CLUSTERNAME="<clusterName>"
51
+ SERVER_APP_ID=$(az ad app create --display-name "${CLUSTERNAME}Server" --identifier-uris "https://${CLUSTERNAME}Server" --query appId -o tsv)
52
+ echo $SERVER_APP_ID
51
53
```
52
54
53
55
1. Update the application's group membership claims:
54
56
55
57
```azurecli
56
- az ad app update --id <serverApplicationId> --set groupMembershipClaims=All
58
+ az ad app update --id "${SERVER_APP_ID}" --set groupMembershipClaims=All
57
59
```
58
60
59
61
1. Create a service principal and get its `password` field value. This value is required later as `serverApplicationSecret` when you're enabling this feature on the cluster.
60
62
61
63
```azurecli
62
- az ad sp create --id <serverApplicationId>
63
- az ad sp credential reset --name <serverApplicationId> --credential-description "ArcSecret" --query password -o tsv
64
+ az ad sp create --id "${SERVER_APP_ID}"
65
+ SERVER_APP_SECRET=$( az ad sp credential reset --name "${SERVER_APP_ID}" --credential-description "ArcSecret" --query password -o tsv)
64
66
```
65
67
66
- 1. Grant API permissions to the application:
68
+ 1. Grant "Sign in and read user profile" API permissions to the application:
67
69
68
70
```azurecli
69
- az ad app permission add --id <serverApplicationId> --api 00000003-0000-0000-c000-000000000000 --api-permissions e1fe6dd8-ba31-4d61-89e7-88639da4683d=Scope
70
- az ad app permission grant --id <serverApplicationId> --api 00000003-0000-0000-c000-000000000000
71
+ az ad app permission add --id "${SERVER_APP_ID}" --api 00000003-0000-0000-c000-000000000000 --api-permissions e1fe6dd8-ba31-4d61-89e7-88639da4683d=Scope
72
+ az ad app permission grant --id "${SERVER_APP_ID}" --api 00000003-0000-0000-c000-000000000000
71
73
```
72
74
73
75
> [!NOTE]
@@ -80,26 +82,27 @@ A conceptual overview of this feature is available in the [Azure RBAC on Azure A
80
82
1. Create a new Azure AD application and get its `appId` value. This value is used in later steps as `clientApplicationId`.
81
83
82
84
```azurecli
83
- az ad app create --display-name "<clusterName>Client" --native-app --reply-urls "https://<clusterName>Client" --query appId -o tsv
85
+ CLIENT_APP_ID=$(az ad app create --display-name "${CLUSTERNAME}Client" --native-app --reply-urls "https://${CLUSTERNAME}Client" --query appId -o tsv)
86
+ echo $CLIENT_APP_ID
84
87
```
85
88
86
89
2. Create a service principal for this client application:
87
90
88
91
```azurecli
89
- az ad sp create --id <clientApplicationId>
92
+ az ad sp create --id "${CLIENT_APP_ID}"
90
93
```
91
94
92
95
3. Get the `oAuthPermissionId` value for the server application:
93
96
94
97
```azurecli
95
- az ad app show --id <serverApplicationId> --query "oauth2Permissions[0].id" -o tsv
98
+ az ad app show --id "${SERVER_APP_ID}" --query "oauth2Permissions[0].id" -o tsv
96
99
```
97
100
98
101
4. Grant the required permissions for the client application:
99
102
100
103
```azurecli
101
- az ad app permission add --id <clientApplicationId> --api <serverApplicationId> --api-permissions <oAuthPermissionId>=Scope
102
- az ad app permission grant --id <clientApplicationId> --api <serverApplicationId>
104
+ az ad app permission add --id "${CLIENT_APP_ID}" --api "${SERVER_APP_ID}" --api-permissions <oAuthPermissionId>=Scope
105
+ az ad app permission grant --id "${CLIENT_APP_ID}" --api "${SERVER_APP_ID}"
103
106
```
104
107
105
108
## Create a role assignment for the server application
@@ -128,23 +131,21 @@ The server application needs the `Microsoft.Authorization/*/read` permissions to
128
131
2. Run the following command to create the new custom role:
129
132
130
133
```azurecli
131
- az role definition create --role-definition ./accessCheck.json
134
+ ROLE_ID=$( az role definition create --role-definition ./accessCheck.json --query id -o tsv)
132
135
```
133
136
134
- 3. From the output of the preceding command, store the value of the `id` field. This field is used in later steps as `roleId`.
135
-
136
- 4. Create a role assignment on the server application as `assignee` by using the role that you created:
137
+ 3. Create a role assignment on the server application as `assignee` by using the role that you created:
137
138
138
139
```azurecli
139
- az role assignment create --role <roleId> --assignee <serverApplicationId> --scope /subscriptions/<subscription-id>
140
+ az role assignment create --role "${ROLE_ID}" --assignee "${SERVER_APP_ID}" --scope /subscriptions/<subscription-id>
140
141
```
141
142
142
143
## Enable Azure RBAC on the cluster
143
144
144
145
Enable Azure role-based access control (RBAC) on your Arc enabled Kubernetes cluster by running the following command:
145
146
146
147
```console
147
- az connectedk8s enable-features -n <clusterName> -g <resourceGroupName> --features azure-rbac --app-id <serverApplicationId> --app-secret <serverApplicationSecret>
148
+ az connectedk8s enable-features -n <clusterName> -g <resourceGroupName> --features azure-rbac --app-id "${SERVER_APP_ID}" --app-secret "${SERVER_APP_SECRET}"
148
149
```
149
150
150
151
> [ !NOTE]
0 commit comments