Get-AzRoleAssignment在Azure Runbook中引发Microsoft.Rest.Azure.CloudException [英] Get-AzRoleAssignment throws Microsoft.Rest.Azure.CloudException in Azure Runbook
本文介绍了Get-AzRoleAssignment在Azure Runbook中引发Microsoft.Rest.Azure.CloudException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在Azure Automation帐户中使用Runbook。在本Runbook中,我使用对订阅具有所有者权限的运行方式帐户。当我执行命令Get-AzRoleAssignment
时,我得到:
Get-AzRoleAssignment : Exception of type 'Microsoft.Rest.Azure.CloudException' was thrown.
At line:21 char:16 + $listOfUsers = Get-AzRoleAssignment -verbose + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +
CategoryInfo : CloseError: (:) [Get-AzRoleAssignment], CloudException + FullyQualifiedErrorId :
Microsoft.Azure.Commands.Resources.GetAzureRoleAssignmentCommand
运行方式帐户&p>的服务主体具有以下权限:
您有什么想法吗?
这是授权错误吗?如果是,我应该向SP授予哪些权限?
推荐答案
我也可以在我这边复制您的问题,当您使用一些参数运行命令时,例如使用ObjectId
,Get-AzRoleAssignment -ObjectId xxxxx
,它将首先调用AAD Graph来验证您租户中的对象。
若要解决此问题,只需将Azure Active Directory Graph
的的应用程序权限添加到您的RunAs帐户的AD应用程序。
注意:您在屏幕截图中添加了Directory.Read.All
,它将不起作用,必须是应用程序权限,请检查以下步骤。
授予权限后,它运行正常。
这篇关于Get-AzRoleAssignment在Azure Runbook中引发Microsoft.Rest.Azure.CloudException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文