Skip to content

Commit efb879e

Browse files
authored
Merge pull request #107913 from lanicolas/patch-7
Aligning with Bash style guide
2 parents 3995cd2 + 5a03a27 commit efb879e

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

articles/aks/csi-secrets-store-identity-access.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,16 @@ Azure AD workload identity (preview) is supported on both Windows and Linux clus
3838
1. Use the Azure CLI `az account set` command to set a specific subscription to be the current active subscription. Then use the `az identity create` command to create a managed identity.
3939

4040
```azurecli
41-
export subscriptionID=<subscription id>
42-
export resourceGroupName=<resource group name>
41+
export SUBSCRIPTION_ID=<subscription id>
42+
export RESOURCE_GROUP=<resource group name>
4343
export UAMI=<name for user assigned identity>
4444
export KEYVAULT_NAME=<existing keyvault name>
45-
export clusterName=<aks cluster name>
45+
export CLUSTER_NAME=<aks cluster name>
4646
47-
az account set --subscription $subscriptionID
48-
az identity create --name $UAMI --resource-group $resourceGroupName
49-
export USER_ASSIGNED_CLIENT_ID="$(az identity show -g $resourceGroupName --name $UAMI --query 'clientId' -o tsv)"
50-
export IDENTITY_TENANT=$(az aks show --name $clusterName --resource-group $resourceGroupName --query identity.tenantId -o tsv)
47+
az account set --subscription $SUBSCRIPTION_ID
48+
az identity create --name $UAMI --resource-group $RESOURCE_GROUP
49+
export USER_ASSIGNED_CLIENT_ID="$(az identity show -g $RESOURCE_GROUP --name $UAMI --query 'clientId' -o tsv)"
50+
export IDENTITY_TENANT=$(az aks show --name $CLUSTER_NAME --resource-group $RESOURCE_GROUP --query identity.tenantId -o tsv)
5151
```
5252
5353
2. You need to set an access policy that grants the workload identity permission to access the Key Vault secrets, access keys, and certificates. The rights are assigned using the `az keyvault set-policy` command shown below.
@@ -61,7 +61,7 @@ Azure AD workload identity (preview) is supported on both Windows and Linux clus
6161
3. Run the [az aks show][az-aks-show] command to get the AKS cluster OIDC issuer URL.
6262
6363
```bash
64-
export AKS_OIDC_ISSUER="$(az aks show --resource-group $resourceGroupName --name $clusterName --query "oidcIssuerProfile.issuerUrl" -o tsv)"
64+
export AKS_OIDC_ISSUER="$(az aks show --resource-group $RESOURCE_GROUP --name $CLUSTER_NAME --query "oidcIssuerProfile.issuerUrl" -o tsv)"
6565
echo $AKS_OIDC_ISSUER
6666
```
6767
@@ -72,8 +72,8 @@ Azure AD workload identity (preview) is supported on both Windows and Linux clus
7272
4. Establish a federated identity credential between the Azure AD application and the service account issuer and subject. Get the object ID of the Azure AD application. Update the values for `serviceAccountName` and `serviceAccountNamespace` with the Kubernetes service account name and its namespace.
7373
7474
```bash
75-
export serviceAccountName="workload-identity-sa" # sample name; can be changed
76-
export serviceAccountNamespace="default" # can be changed to namespace of your workload
75+
export SERVICE_ACCOUNT_NAME="workload-identity-sa" # sample name; can be changed
76+
export SERVICE_ACCOUNT_NAMESPACE="default" # can be changed to namespace of your workload
7777
7878
cat <<EOF | kubectl apply -f -
7979
apiVersion: v1
@@ -83,16 +83,16 @@ Azure AD workload identity (preview) is supported on both Windows and Linux clus
8383
azure.workload.identity/client-id: ${USER_ASSIGNED_CLIENT_ID}
8484
labels:
8585
azure.workload.identity/use: "true"
86-
name: ${serviceAccountName}
87-
namespace: ${serviceAccountNamespace}
86+
name: ${SERVICE_ACCOUNT_NAME}
87+
namespace: ${SERVICE_ACCOUNT_NAMESPACE}
8888
EOF
8989
```
9090
9191
Next, 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.
9292
9393
```bash
94-
export federatedIdentityName="aksfederatedidentity" # can be changed as needed
95-
az identity federated-credential create --name $federatedIdentityName --identity-name $UAMI --resource-group $resourceGroupName --issuer ${AKS_OIDC_ISSUER} --subject system:serviceaccount:${serviceAccountNamespace}:${serviceAccountName}
94+
export FEDERATED_IDENTITY_NAME="aksfederatedidentity" # can be changed as needed
95+
az identity federated-credential create --name $FEDERATED_IDENTITY_NAME --identity-name $UAMI --resource-group $RESOURCE_GROUP --issuer ${AKS_OIDC_ISSUER} --subject system:serviceaccount:${SERVICE_ACCOUNT_NAMESPACE}:${SERVICE_ACCOUNT_NAME}
9696
```
9797
5. Deploy a `SecretProviderClass` by using the following YAML script, noticing that the variables will be interpolated:
9898
@@ -138,7 +138,7 @@ Azure AD workload identity (preview) is supported on both Windows and Linux clus
138138
metadata:
139139
name: busybox-secrets-store-inline-user-msi
140140
spec:
141-
serviceAccountName: ${serviceAccountName}
141+
serviceAccountName: ${SERVICE_ACCOUNT_NAME}
142142
containers:
143143
- name: busybox
144144
image: k8s.gcr.io/e2e-test-images/busybox:1.29-1

0 commit comments

Comments
 (0)