You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. combined bash and azcli commands for the KeyVault operations
2. used easy to read variable assignements
3. fix spelling for resource group name
4. added variables for the service account and sa namespace
5. removed the need to replace the above mentioned variables in
several places by setting them once and exporting
Copy file name to clipboardExpand all lines: articles/aks/workload-identity-deploy-cluster.md
+18-25Lines changed: 18 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -96,35 +96,25 @@ You can retrieve this information using the Azure CLI command: [az keyvault list
96
96
97
97
1. Use the Azure CLI [az account set][az-account-set] command to set a specific subscription to be the current active subscription. Then use the [az identity create][az-identity-create] command to create a managed identity.
98
98
99
-
```bash
99
+
```azurecli
100
100
export SUBSCRIPTION_ID="$(az account show --query id --output tsv)"
101
-
```
101
+
export USER_ASSIGNED_IDENTITY_NAME="myIdentity"
102
+
export RG_NAME="myResourceGroup"
103
+
export LOCATION="eastus"
102
104
103
-
```azurecli
104
105
az account set --subscription "${SUBSCRIPTION_ID}"
az keyvault set-policy --name "${KEYVAULT_NAME}" --secret-permissions get --spn "${USER_ASSIGNED_CLIENT_ID}"
129
119
```
130
120
@@ -133,22 +123,25 @@ You can retrieve this information using the Azure CLI command: [az keyvault list
133
123
Create a Kubernetes service account and annotate it with the client ID of the managed identity created in the previous step. Use the [az aks get-credentials][az-aks-get-credentials] command and replace the values for the cluster name and the resource group name.
134
124
135
125
```azurecli
136
-
az aks get-credentials -n myAKSCluster -g MyResourceGroup
126
+
az aks get-credentials -n myAKSCluster -g myResourceGroup
137
127
```
138
128
139
-
Copy and paste the following multi-line input in the Azure CLI, and update the values for`serviceAccountName` and `serviceAccountNamespace` with the Kubernetes service account name and its namespace.
129
+
Copy and paste the following multi-line input in the Azure CLI, and update the values for `SERVICE_ACCOUNT_NAME` and `SERVICE_ACCOUNT_NAMESPACE` with the Kubernetes service account name and its namespace.
@@ -160,10 +153,10 @@ Serviceaccount/workload-identity-sa created
160
153
161
154
## Establish federated identity credential
162
155
163
-
Use the [az identity federated-credential create][az-identity-federated-credential-create] command to create the federated identity credential between the managed identity, the service account issuer, and the subject. Replace the values `resourceGroupName`, `userAssignedIdentityName`, `federatedIdentityName`, `serviceAccountNamespace`, and `serviceAccountName`.
156
+
Use the [az identity federated-credential create][az-identity-federated-credential-create] command to create the federated identity credential between the managed identity, the service account issuer, and the subject.
0 commit comments