Ron*_*erg 4 azure-active-directory
我在一个租户 ( OneTenant) 中有一个 Azure AD 服务主体,我想授予对另一个租户 ( OtherTenant) 中的应用程序的访问权限。
租户中的服务主体OneTenant是 Azure 逻辑应用的托管服务标识。所以我真正想要的是从我的逻辑应用程序调用 API。此 API 受OtherTenant.
应用程序OtherTenant定义了许多角色,服务主体OneTenant应该具有这些角色之一,以便它可以调用 API。
我尝试了以下方法:
OtherTenant为多租户运行以下 PS 命令以尝试将 SP 添加到应用程序中的角色:
New-AzureADServiceAppRoleAssignment `
-ObjectId <object-id-of-sp-in-one-tenant> `
-Id <role-id> `
-PrincipalId <object-id-of-sp-in-one-tenant> `
-ResourceId <app-id-in-other-tenant>
Run Code Online (Sandbox Code Playgroud)
(均已登录OneTenant和OtherTenant)
这给出了一个错误,指出无论是app-id-in-other-tenant还是object-id-of-sp-in-one-tenant不能,找到不同的地方我在我签字。
我还尝试OneTenant根据 app-id创建一个服务主体,OtherTenant在这种情况下,我收到一条错误消息:Authenticating principal does not have permission to instantiate multi-tenantapplications and there is not matching Applicationin the request tenant.
从您的问题中获取命令:
New-AzureADServiceAppRoleAssignment `
-ObjectId <object-id-of-sp-in-one-tenant> `
-Id <role-id> `
-PrincipalId <object-id-of-sp-in-one-tenant> `
-ResourceId <app-id-in-other-tenant>
Run Code Online (Sandbox Code Playgroud)
尝试更改最后一个参数值,即 ResourceId
目前你正在通过 <app-id-in-other-tenant>
将其替换为 <object-id-of-API-in-other-tenant>
好的,我终于开始测试Rohit Saigal 提出的解决方案是否有效。它确实指向了正确的方向,但并不完整。
第一步是在 中创建OneTenant代表应用程序的服务主体OtherTenant。因此,在登录后OneTenant,运行以下脚本:
$spInOneTenant = New-AzureADServicePrincipal -AppId <app-id-in-other-tenant>
Run Code Online (Sandbox Code Playgroud)
下一步是New-AzureADServiceAppRoleAssignment使用以下参数运行cmdlet:
New-AzureADServiceAppRoleAssignment `
-Id <role-id> `
-ObjectId <object-id-of-sp-in-one-tenant> `
-PrincipalId <object-id-of-sp-in-one-tenant> `
-ResourceId $spInOneTenant.ObjectId
Run Code Online (Sandbox Code Playgroud)
诀窍是使用您在上一步中创建的服务主体的对象 ID 作为ResourceId.
| 归档时间: |
|
| 查看次数: |
3872 次 |
| 最近记录: |