如何创建多租户应用程序的服务主体
How to create Service Principal of Multi-tenant Application
我创建了启用多租户的新 Azure AAD 应用程序。但我无法在另一个租户 ID 中找到 App。当我尝试在另一个 Tenant.It 中创建上述 App ID 的服务主体时失败并出现错误 "New-AzureRmADServicePrincipal : When using this permission, the backing application of the service principal being created must in the local tenant" 。有没有人遇到过这样的问题。
$StartDate = [DateTime]::UtcNow
$EndDate = [DateTime]::UtcNow.AddYears(3)
$secureString = convertto-securestring "XXXXXXXXX" -asplaintext -force
New-AzureRmADServicePrincipal -ApplicationId "XXXXXXXXXX" -Password $secureString -StartDate $StartDate -EndDate $EndDate
我无法重现此错误。 New-AzureRmADServicePrincipal -ApplicationId "XXXXXXXXXX"
我可以在另一个租户中创建企业应用程序。
如果你想将多租户应用程序添加到另一个租户中,还有另一种方法。你可以试试 admin consent.
我假设您的应用已在 tenant_x 中注册并希望将其添加到 tenant_y。
您可以将用户重定向到 Microsoft 标识平台管理员同意终结点。
GET https://login.microsoftonline.com/{tenant_y}/v2.0/adminconsent?
client_id={client id}
&state=12345
&redirect_uri={redirect_uri}
&scope=
https://graph.microsoft.com/calendars.read
https://graph.microsoft.com/mail.send
在浏览器中访问它并使用 tenant_y 的管理员帐户登录以获得管理员同意。之后,该应用程序将被添加到 tenant_y.
我使用以下 PS 命令解决了我的问题
Connect-AzureAD -TenantId '<TargetTenant>'
New-AzureADServicePrincipal -AppId 'ThirdPartyAppID'
我创建了启用多租户的新 Azure AAD 应用程序。但我无法在另一个租户 ID 中找到 App。当我尝试在另一个 Tenant.It 中创建上述 App ID 的服务主体时失败并出现错误 "New-AzureRmADServicePrincipal : When using this permission, the backing application of the service principal being created must in the local tenant" 。有没有人遇到过这样的问题。
$StartDate = [DateTime]::UtcNow
$EndDate = [DateTime]::UtcNow.AddYears(3)
$secureString = convertto-securestring "XXXXXXXXX" -asplaintext -force
New-AzureRmADServicePrincipal -ApplicationId "XXXXXXXXXX" -Password $secureString -StartDate $StartDate -EndDate $EndDate
我无法重现此错误。 New-AzureRmADServicePrincipal -ApplicationId "XXXXXXXXXX"
我可以在另一个租户中创建企业应用程序。
如果你想将多租户应用程序添加到另一个租户中,还有另一种方法。你可以试试 admin consent.
我假设您的应用已在 tenant_x 中注册并希望将其添加到 tenant_y。
您可以将用户重定向到 Microsoft 标识平台管理员同意终结点。
GET https://login.microsoftonline.com/{tenant_y}/v2.0/adminconsent?
client_id={client id}
&state=12345
&redirect_uri={redirect_uri}
&scope=
https://graph.microsoft.com/calendars.read
https://graph.microsoft.com/mail.send
在浏览器中访问它并使用 tenant_y 的管理员帐户登录以获得管理员同意。之后,该应用程序将被添加到 tenant_y.
我使用以下 PS 命令解决了我的问题
Connect-AzureAD -TenantId '<TargetTenant>'
New-AzureADServicePrincipal -AppId 'ThirdPartyAppID'