gpt4 book ai didi

具有全局管理员权限的 Azure AD 应用程序

转载 作者:行者123 更新时间:2023-12-02 07:34:10 26 4
gpt4 key购买 nike

因此,我尝试在 azure AD 上设置一个应用程序,该应用程序除其他功能外还可以删除用户。

我已注册应用程序并使用客户端 ID 和 secert 来获取访问 token 。

我能够授予应用程序创建用户的权限,并且工作正常,但是当我通过图形 API 进行删除时,我收到 403 权限不足,无法完成操作。

我正在通过图休息 API 尝试这个。我尝试删除的用户也是通过其余调用进行的。用户与应用程序位于同一租户中,因此我不会尝试从多个租户中删除用户。

看来我需要做的是给予应用程序全局管理员或公司管理员权限,但我正在旋转轮子在哪里和/或如何做到这一点。

如有任何帮助,我们将不胜感激。

最佳答案

看看我的回答 here .

You can elevate the level of access an Application has in your tenant by adding the service principal of that application to the Company Administrator Directory Role. This will give the Application the same level of permissions as the Company Administrator, who can do anything. You can follow these same instructions for any type of Directory Role depending on the level of access you want to give to this application.

Note that this will only affect the access your app has in your tenant.

Also you must already be a Company Administrator of the tenant to follow these instructions.

In order to make the change, you will need to install the Azure Active Directory PowerShell Module.

Once you have the module installed, authenticate to your tenant with your Administrator Account:

Connect-MSOLService

Then we need to get the Object ID of both the Service Principal we want to elevate, and the Company Administrator Role for your tenant.

Search for Service Principal by App ID GUID:

$sp = Get-MsolServicePrincipal -AppPrincipalId <App ID GUID>

Search for Directory Role by Name

$role = Get-MsolRole -RoleName "Company Administrator"

Now we can use the Add-MsolRoleMember command to add this role to the service principal.

Add-MsolRoleMember -RoleObjectId $role.ObjectId -RoleMemberType ServicePrincipal -RoleMemberObjectId $sp.ObjectId

To check everything is working, lets get back all the members of the Company Administrator role:

Get-MsolRoleMember -RoleObjectId $role.ObjectId

You should see your application in that list, where RoleMemberType is ServicePrincipal and DisplayName is the name of your application.

Now your application should be able to perform any Graph API calls that the Company Administrator could do, all without a user signed-in, using the Client Credential Flow.

请告诉我这是否有帮助!

关于具有全局管理员权限的 Azure AD 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42819826/

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