简体   繁体   中英

How to create Service Principal of Multi-tenant Application

I have created new Azure AAD Application with Multi-tenant enabled. But i Couldn't find App in another tenant ID. When i try to create a Service Principal of above App ID in another Tenant.It is failing with error "New-AzureRmADServicePrincipal : When using this permission, the backing application of the service principal being created must in the local tenant" . Has anyone experience such issue.

$StartDate = [DateTime]::UtcNow                                                                
$EndDate = [DateTime]::UtcNow.AddYears(3)                                                 
$secureString = convertto-securestring "XXXXXXXXX" -asplaintext -force                             
New-AzureRmADServicePrincipal -ApplicationId "XXXXXXXXXX" -Password $secureString -StartDate $StartDate -EndDate $EndDate

I couldn't reproduce this error. New-AzureRmADServicePrincipal -ApplicationId "XXXXXXXXXX" works fine for me to create the enterprise app in another tenant.

If you want to add the multi-tenant app into another tenant, there is another way. You can have a try with the admin consent .

I assume that your app is registered in tenant_x and want to add it into tenant_y.

You can redirect the user to the Microsoft identity platform admin consent endpoint.

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

Access it in a broswer and log in with an admin account of tenant_y to do the admin consent. After that the app will be added into tenant_y.

I fixed my question using following PS command

Connect-AzureAD -TenantId '<TargetTenant>'                                            

New-AzureADServicePrincipal -AppId 'ThirdPartyAppID'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM