当我使用这样的 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 始终为空,因此,密码只能在创建时检索。
关于azure - 使用 azure cli 创建后如何检索服务主体密码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60535578/