Microsoft Azure 身份验证错误
Microsoft Azure Auth Error
我正在学习 Microsoft Azure 并使用 python3。我收到以下错误代码:
C:\Python\python.exe D:/Phyton/Restapi/a.py
Cannot find resource group sgelastic. Check connection/authorization.
{
"error": {
"code": "AuthorizationFailed",
"message": "The client '22273c48-3d9d-4f31-9316-210135595353' with object id '22273c48-3d9d-4f31-9316-210135595353' does not have authorization to perform action 'Microsoft.Resources/subscriptions/resourceGroups/read' over scope '/subscriptions/0f3e0eec-****-****-b9f9-************resourceGroups/sgelastic'."
}
}
Process finished with exit code 0
我该怎么办?我应该创建新订阅还是其他?
谢谢。
您使用的凭据没有必要的权限来读取资源组 "sgelastic"。
您可以根据需要向这些凭据添加 "contributor" 角色,或者对此特定资源组添加更精确的权限。
为此,您应该阅读有关 Azure 上 RBAC 的文档,最新的是:
https://docs.microsoft.com/azure/active-directory/role-based-access-control-what-is
可用操作列表(以及具有它的内置角色的名称)在那里:
https://docs.microsoft.com/azure/active-directory/role-based-access-built-in-roles
正如@Laurent Mazuel所说,尝试按照下图的步骤添加必要的权限。
- 单击 Azure 门户上的
Subscription
选项卡。
- Select相关资源组的订阅。
- 移动到
Access control (IAM)
选项卡。
- 单击
+ Add
按钮。
- Select
Add permission
对话框中的 Contributor
角色。
- 搜索您的用户或应用程序的名称,select您在搜索结果列表中使用的名称。
- 保存。
或者您可以使用 Azure CLI 2.0 创建服务主体来执行此操作。
az ad sp create-for-rbac --role="Contributor" --scopes="/subscriptions/mySubscriptionID/resourceGroups/myResourceGroupName"
希望对您有所帮助。
我正在学习 Microsoft Azure 并使用 python3。我收到以下错误代码:
C:\Python\python.exe D:/Phyton/Restapi/a.py
Cannot find resource group sgelastic. Check connection/authorization.
{
"error": {
"code": "AuthorizationFailed",
"message": "The client '22273c48-3d9d-4f31-9316-210135595353' with object id '22273c48-3d9d-4f31-9316-210135595353' does not have authorization to perform action 'Microsoft.Resources/subscriptions/resourceGroups/read' over scope '/subscriptions/0f3e0eec-****-****-b9f9-************resourceGroups/sgelastic'."
}
}
Process finished with exit code 0
我该怎么办?我应该创建新订阅还是其他? 谢谢。
您使用的凭据没有必要的权限来读取资源组 "sgelastic"。 您可以根据需要向这些凭据添加 "contributor" 角色,或者对此特定资源组添加更精确的权限。
为此,您应该阅读有关 Azure 上 RBAC 的文档,最新的是: https://docs.microsoft.com/azure/active-directory/role-based-access-control-what-is
可用操作列表(以及具有它的内置角色的名称)在那里: https://docs.microsoft.com/azure/active-directory/role-based-access-built-in-roles
正如@Laurent Mazuel所说,尝试按照下图的步骤添加必要的权限。
- 单击 Azure 门户上的
Subscription
选项卡。 - Select相关资源组的订阅。
- 移动到
Access control (IAM)
选项卡。 - 单击
+ Add
按钮。 - Select
Add permission
对话框中的Contributor
角色。 - 搜索您的用户或应用程序的名称,select您在搜索结果列表中使用的名称。
- 保存。
或者您可以使用 Azure CLI 2.0 创建服务主体来执行此操作。
az ad sp create-for-rbac --role="Contributor" --scopes="/subscriptions/mySubscriptionID/resourceGroups/myResourceGroupName"
希望对您有所帮助。