Forum Discussion
Adding connected organizations with powershell
Hi, it appears that this is a known issue when using Azure AD or MSOnline PowerShell modules, which will be discontinued. Instead, please use the Microsoft Graph API.
Please check this article:
https://learn.microsoft.com/en-us/powershell/module/microsoft.graph.identity.signins/update-mgpolicycrosstenantaccesspolicypartner?view=graph-powershell-1.0
This could also be helpful. Perhaps it requires updates. Before making any changes, it’s best to test it first:
Install-Module Microsoft.Graph -Scope CurrentUser
Import-Module Microsoft.Graph
Connect-MgGraph -Scopes "Policy.ReadWrite.CrossTenantAccess", "Directory.Read.All"
#Set up the tenantId first (resolve via Get-MgDomain)
$tenantId = "external-tenant-guid" (Must be the GUID)#Add the org
$params = @{
B2bCollaborationInbound = @{ isEnabled = $true }
B2bCollaborationOutbound = @{ isEnabled = $true }
IdentitySynchronization = @{ isEnabled = $false }
InboundTrust = @{
isCompliantDeviceAccepted = $false
isHybridAzureADJoinedDeviceAccepted = $false
isMfaAccepted = $false
}
}Update-MgPolicyCrossTenantAccessPolicyPartner -TenantId $tenantId -BodyParameter $params