Skip to content

Commit 6ce11c1

Browse files
authored
Merge pull request #108094 from lanicolas/patch-44
Align with bash style guide
2 parents dbee40c + 08b398b commit 6ce11c1

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

articles/container-instances/container-instances-managed-identity.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ To use the identity in the following steps, use the [az identity show](/cli/azur
8787

8888
```azurecli-interactive
8989
# Get service principal ID of the user-assigned identity
90-
spID=$(az identity show \
90+
SP_ID=$(az identity show \
9191
--resource-group myResourceGroup \
9292
--name myACIId \
9393
--query principalId --output tsv)
9494
9595
# Get resource ID of the user-assigned identity
96-
resourceID=$(az identity show \
96+
RESOURCE_ID=$(az identity show \
9797
--resource-group myResourceGroup \
9898
--name myACIId \
9999
--query id --output tsv)
@@ -107,7 +107,7 @@ Run the following [az keyvault set-policy](/cli/azure/keyvault) command to set a
107107
az keyvault set-policy \
108108
--name mykeyvault \
109109
--resource-group myResourceGroup \
110-
--object-id $spID \
110+
--object-id $SP_ID \
111111
--secret-permissions get
112112
```
113113

@@ -122,7 +122,7 @@ az container create \
122122
--resource-group myResourceGroup \
123123
--name mycontainer \
124124
--image mcr.microsoft.com/azure-cli \
125-
--assign-identity $resourceID \
125+
--assign-identity $RESOURCE_ID \
126126
--command-line "tail -f /dev/null"
127127
```
128128

@@ -179,14 +179,14 @@ Output:
179179
To store the access token in a variable to use in subsequent commands to authenticate, run the following command:
180180

181181
```bash
182-
token=$(curl 'http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https%3A%2F%2Fvault.azure.net' -H Metadata:true | jq -r '.access_token')
182+
TOKEN=$(curl 'http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https%3A%2F%2Fvault.azure.net' -H Metadata:true | jq -r '.access_token')
183183

184184
```
185185

186186
Now use the access token to authenticate to key vault and read a secret. Be sure to substitute the name of your key vault in the URL (*https:\//mykeyvault.vault.azure.net/...*):
187187

188188
```bash
189-
curl https://mykeyvault.vault.azure.net/secrets/SampleSecret/?api-version=2016-10-01 -H "Authorization: Bearer $token"
189+
curl https://mykeyvault.vault.azure.net/secrets/SampleSecret/?api-version=2016-10-01 -H "Authorization: Bearer $TOKEN"
190190
```
191191

192192
The response looks similar to the following, showing the secret. In your code, you would parse this output to obtain the secret. Then, use the secret in a subsequent operation to access another Azure resource.
@@ -205,14 +205,14 @@ The `--assign-identity` parameter with no additional value enables a system-assi
205205

206206
```azurecli-interactive
207207
# Get the resource ID of the resource group
208-
rgID=$(az group show --name myResourceGroup --query id --output tsv)
208+
RG_ID=$(az group show --name myResourceGroup --query id --output tsv)
209209
210210
# Create container group with system-managed identity
211211
az container create \
212212
--resource-group myResourceGroup \
213213
--name mycontainer \
214214
--image mcr.microsoft.com/azure-cli \
215-
--assign-identity --scope $rgID \
215+
--assign-identity --scope $RG_ID \
216216
--command-line "tail -f /dev/null"
217217
```
218218

@@ -240,7 +240,7 @@ The `identity` section in the output looks similar to the following, showing tha
240240
Set a variable to the value of `principalId` (the service principal ID) of the identity, to use in later steps.
241241

242242
```azurecli-interactive
243-
spID=$(az container show \
243+
SP_ID=$(az container show \
244244
--resource-group myResourceGroup \
245245
--name mycontainer \
246246
--query identity.principalId --out tsv)
@@ -254,7 +254,7 @@ Run the following [az keyvault set-policy](/cli/azure/keyvault) command to set a
254254
az keyvault set-policy \
255255
--name mykeyvault \
256256
--resource-group myResourceGroup \
257-
--object-id $spID \
257+
--object-id $SP_ID \
258258
--secret-permissions get
259259
```
260260

0 commit comments

Comments
 (0)