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
Thanks for the reply FadySamy. Where did you get the info that MSGraph powershell will be discontinued? That's news to me, and I can't find anything about it in Microsoft docs. It is after all, fairly new in itself. I might misunderstand you, but from what I can tell, the Microsoft Graph module is not going anywhere.
The code you provide works in the scenario where you want a specific B2B relationship trust, which is really not what I am after here, but thank you anyways!