[英]Get Azure Active Directory application users and roles
我在Azure AD Premium中設置了一個應用程序,並進行了訪問該應用程序所需的用戶分配。 我已將自定義應用程序角色添加到應用程序清單中。 我可以為用戶分配一個角色給應用程序。
如何獲取分配給應用程序及其分配的角色的所有用戶的列表?
Azure門戶(預覽)
在新的Azure門戶中,在“企業應用程序”>(您的應用程序)>“用戶和組”下,您現在只能看到分配給該應用程序的用戶列表,以及他們分配給該應用程序的應用程序角色。 您還可以按應用角色進行過濾和排序。 這是一個例子:
注意:截至2016年9月,新Azure門戶中的Azure AD管理體驗處於預覽狀態。
經典Azure門戶
在和應用程序的“用戶和組”下,您可以列出所有用戶(以及他們的分配狀態)以及所有組:
[ ]
電源外殼
使用新的預覽(截至2016年9月)Azure AD PowerShell模塊 ,您可以使用以下示例:
# 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 Graph 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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.