如何在 azure 应用程序注册中显示客户端机密的隐藏值

时间:2021-06-30 10:47:42

标签: azure azure-active-directory

这里我使用这个命令来设置凭据

az ad app credential reset --id "$getAppId" --append --credential-description "Test is sample2"  --end-date '2299-12-31' --password "Test123"

但我需要客户端机密值应显示在 azure 应用程序注册 UI 上 此处隐藏了该值,如下图所示:

enter image description here

1 个答案:

答案 0 :(得分:1)

简单的答案是你不能。客户端机密值仅在创建时显示,之后既不显示也不可检索。

您需要做的是创建一个新的客户端机密并在显示时复制其值。

更新

所以我拿了你的代码并在我的 Azure AD 应用程序上运行它:

az ad app credential reset --id "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" --append --credential-description "Test is sample2"  --end-date '2299-12-31' --password "Test123"

这显示在输出中:


> The output includes credentials that you must protect. Be sure that
> you do not include these credentials in your code or check the
> credentials into your source control. For more information, see
> https://aka.ms/azadsp-cli


{
  "appId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "name": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "password": "Test123",
  "tenant": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}

如您所见,我设置的密码显示在响应中。