gpt4 book ai didi

azure - 获取 Azure Active Directory 应用程序用户和角色

转载 作者:行者123 更新时间:2023-12-02 08:18:53 24 4
gpt4 key购买 nike

我已在 Azure AD Premium 中设置了一个应用程序,并进行了访问该应用程序所需的用户分配。我已将自定义应用程序角色添加到应用程序 list 中。我可以为应用程序分配具有角色的用户。

如何获取分配给应用程序的所有用户及其分配的角色的列表?

最佳答案

Azure 门户(预览版)

在新的 Azure 门户中,在“企业应用程序”>(您的应用程序)>“用户和组”下,您现在只能看到分配给该应用程序的用户列表以及他们所拥有的应用程序角色被分配给.您还可以按应用程序角色进行过滤和排序。这是一个例子:

Azure portal / Enterprise applications / Users and groups

注意:自 2016 年 9 月起,新 Azure 门户中的 Azure AD 管理体验处于预览状态。

经典 Azure 门户

在应用程序的“用户和组”下,您可以列出所有用户(及其分配状态)以及所有组:

[Classic Azure portal / Active Directory / Application / Users and groups ]

PowerShell

使用新的 preview (as of Sept 2016) Azure AD PowerShell module ,您可以使用以下示例:

# Get all service principals, and for each one, get all the app role assignments, 
# resolving the app role ID to it's display name. Output everything to a CSV.
Get-AzureADServicePrincipal | % {

# Build a hash table of the service principal's app roles. The 0-Guid is
# used in an app role assignment to indicate that the principal is assigned
# to the default app role (or rather, no app role).
$appRoles = @{ "$([Guid]::Empty.ToString())" = "(default)" }
$_.AppRoles | % { $appRoles[$_.Id] = $_.DisplayName }

# Get the app role assignments for this app, and add a field for the app role name
Get-AzureADServiceAppRoleAssignment -ObjectId ($_.ObjectId) | % {
$_ | Add-Member "AppRoleDisplayName" $appRoles[$_.Id] -Passthru
}
} | Export-Csv "app_role_assignments.csv" -NoTypeInformation

Azure AD 图形 API

使用 Azure AD Graph API,您可以执行与上述 PowerShell 脚本相同的操作(事实上,新的 Azure AD PowerShell 模块使用 Azure AD Graph API 来处理大多数请求)。

列出所有服务主体:

GET https://graph.windows.net/{tenant-id}/servicePrincipals

列出服务主体的应用角色分配:

GET https://graph.windows.net/{tenant-id}/servicePrincipals/{object-id}/appRoleAssignments

关于azure - 获取 Azure Active Directory 应用程序用户和角色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39356317/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com