简体   繁体   中英

What is the sure-fire way to find role assignments with "Identity not found." on Azure with Powershell?

If you assign a role in Azure and later delete the identity before you delete the role assignment, you wind up with an "Identity not found." condition. It's harmless, but it takes up a role assignment slot and clutters the role assignments list. I would like to find and delete these.

I am thinking that this:

Get-AzRoleAssignment | Where-object -Property Displayname -eq $null

...will get me those roles without an associated identity, and it seems to work, but the Azure docs don't really create much of an assurance that this will cover all cases.

Should I add something else to this? Or is there a better way of finding these roles assignments?

Turns out this is the way to identify these orphaned role assignments, albeit indirectly. However, you will not be able to remove these orphaned role assignments unless you have the permission to get to all of them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM