删除/添加存储帐户中的删除/添加用户角色时,Azure Automation帐户runbook错误
当我尝试使用以下命令通过自动化帐户删除存储帐户上的用户,我会遇到错误
对象引用未设置为对象的实例
Remove-AzRoleAssignment -SignInName $emailid -RoleDefinitionName
"Storage File Data SMB Share Contributor" -Scope "/subscriptions/00000-0000-00/resourceGroups/resourcegroupname/providers/Microsoft.Storage/storageAccounts/storageaccname"
When i'm trying to remove user on the storage account using below commands through automation account i'm getting error
object reference not set to instance of an object
Remove-AzRoleAssignment -SignInName $emailid -RoleDefinitionName
"Storage File Data SMB Share Contributor" -Scope "/subscriptions/00000-0000-00/resourceGroups/resourcegroupname/providers/Microsoft.Storage/storageAccounts/storageaccname"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以遵循很少的解决方法来达到上述要求;
确保您有遵循 < strong>
权限
到该订阅所有者
或,用户访问管理员
(必须具有包括Microsoft.authorization.authorization/roleassignments/write Permissions
)的角色才能分配或删除。如果您有上述权限检查在存储帐户中定义的角色与您提到的要删除相同的角色。或是否存在。
并确保您要删除的角色,而不会显示为 继承的 ,因此您无法删除这些作业在儿童范围内分配。
有关更多信息,请参阅下面的链接: -
Few of the workaround you can follow to achieve the above requirement;
Make sure that you have following
permission
to that subscriptionOwner
or,User Access Administrator
(must have a role that includes Microsoft.Authorization/roleAssignments/write permissions
) to assign or remove.If you have above permission Check the role which have defined in storage account same as what you have mentioned want to remove. Or it exist or not.
And make sure that the role which you want to remove, that not showing as inherited If so you can not remove those assignments as you are trying to remove a role assignment at a child scope.
For more information please refer the below links:-