你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

az acr token credential

管理Azure 容器注册表令牌的凭据。

命令

名称 说明 类型 状态
az acr token credential delete

删除令牌凭据。

核心 GA
az acr token credential generate

为Azure 容器注册表生成或替换令牌的一个或两个密码。 有关使用令牌和密码访问容器注册表,请参阅 https://aka.ms/acr/repo-permissions

核心 GA

az acr token credential delete

删除令牌凭据。

az acr token credential delete --name
                               --registry
                               [--password1]
                               [--password2]
                               [--resource-group]

示例

删除令牌“MyToken”的两个密码。

az acr token credential delete -n MyToken -r myregistry --password1 --password2

必需参数

--name -n

令牌的名称。

--registry -r

容器注册表的名称。 它应以小写形式指定。 可以使用 配置默认注册表名称 az configure --defaults acr=<registry name>

可选参数

--password1

指示是否应删除第一个密码的标志。

默认值: False
--password2

指示是否应删除第二个密码的标志。

默认值: False
--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az acr token credential generate

为Azure 容器注册表生成或替换令牌的一个或两个密码。 有关使用令牌和密码访问容器注册表,请参阅 https://aka.ms/acr/repo-permissions

az acr token credential generate --name
                                 --registry
                                 [--expiration]
                                 [--expiration-in-days]
                                 [--password1]
                                 [--password2]
                                 [--resource-group]

示例

为令牌“MyToken”生成密码1,有效期为 30 天。

az acr token credential generate -n MyToken -r myregistry --password1 --days 30

必需参数

--name -n

令牌的名称。

--registry -r

容器注册表的名称。 它应以小写形式指定。 可以使用 配置默认注册表名称 az configure --defaults acr=<registry name>

可选参数

--expiration

凭据有效的 UTC 时间。 采用 %Y-%m-%dT%H:%M:%SZ 格式,例如 2025-12-31T12:59:59Z。

--expiration-in-days

凭据有效天数。 如果未指定,过期时间将默认为最大值“9999-12-31T23:59:59.999999+00:00”。

--password1

指示是否应生成 password1 的标志。

默认值: False
--password2

指示是否应生成 password2 的标志。

默认值: False
--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。