Skip to content

Commit 3ab0476

Browse files
committed
[ACR] Token updates
1 parent bc9fbfd commit 3ab0476

File tree

1 file changed

+22
-17
lines changed

1 file changed

+22
-17
lines changed

articles/container-registry/container-registry-repository-scoped-permissions.md

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ The following image shows the relationship between tokens and scope maps.
6262

6363
### Create token and specify repositories
6464

65-
Create a token using the [az acr token create][az-acr-token-create] command. When creating a token, you can specify one or more repositories and associated actions on each repository. The repositories don't need to be in the registry yet. To create a token by specifying an existing scope map, see the next section.
65+
Create a token using the [az acr token create][az-acr-token-create] command. When creating a token, you can specify one or more repositories and associated actions on each repository. The repositories don't need to be in the registry yet. To create a token by specifying an existing scope map, see the [next section](#create-token-and-specify-scope-map).
6666

6767
The following example creates a token in the registry *myregistry* with the following permissions on the `samples/hello-world` repo: `content/write` and `content/read`. By default, the command sets the default token status to `enabled`, but you can update the status to `disabled` at any time.
6868

@@ -72,7 +72,7 @@ az acr token create --name MyToken --registry myregistry \
7272
content/write content/read
7373
```
7474

75-
The output shows details about the token, including two generated passwords. It's recommended to save the passwords in a safe place to use later for authentication. The passwords can't be retrieved again, but new ones can be generated.
75+
The output shows details about the token. By default, two passwords are generated. It's recommended to save the passwords in a safe place to use later for authentication. The passwords can't be retrieved again, but new ones can be generated.
7676

7777
```console
7878
{
@@ -105,6 +105,9 @@ The output shows details about the token, including two generated passwords. It'
105105
"type": "Microsoft.ContainerRegistry/registries/tokens"
106106
```
107107

108+
> [!NOTE]
109+
> If you want to regenerate token passwords and set password expiration periods, see [Regenerate token passwords](#regenerate-token-passwords) later in this article.
110+
108111
The output includes details about the scope map the command created. You can use the scope map, here named `MyToken-scope-map`, to apply the same repository actions to other tokens. Or, update the scope map later to change the permissions of the associated tokens.
109112

110113
### Create token and specify scope map
@@ -128,7 +131,10 @@ az acr token create --name MyToken \
128131
--scope-map MyScopeMap
129132
```
130133

131-
The output shows details about the token, including two generated passwords. It's recommended to save the passwords in a safe place to use later for authentication. The passwords can't be retrieved again, but new ones can be generated.
134+
The output shows details about the token. By default, two passwords are generated. It's recommended to save the passwords in a safe place to use later for authentication. The passwords can't be retrieved again, but new ones can be generated.
135+
136+
> [!NOTE]
137+
> If you want to regenerate token passwords and set password expiration periods, see [Regenerate token passwords](#regenerate-token-passwords) later in this article.
132138
133139
## Create token - portal
134140

@@ -137,7 +143,7 @@ You can use the Azure portal to create tokens and scope maps. As with the `az ac
137143
The following example creates a token, and creates a scope map with the following permissions on the `samples/hello-world` repository: `content/write` and `content/read`.
138144

139145
1. In the portal, navigate to your container registry.
140-
1. Under **Services**, select **Tokens (Preview) > +Add**.
146+
1. Under **Repository permissions**, select **Tokens (Preview) > +Add**.
141147
![Create token in portal](media/container-registry-repository-scoped-permissions/portal-token-add.png)
142148
1. Enter a token name.
143149
1. Under **Scope map**, select **Create new**.
@@ -153,14 +159,12 @@ After the token is validated and created, token details appear in the **Tokens**
153159

154160
### Add token password
155161

156-
Generate a password after you create a token. To authenticate with the registry, the token must be enabled and have a valid password.
157-
158-
You can generate one or two passwords, and set an expiration date for each one.
162+
To use a token created in the portal, you must generate a password. You can generate one or two passwords, and set an expiration date for each one.
159163

160164
1. In the portal, navigate to your container registry.
161-
1. Under **Services**, select **Tokens (Preview)**, and select a token.
165+
1. Under **Repository permissions**, select **Tokens (Preview)**, and select a token.
162166
1. In the token details, select **password1** or **password2**, and select the Generate icon.
163-
1. In the password screen, optionally set an expiration date for the password, and select **Generate**.
167+
1. In the password screen, optionally set an expiration date for the password, and select **Generate**. It's recommended to set an expiration date.
164168
1. After generating a password, copy and save it to a safe location. You can't retrieve a generated password after closing the screen, but you can generate a new one.
165169

166170
![Create token password in portal](media/container-registry-repository-scoped-permissions/portal-token-password.png)
@@ -225,7 +229,7 @@ The token doesn't have permissions to the `samples/alpine` repo, so the followin
225229
docker push myregistry.azurecr.io/samples/alpine:v1
226230
```
227231

228-
### Change push/pull permissions
232+
### Update token permissions
229233

230234
To update the permissions of a token, update the permissions in the associated scope map. The updated scope map is applied immediately to all associated tokens.
231235

@@ -244,7 +248,7 @@ az acr scope-map update \
244248
In the Azure portal:
245249

246250
1. Navigate to your container registry.
247-
1. Under **Services**, select **Scope maps (Preview)**, and select the scope map to update.
251+
1. Under **Repository permissions**, select **Scope maps (Preview)**, and select the scope map to update.
248252
1. Under **Repositories**, enter `samples/alpine`, and under **Permissions**, select `content/read` and `content/write`. Then select **+Add**.
249253
1. Under **Repositories**, select `samples/hello-world` and under **Permissions**, deselect `content/write`. Then select **Save**.
250254

@@ -279,9 +283,9 @@ az acr scope-map update \
279283
--add samples/alpine content/delete
280284
```
281285

282-
To update the scope map using the portal, see the preceding section.
286+
To update the scope map using the portal, see the [previous section](#update-token-permissions).
283287

284-
Use the following [az acr repository delete][az-acr-repository-delete] command to delete the `samples/alpine` repository. To delete images or repositories, the token doesn't authenticate through `docker login`. Instead, pass the token's name and password to the command. The following example uses the environment variables created earlier in the article:
288+
Use the following [az acr repository delete][az-acr-repository-delete] command to delete the `samples/alpine` repository. To delete images or repositories, pass the token's name and password to the command. The following example uses the environment variables created earlier in the article:
285289

286290
```azurecli
287291
az acr repository delete \
@@ -302,11 +306,11 @@ az acr scope-map update \
302306
--add samples/hello-world metadata/read
303307
```
304308

305-
To update the scope map using the portal, see the preceding section.
309+
To update the scope map using the portal, see the [previous section](#update-token-permissions).
306310

307311
To read metadata in the `samples/hello-world` repository, run the [az acr repository show-manifests][az-acr-repository-show-manifests] or [az acr repository show-tags][az-acr-repository-show-tags] command.
308312

309-
To read metadata, the token doesn't authenticate through `docker login`. Instead, pass the token's name and password to either command. The following example uses the environment variables created earlier in the article:
313+
To read metadata, pass the token's name and password to either command. The following example uses the environment variables created earlier in the article:
310314

311315
```azurecli
312316
az acr repository show-tags \
@@ -321,6 +325,7 @@ Sample output:
321325
"v1"
322326
]
323327
```
328+
324329
## Manage tokens and scope maps
325330

326331
### List scope maps
@@ -358,9 +363,9 @@ Use the [az acr token list][az-acr-token-list] command, or the **Tokens (Preview
358363
az acr token list --registry myregistry --output table
359364
```
360365

361-
### Generate passwords for token
366+
### Regenerate token passwords
362367

363-
If you don't have a token password, or you want to generate new passwords, run the [az acr token credential generate][az-acr-token-credential-generate] command.
368+
If you didn't generate a token password, or you want to generate new passwords, run the [az acr token credential generate][az-acr-token-credential-generate] command.
364369

365370
The following example generates a new value for password1 for the *MyToken* token, with an expiration period of 30 days. It stores the password in the environment variable `TOKEN_PWD`. This example is formatted for the bash shell.
366371

0 commit comments

Comments
 (0)