New-azureadGroupAppRoleasSignment cmdlet使用

发布于 2025-02-13 21:08:39 字数 1701 浏览 0 评论 0原文

我正在尝试弄清楚如何使用powershell cmdlet new-azureadgroupapproleassignment将组添加到应用程序角色中。

在Azuread Portal中,我将选择:企业应用程序> app_name>用户和团体>添加用户/组,然后选择组名和应用程序角色。

当我在下面使用的应用程序,组和应用程序角色在门户网站上执行此操作时,它将成功完成。

我从下面的文档中可以看出的最好的方法是:

New-AzureADGroupAppRoleAssignment -ObjectId $objectId -Id $objectId -PrincipalId $principalId -ResourceId $resourceId

https://learn.microsoft.com/en-us/powershell/module/module/azuread/new-azureadgroupapproleassignment?view = azureadps-

2.0

ObjectId = name of the group being assigned to the app role
Id = not sure here, but some examples point to using the group object ID again
PrincipalId = app object id
ResourceId = app role object id

new-azureadgroupapproleassignment:执行时发生错误 newGroupApproleassignment代码:request_badrequest消息:不是 有效的参考更新。 requestID: FB8145C9-8FB4-4D6D-92B7-F48A8A81EEF1E2D DATETIMESTAMP:THU,07年7月7日 15:27:10 GMT httpstatuscode:BadRequest httpstatusdescription:Bad 请求httpresponsestatus:完成 \ truenas \ it \ scripts \ azuread \ azuread-add app test to to group test.ps1:12 char:1

  • new -azureadgroupapproleassignment -objectid $ objectid -id $ id -princi ...
  •   + categoryInfo:未指定::) [new-azureadgroupapproleassignment],apiexception
      + flutlqualifiedErrid:microsoft.open.azuread16.client.apiexception,microsoft.open.azuread16.powershell.newgroupapproupproleaseassignment
     

I am trying to figure out how to use the PowerShell cmdlet New-AzureADGroupAppRoleAssignment to add a group to an app role.

In the AzureAD portal, I would select: enterprise applications > app_name > users and groups > add user/group, then select the group name and the app role.

When I do this in the portal with the app, group, and app role I use below, it completes successfully.

The best way I can tell from the documentation below to run this is something like:

New-AzureADGroupAppRoleAssignment -ObjectId $objectId -Id $objectId -PrincipalId $principalId -ResourceId $resourceId

https://learn.microsoft.com/en-us/powershell/module/azuread/new-azureadgroupapproleassignment?view=azureadps-2.0

where:

ObjectId = name of the group being assigned to the app role
Id = not sure here, but some examples point to using the group object ID again
PrincipalId = app object id
ResourceId = app role object id

When I run this, I get the following error:

New-AzureADGroupAppRoleAssignment : Error occurred while executing
NewGroupAppRoleAssignment Code: Request_BadRequest Message: Not a
valid reference update. RequestId:
fb8145c9-8fb4-4d6d-92b7-f48a81ef1e2d DateTimeStamp: Thu, 07 Jul 2022
15:27:10 GMT HttpStatusCode: BadRequest HttpStatusDescription: Bad
Request HttpResponseStatus: Completed At
\truenas\IT\Scripts\AzureAD\AzureAD-Add App Role to Group Test.ps1:12
char:1

  • New-AzureADGroupAppRoleAssignment -ObjectId $objectId -Id $id -Princi ...
  •   + CategoryInfo          : NotSpecified: (:) [New-AzureADGroupAppRoleAssignment], ApiException
      + FullyQualifiedErrorId : Microsoft.Open.AzureAD16.Client.ApiException,Microsoft.Open.AzureAD16.PowerShell.NewGroupAppRoleAssignment
    

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

美煞众生 2025-02-20 21:08:39

这些是new-azureadgroupapproleassignment中的参数的正确值

ObjectId = Group object ID    
Id = App role ID    
PrincipalId = Group object ID    
ResourceId = Enterprise Application object ID

These are the correct values to use for the parameters in New-AzureADGroupAppRoleAssignment

ObjectId = Group object ID    
Id = App role ID    
PrincipalId = Group object ID    
ResourceId = Enterprise Application object ID
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文