我正在尝试让用户通过 Azure 设备代码流登录公共(public) Azure AD 应用程序。
我认为我得到的异常非常简单:
与 Web 应用程序不同,在我的 Azure AD 门户中,没有添加用户/组(Azure AD->企业应用程序)的选项,但有一个选项可以启用用户分配 strong>(这就是我想要实现的目标),这使它更奇怪,因为它说如果此选项设置为"is",则用户必须首先分配到此应用程序才能访问它。
如果没有从 AD 门户执行此操作的选项,如何将用户分配给应用程序? [ Azure 文档 here ]
最佳答案
有两个选项:
1.导航到门户中的应用程序注册 -> 身份验证
-> 将将应用程序视为公共(public)客户端
设置为否
-> 进入相应的企业应用 -> 用户和组
-> 添加用户 -> 返回将将应用程序视为公共(public)客户端
设置为是
.
2.您可以使用azure powershell New-AzureADUserAppRoleAssignment
直接添加用户。
将用户分配给没有角色的应用程序:
New-AzureADUserAppRoleAssignment -ObjectId "<user objectid>" -PrincipalId "<user objectid>" -ResourceId "<service principal objectid(i.e. Enterprise Application objectid)>" -Id ([Guid]::Empty)
将用户分配给应用程序中的特定应用程序角色:
$username = "<You user's UPN>"
$app_name = "<Your App's display name>"
$app_role_name = "<App role display name>"
# Get the user to assign, and the service principal for the app to assign to
$user = Get-AzureADUser -ObjectId "$username"
$sp = Get-AzureADServicePrincipal -Filter "displayName eq '$app_name'"
$appRole = $sp.AppRoles | Where-Object { $_.DisplayName -eq $app_role_name }
#Assign the user to the app role
New-AzureADUserAppRoleAssignment -ObjectId $user.ObjectId -PrincipalId $user.ObjectId -ResourceId $sp.ObjectId -Id $appRole.Id
关于azure - 在 Azure AD 公共(public)客户端应用程序中添加用户,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58983421/