我当前尝试将使用旧 MSOnline PowerShell 模块的现有 PowerShell 脚本迁移到 AzureAD (V2) 模块。我能够替换大多数 cmdlet,但我找不到 Get-MsolUserRole
的替代品用于检索特定用户的管理员角色的 cmdlet。
类似的 AzureAD (V2) cmdlet 不允许我通过用户的 objectId 查询角色(它们需要角色 objectid)。 有什么建议吗?
最佳答案
最接近的等效项是 Get-AzureADUserMembership
,但由于这还包括其他成员身份(例如组成员身份),因此您需要将结果过滤为仅目录角色:
Get-AzureADUserMembership -ObjectId "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="582d2b3d2a183d20393528343d763b3735" rel="noreferrer noopener nofollow">[email protected]</a>" -All $true `
| Where-Object { $_.ObjectType -eq "Role" }
关于azure - Get-MsolUserRole Azure AD V2 cmdlet 等效项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52781119/