作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我已经创建了我的服务主体。
使用 GitHub,我需要完成以下所有参数。我的问题是我们在哪里以及如何找到每一个?
AZURE_CREDENTIALS :
{
"clientId": "XXX",
"clientSecret": "XXX",
"subscriptionId": "XXX",
"tenantId": "XXX",
"activeDirectoryEndpointUrl": "XXX",
"resourceManagerEndpointUrl": "XXX",
"activeDirectoryGraphResourceId": "XXX",
"sqlManagementEndpointUrl": "XXX",
"galleryEndpointUrl": "XXX",
"managementEndpointUrl": "XXX"
}
我已经在文档中看到,我们可以使用 CLI Azure 为新主体服务生成 JSON 文件:
az ad sp create-for-rbac `
--name "myApp" --role contributor `
--scopes /subscriptions/8baa642d-5109-4f1c-b935-401e5b215078/resourceGroups/rg-ai-recommender `
--sdk-auth
但我想使用现有的服务主体。
最佳答案
您可以多次运行该命令。
如果再次运行它,将会出现一条消息,内容如下:
az ad sp create-for-rbac --name TestPrincipal --role Contributor --sdk-auth
Found an existing application instance of "[existingId]". We will patch it
Creating 'Contributor' role assignment under scope '/subscriptions/[guid]'
Role assignment already exists.
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
'name' property in the output is deprecated and will be removed in the future. Use 'appId' instead.
{
"clientId": "[existingId]",
"clientSecret": "[aNewSecret]",
"subscriptionId": "[subscriptionid]",
// all the other properties
}
当然,这将使您在其他存储库中使用的凭据无效,因此您也应该更新这些凭据。
恢复 secret 是不可能的,因为它是 secret 。
这样您就可以在多个存储库中使用相同的服务主体。
<小时/>请记住,为不同的服务/部署创建新的服务主体可能是一种更安全的策略,因此您可以尽可能精细地分配角色。但这不是你的问题。
关于azure - 获取服务主体的 AZURE_CREDENTIALS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71394641/
我已经创建了我的服务主体。 使用 GitHub,我需要完成以下所有参数。我的问题是我们在哪里以及如何找到每一个? AZURE_CREDENTIALS : { "clientId": "XXX",
我已经创建了我的服务主体。 使用 GitHub,我需要完成以下所有参数。我的问题是我们在哪里以及如何找到每一个? AZURE_CREDENTIALS : { "clientId": "XXX",
我是一名优秀的程序员,十分优秀!