azure - 在 Azure AD 公共(public)客户端应用程序中添加用户

标签 azure azure-active-directory

我正在尝试让用户通过 Azure 设备代码流登录公共(public) Azure AD 应用程序。

我认为我得到的异常非常简单:

enter image description here

与 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/

相关文章:

azure-active-directory - 为什么在 Azure B2C 中针对移动应用使用 OAuth 2 与 OpenID Connect

typo3 - 将 Azure AD 中的 TYPO3 fe_users 与 SAML 2 连接起来的最佳方式是什么?

Azure AD SCIM 客户端实现 - 用户/组说明

unit-testing - Windows Azure 测试最佳实践(单元)

c# - Azure 移动服务 PullAsync() 未填充同步表

design-patterns - 如何正确存储与 Microsoft Azure 表存储的数据关系?

azure 文件系统使用情况(应用服务计划)

azure - 如何跟踪 Azure DevOps 上触发管道的原因?

azure - 将 AAD 应用程序添加为安全组的成员

azure - Okta 作为 Azure AD 中的 IDP