共用方式為


az acr token

管理 Azure Container Registry 的令牌。

命令

名稱 Description 類型 狀態
az acr token create

建立與 Azure Container Registry 範圍對應相關聯的令牌。

Core GA
az acr token credential

管理 Azure Container Registry 令牌的認證。

Core GA
az acr token credential delete

刪除令牌認證。

Core GA
az acr token credential generate

產生或取代 Azure Container Registry 令牌的一或兩個密碼。 如需使用權杖和密碼來存取容器登錄,請參閱 https://aka.ms/acr/repo-permissions

Core GA
az acr token delete

刪除 Azure Container Registry 的令牌。

Core GA
az acr token list

列出 Azure Container Registry 的所有令牌。

Core GA
az acr token show

顯示 Azure Container Registry 令牌的詳細數據和屬性。

Core GA
az acr token update

更新 Azure Container Registry 的令牌(取代相關聯的範圍對應)。

Core GA

az acr token create

建立與 Azure Container Registry 範圍對應相關聯的令牌。

az acr token create --name
                    --registry
                    [--expiration]
                    [--expiration-in-days]
                    [--gateway]
                    [--no-passwords {false, true}]
                    [--repository]
                    [--resource-group]
                    [--scope-map]
                    [--status {disabled, enabled}]

範例

使用範圍對應 『MyScopeMap』 中定義的存放庫許可權建立令牌。

az acr token create -n MyToken -r myregistry --scope-map MyScopeMap

建立令牌,其具有 hello-world 存放庫的讀取許可權。

az acr token create -n myToken -r myregistry --repository hello-world content/read metadata/read

建立不含認證且具有所有閘道許可權的令牌。

az acr token create -n myToken -r myregistry --repository hello-world content/read
  --gateway registry config/read config/write message/read message/write --no-passwords

在停用狀態中建立令牌。

az acr token create -n MyToken -r myregistry --scope-map MyScopeMap --status disabled

必要參數

--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」。。

--gateway

閘道許可權。 使用每個旗標的格式 --gateway GATEWAY [ACTION1 ACTION2 ...]“。 有效的動作為 ['config/read'、'config/write'、'message/read'、'message/write']。

--no-passwords

請勿在令牌建立期間產生密碼。 您可以使用 az acr token credentials generate 命令,在令牌建立之後產生密碼。

屬性
接受的值: false, true
--repository

存放庫許可權。 使用每個旗標的格式 「--repository REPO 」[ACTION1 ACTION2 ...]“。 有效的動作為 ['content/delete'、'content/read'、'content/write'、'metadata/read'、'metadata/write']。

--resource-group -g

資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。

--scope-map

具有預先設定存放庫許可權的範圍對應名稱。 如果您想要 CLI 為您設定一個,請使用 “--repository” 和/或 “--gateway”。

--status

令牌的狀態。

屬性
預設值: enabled
接受的值: disabled, enabled
全域參數
--debug

提高日誌詳細程度以顯示所有調試日誌。

屬性
預設值: False
--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

屬性
預設值: False
--output -o

輸出格式。

屬性
預設值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。

--verbose

增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。

屬性
預設值: False

az acr token delete

刪除 Azure Container Registry 的令牌。

az acr token delete --name
                    --registry
                    [--resource-group]
                    [--yes]

範例

刪除令牌 『MyToken』。

az acr token delete -n MyToken -r myregistry

必要參數

--name -n

令牌的名稱。

--registry -r

容器登錄的名稱。 它應該以小寫指定。 您可以使用 az configure --defaults acr=<registry name>來設定預設登錄名稱。

選擇性參數

下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。

--resource-group -g

資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。

--yes -y

請勿提示確認。

全域參數
--debug

提高日誌詳細程度以顯示所有調試日誌。

屬性
預設值: False
--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

屬性
預設值: False
--output -o

輸出格式。

屬性
預設值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。

--verbose

增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。

屬性
預設值: False

az acr token list

列出 Azure Container Registry 的所有令牌。

az acr token list --registry
                  [--resource-group]

範例

列出登錄 'myregistry' 底下的令牌。

az acr token list -r myregistry

必要參數

--registry -r

容器登錄的名稱。 它應該以小寫指定。 您可以使用 az configure --defaults acr=<registry name>來設定預設登錄名稱。

選擇性參數

下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。

--resource-group -g

資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。

全域參數
--debug

提高日誌詳細程度以顯示所有調試日誌。

屬性
預設值: False
--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

屬性
預設值: False
--output -o

輸出格式。

屬性
預設值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。

--verbose

增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。

屬性
預設值: False

az acr token show

顯示 Azure Container Registry 令牌的詳細數據和屬性。

az acr token show --name
                  --registry
                  [--resource-group]

範例

取得令牌 'MyToken' 的資訊。

az acr token show -n MyToken -r myregistry

必要參數

--name -n

令牌的名稱。

--registry -r

容器登錄的名稱。 它應該以小寫指定。 您可以使用 az configure --defaults acr=<registry name>來設定預設登錄名稱。

選擇性參數

下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。

--resource-group -g

資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。

全域參數
--debug

提高日誌詳細程度以顯示所有調試日誌。

屬性
預設值: False
--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

屬性
預設值: False
--output -o

輸出格式。

屬性
預設值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。

--verbose

增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。

屬性
預設值: False

az acr token update

更新 Azure Container Registry 的令牌(取代相關聯的範圍對應)。

az acr token update --name
                    --registry
                    [--resource-group]
                    [--scope-map]
                    [--status {disabled, enabled}]

範例

更新令牌 'MyToken',使其與範圍對應 'MyNewScopeMap' 相關聯。

az acr token update -n MyToken -r myregistry --scope-map MyNewScopeMap

必要參數

--name -n

令牌的名稱。

--registry -r

容器登錄的名稱。 它應該以小寫指定。 您可以使用 az configure --defaults acr=<registry name>來設定預設登錄名稱。

選擇性參數

下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。

--resource-group -g

資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。

--scope-map

與令牌相關聯的範圍對應名稱。 如果未指定,執行此命令將會解除與令牌相關的目前範圍對應關聯。

--status

令牌的狀態。

屬性
預設值: enabled
接受的值: disabled, enabled
全域參數
--debug

提高日誌詳細程度以顯示所有調試日誌。

屬性
預設值: False
--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

屬性
預設值: False
--output -o

輸出格式。

屬性
預設值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。

--verbose

增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。

屬性
預設值: False