Reputation: 3025
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
Upvotes: 3
Views: 4262
Reputation: 3025
I fixed my question using following PS command
Connect-AzureAD -TenantId '<TargetTenant>'
New-AzureADServicePrincipal -AppId 'ThirdPartyAppID'
Upvotes: 3
Reputation: 16438
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.
Upvotes: 1