azure - Get-MsolUserRole Azure AD V2 cmdlet 等效项

标签 azure powershell azure-active-directory azure-ad-powershell-v2

我当前尝试将使用旧 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/

相关文章:

linux - 向在 Azure 上配置的 VM 提供附加参数

azure - AzureAD 应用程序如何撤销自己的同意? (删除委托(delegate)或应用程序权限)

python - 适用于容器的 Azure Web 应用程序无法连接到适用于 Postgres 的 Azure DB

azure - 升级到 sdk 2.2 后无法调试 azure 解决方案。解决方案无需调试即可正常运行。可以将调试器附加到正在运行的模拟器

.net - FileInfo.BaseName存在于PowerShell中,但不存在于直接的.NET中

powershell - 以异步方式使用 Powershell 的 BeginInvoke() 和 EndInvoke()

powershell - 如何检查是否安装了特定的MSI?

azure - 将使用 Azure AD 和 Azure B2B 的身份验证 WebAPI 服务

c# - 微软图: how to get all groups reusing the token generated through ADAL

asp.net-mvc - Azure Active Directory 租户 ID 和客户端 ID 是否被视为 secret ?