Skip to content

Commit adaa4df

Browse files
authored
Update workload-identity.md
update the formatting for yaml file command for Service account
1 parent c04b13e commit adaa4df

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

AKS-Arc/workload-identity.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,21 @@ az connectedk8s proxy -n $aks_cluster_name -g $resource_group_name
176176
Open a new window. Copy and paste the following CLI commands:
177177

178178
```azurecli
179-
$yaml = @" apiVersion: v1 kind: ServiceAccount metadata: annotations: azure.workload.identity/client-id: $MSIId name: $SERVICE_ACCOUNT_NAME namespace: $SERVICE_ACCOUNT_NAMESPACE "@ $yaml = $yaml -replace '\$MSIId', $MSIId ` -replace '\$SERVICE_ACCOUNT_NAME', $SERVICE_ACCOUNT_NAME ` -replace '\$SERVICE_ACCOUNT_NAMESPACE', $SERVICE_ACCOUNT_NAMESPACE $yaml | kubectl apply -f -
179+
$yaml = @"
180+
apiVersion: v1
181+
kind: ServiceAccount
182+
metadata:
183+
annotations:
184+
azure.workload.identity/client-id: $MSIId
185+
name: $SERVICE_ACCOUNT_NAME
186+
namespace: $SERVICE_ACCOUNT_NAMESPACE
187+
"@
188+
189+
$yaml = $yaml -replace '\$MSIId', $MSIId `
190+
-replace '\$SERVICE_ACCOUNT_NAME', $SERVICE_ACCOUNT_NAME `
191+
-replace '\$SERVICE_ACCOUNT_NAMESPACE', $SERVICE_ACCOUNT_NAMESPACE
192+
193+
$yaml | kubectl apply -f -
180194
```
181195

182196
The following output shows successful creation of the service account:

0 commit comments

Comments
 (0)