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
Copy file name to clipboardExpand all lines: articles/container-registry/container-registry-repository-scoped-permissions.md
+22-17Lines changed: 22 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,7 +62,7 @@ The following image shows the relationship between tokens and scope maps.
62
62
63
63
### Create token and specify repositories
64
64
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).
66
66
67
67
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.
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.
76
76
77
77
```console
78
78
{
@@ -105,6 +105,9 @@ The output shows details about the token, including two generated passwords. It'
> If you want to regenerate token passwords and set password expiration periods, see [Regenerate token passwords](#regenerate-token-passwords) later in this article.
110
+
108
111
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.
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.
132
138
133
139
## Create token - portal
134
140
@@ -137,7 +143,7 @@ You can use the Azure portal to create tokens and scope maps. As with the `az ac
137
143
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`.
138
144
139
145
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**.
141
147

142
148
1. Enter a token name.
143
149
1. Under **Scope map**, select **Create new**.
@@ -153,14 +159,12 @@ After the token is validated and created, token details appear in the **Tokens**
153
159
154
160
### Add token password
155
161
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.
159
163
160
164
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.
162
166
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.
164
168
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.
165
169
166
170

@@ -225,7 +229,7 @@ The token doesn't have permissions to the `samples/alpine` repo, so the followin
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.
231
235
@@ -244,7 +248,7 @@ az acr scope-map update \
244
248
In the Azure portal:
245
249
246
250
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.
248
252
1. Under **Repositories**, enter `samples/alpine`, and under **Permissions**, select `content/read` and `content/write`. Then select **+Add**.
249
253
1. Under **Repositories**, select `samples/hello-world` and under **Permissions**, deselect `content/write`. Then select **Save**.
250
254
@@ -279,9 +283,9 @@ az acr scope-map update \
279
283
--add samples/alpine content/delete
280
284
```
281
285
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).
283
287
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:
285
289
286
290
```azurecli
287
291
az acr repository delete \
@@ -302,11 +306,11 @@ az acr scope-map update \
302
306
--add samples/hello-world metadata/read
303
307
```
304
308
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).
306
310
307
311
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.
308
312
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:
310
314
311
315
```azurecli
312
316
az acr repository show-tags \
@@ -321,6 +325,7 @@ Sample output:
321
325
"v1"
322
326
]
323
327
```
328
+
324
329
## Manage tokens and scope maps
325
330
326
331
### List scope maps
@@ -358,9 +363,9 @@ Use the [az acr token list][az-acr-token-list] command, or the **Tokens (Preview
358
363
az acr token list --registry myregistry --output table
359
364
```
360
365
361
-
### Generate passwords for token
366
+
### Regenerate token passwords
362
367
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.
364
369
365
370
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.
0 commit comments