共用方式為


az ad sp credential

管理服務主體的密碼或憑證認證。

命令

名稱 Description 類型 狀態
az ad sp credential delete

刪除服務主體的密碼或憑證認證。

Core GA
az ad sp credential list

列出服務主體的密碼或憑證認證元數據。 (無法擷取密碼或憑證認證的內容。

Core GA
az ad sp credential reset

重設服務主體的密碼或憑證認證。

Core GA

az ad sp credential delete

刪除服務主體的密碼或憑證認證。

az ad sp credential delete --id
                           --key-id
                           [--cert]

範例

刪除服務主體的密碼認證

az ad sp credential delete --id 00000000-0000-0000-0000-000000000000 --key-id xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

刪除服務主體的憑證認證

az ad sp credential delete --id 00000000-0000-0000-0000-000000000000 --key-id xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx --cert

必要參數

--id

服務主體名稱或物件識別碼。

--key-id

認證金鑰識別碼。

選擇性參數

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--cert

作憑證認證。

屬性
預設值: False
全域參數
--debug

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

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

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

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

Output format.

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

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

--verbose

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

屬性
預設值: False

az ad sp credential list

列出服務主體的密碼或憑證認證元數據。 (無法擷取密碼或憑證認證的內容。

az ad sp credential list --id
                         [--cert]

範例

列出服務主體的密碼認證

az ad sp credential list --id 00000000-0000-0000-0000-000000000000

列出服務主體的憑證認證

az ad sp credential list --id 00000000-0000-0000-0000-000000000000 --cert

必要參數

--id

服務主體名稱或物件識別碼。

選擇性參數

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--cert

作憑證認證。

屬性
預設值: False
全域參數
--debug

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

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

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

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

Output format.

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

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

--verbose

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

屬性
預設值: False

az ad sp credential reset

重設服務主體的密碼或憑證認證。

根據預設,此命令會清除所有密碼和金鑰,並讓圖形服務產生密碼認證。

輸出包含您必須保護的認證。 請確定您未在程式代碼中包含這些認證,或將認證簽入原始檔控制。 As an alternative, consider using managed identities if available to avoid the need to use credentials.

az ad sp credential reset --id
                          [--append]
                          [--cert]
                          [--create-cert]
                          [--display-name]
                          [--end-date]
                          [--keyvault]
                          [--years]

範例

使用密碼重設服務主體的認證

az ad sp credential reset --id 00000000-0000-0000-0000-000000000000

使用新的自我簽署憑證重設服務主體的認證

az ad sp credential reset --id 00000000-0000-0000-0000-000000000000 --create-cert

使用憑證字串將憑證附加至服務主體。

az ad sp credential reset --id 00000000-0000-0000-0000-000000000000 --cert "MIICoT..." --append

使用憑證檔案將憑證附加至服務主體。

az ad sp credential reset --id 00000000-0000-0000-0000-000000000000 --cert "@~/cert.pem" --append
`cert.pem` contains the following content
-----BEGIN CERTIFICATE-----  <<< this line is optional
MIICoT...
-----END CERTIFICATE-----    <<< this line is optional

必要參數

--id

服務主體名稱或物件識別碼。

選擇性參數

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--append

附加新的認證,而不是覆寫。

屬性
Parameter group: Credential Arguments
預設值: False
--cert

要用於認證的憑證。 搭配 --keyvault,使用時,表示要使用的憑證名稱或建立。 否則,請提供 PEM 或 DER 格式化的公用憑證字串。 使用 @{path} 從檔案載入。 請勿包含私鑰。

屬性
Parameter group: keyCredential Arguments
--create-cert

建立要用於認證的自我簽署憑證。 只有目前的OS使用者具有此憑證的讀取/寫入許可權。 使用 搭配 --keyvault 在 Key Vault 中建立憑證。 否則,將會在本機建立憑證。

屬性
Parameter group: keyCredential Arguments
預設值: False
--display-name

認證的易記名稱。

屬性
Parameter group: Credential Arguments
--end-date

如果 '--years' 不足,則更精細的到期時間,例如 '2020-12-31T11:59:59+00:00' 或 '2299-12-31'。

屬性
Parameter group: Credential Arguments
--keyvault

用來建立或擷取憑證之KeyVault的名稱或標識碼。

屬性
Parameter group: keyCredential Arguments
--years

認證有效年份。 默認值:1 年。

屬性
Parameter group: Credential Arguments
全域參數
--debug

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

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

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

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

Output format.

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

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

--verbose

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

屬性
預設值: False