azure - 使用 azure cli 创建后如何检索服务主体密码?

标签 azure azure-active-directory

当我使用这样的 az cli 工具创建服务主体时

az ad sp create-for-rbac --name <name>

我打印了所有信息

{
  "appId": "...",
  "displayName": "...",
  "name": "...",
  "password": "...",
  "tenant": "..."
}

这一切都很好,但稍后我如何检索该信息?使用

az ad sp list --display-name <name>

确实给了我几乎我想要的东西,但我缺少密码。如何在不重置密码的情况下找回密码?

最佳答案

How do I retrieve the password without reseting it?

简而言之,不可能

当您使用 commond az ad sp create-for-rbac 时要创建服务主体,具有密码身份验证的服务主体的输出包括密码 key 。 请确保复制此值 - 无法检索它。如果您忘记密码,reset the service principal credentials .

As of Azure CLI 2.0.68, the --password parameter to create a service principal with a user-defined password is no longer supported to prevent the accidental use of weak passwords.

当使用 az ad sp show --id xxxxx 获取服务主体的详细信息时。 (自动生成)passwordCredentials 始终为空,因此,密码只能在创建时检索。

enter image description here

关于azure - 使用 azure cli 创建后如何检索服务主体密码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60535578/

相关文章:

c# - 如何在微服务架构中进行集成测试

azure - 如何删除 Azure Active Directory?

azure - 如何在测试代码中以用户身份登录 Azure Active Directory?

python - 如何使用Azure定时器功能来运行python脚本?

java - 用于访问 Azure Data Lake 的客户端 ID、身份验证 token 端点、客户端 key 是什么?

azure - 使用访问策略从多个不同的主体/用户获取对 Azure Key Vault 的访问权限

azure - 调用Graph API错误: Request_DataContractVersionMissing

azure - 如何在门户 Azure 中添加自定义域?

Azure AD 阻止添加 HTTP 回复 URL

azure - 与 Azure Active Directory 之间的迁移