Azure subscription/service principal 在创建后检索 app_id 和 rbac 角色的应用密码
Azure subscription/service principal retrieve app_id and app secret for rbac role after creation
为订阅或服务主体创建 rbac 角色后,您将获得应用 ID 和应用密码,但您稍后如何检索这些?
例如创建 rbac 角色
az ad sp create-for-rbac --role="Contributor" --scopes="/subscriptions/${SUBSCRIPTION_ID}"
然后您得到
的回复的回复
{
"appId": "{appid_hash}",
"displayName": "----------------------------",
"name": "http://----------------------------",
"password": "{password_hash}",
"tenant": "{tenant_hash}"
}
我想再次找到 passowrd 和 appId,但发现很难弄清楚。有什么建议么?通过 cli 工作会更好。我已经知道从 Portal 中获取 appId 的位置,但希望在丢失时能够通过脚本检索它。或者我只需要将这些保存在可以检索的地方。
如果是,那是怎么做到的?
创建后无法找回密码:
Get existing service principle
az ad sp list or az ad sp show get the user and tenant, but not any authentication secrets or the authentication method. Secrets for certificates in Key Vault can be retrieved with az keyvault secret show, but no other secrets are stored by default. If you forget an authentication method or secret, reset the service principal credentials.
您可以列出服务原则的其他详细信息,但您需要知道名称或 ID,例如:
az ad sp show --id "http://testsp"
az ad sp show --id "21cd9589-6f82-435b-9193-b5238fa194e4"
您可以使用 az ad sp list
列出所有服务原则,但您可能已经创建了一百个。您应该安全地存储 ID 和密码,并在以后根据需要检索它们
为订阅或服务主体创建 rbac 角色后,您将获得应用 ID 和应用密码,但您稍后如何检索这些?
例如创建 rbac 角色
az ad sp create-for-rbac --role="Contributor" --scopes="/subscriptions/${SUBSCRIPTION_ID}"
然后您得到
的回复的回复{
"appId": "{appid_hash}",
"displayName": "----------------------------",
"name": "http://----------------------------",
"password": "{password_hash}",
"tenant": "{tenant_hash}"
}
我想再次找到 passowrd 和 appId,但发现很难弄清楚。有什么建议么?通过 cli 工作会更好。我已经知道从 Portal 中获取 appId 的位置,但希望在丢失时能够通过脚本检索它。或者我只需要将这些保存在可以检索的地方。
如果是,那是怎么做到的?
创建后无法找回密码:
Get existing service principle
az ad sp list or az ad sp show get the user and tenant, but not any authentication secrets or the authentication method. Secrets for certificates in Key Vault can be retrieved with az keyvault secret show, but no other secrets are stored by default. If you forget an authentication method or secret, reset the service principal credentials.
您可以列出服务原则的其他详细信息,但您需要知道名称或 ID,例如:
az ad sp show --id "http://testsp"
az ad sp show --id "21cd9589-6f82-435b-9193-b5238fa194e4"
您可以使用 az ad sp list
列出所有服务原则,但您可能已经创建了一百个。您应该安全地存储 ID 和密码,并在以后根据需要检索它们