Search code examples
azureazure-active-directoryadal

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

Solution

  • I fixed my question using following PS command

    Connect-AzureAD -TenantId '<TargetTenant>'                                            
    
    New-AzureADServicePrincipal -AppId 'ThirdPartyAppID'