azure - 如何从现有的 Azure 服务主体获取客户端 key

标签 azure azure-devops azure-active-directory azure-cli

我创建了一个启用 RBAC 的 service principal在 Azure 中使用环境变量在我的操作系统中配置 Key Vault 访问。创建服务主体时,Azure CLI 会响应服务主体详细信息,其中包含 clientSecret 值。创建命令:

az ad sp create-for-rbac -n <http://my-name> --sdk-auth

我想知道稍后是否以及如何请求 clientSecret。当我使用时

az ad sp show --id <my-service-principal-uuid>

az ad sp credential list --id <my-service-principal-uuid>

响应信息中没有clientSecret

除了创建时之外,还有其他方法可以检索 clientSecret 吗?

最佳答案

创建后您无法检索它。您能做的最好的事情就是重置它,此时您将看到新值:

PS C:\> az ad sp credential reset --name foo
{
  "appId": "...",
  "name": "foo",
  "password": "...",
  "tenant": "..."
}

这意味着无论您在何处使用凭据,都需要手动更新该凭据,例如在 Azure DevOps 中,如果您使用该特定服务主体创建了 Azure RM 服务连接。

关于azure - 如何从现有的 Azure 服务主体获取客户端 key ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62971186/

相关文章:

azure - Azure IoT Edge 安装中的配置错误 - "configuration has correct URIs for daemon mgmt endpoint - Error"

azure-devops - Terraform - 如何在对象列表中展平列表

angular - 如何在 Angular 中配置 MSAL?

azure - Azure B2C 自定义策略中的自定义角色声明

azure - 在 Azure AD 租户的 Azure 门户中将成员作为组所有者添加到组中

testing - 当 Azure 角色处于暂存部署状态时,要处理哪些数据集?

Azure Devops YAML - AzureKeyVault 任务不接受变量作为 keyvaultname

Android Azure 移动服务离线同步软删除

azure - Azure DevOps 中的 "Build after the previous execution has succeeded"

git - Azure管道: Download zipped solution from git repo + upload