Oct 21 2022 04:24 AM
We are getting attached error while creating new relationship with target tenant for cross tenant mailbox migration.
PS C:\WINDOWS\system32> $sourceTenantId="349f849d-29cd-4981-be5b-356a1a46ba45"
$orgrels=Get-OrganizationRelationship
$existingOrgRel = $orgrels | ?{$_.DomainNames -like $sourceTenantId}
If ($null -ne $existingOrgRel)
{
Set-OrganizationRelationship $existingOrgRel.Name -Enabled:$true -MailboxMoveEnabled:$true -MailboxMoveCapability Inbound
}
If ($null -eq $existingOrgRel)
{
New-OrganizationRelationship "MaiboxMigration" -Enabled:$true -MailboxMoveEnabled:$true -MailboxMoveCapability Inbound -DomainNames $sourceTenantId
}
The command you tried to run isn't currently allowed in your organization. To run this command, you first need to run the command: Enable-OrganizationCustomization.
+ CategoryInfo : NotSpecified: (:) [New-OrganizationRelationship], InvalidOperatio...ontextException
+ FullyQualifiedErrorId : [Server=PN3PR01MB6965,RequestId=3cb6f3db-37e0-42cb-b101-d965fc997f66,TimeStamp=21-10-2022 11:16:16] [FailureCategory=Cmdlet-InvalidOperati
onInDehydratedContextException] D04D3255,Microsoft.Exchange.Management.SystemConfigurationTasks.NewOrganizationRelationship
+ PSComputerName : outlook.office365.com
PS C:\WINDOWS\system32> Enable-OrganizationCustomization
This operation is not required. Organization is already enabled for customization.
+ CategoryInfo : NotSpecified: (:) [Enable-OrganizationCustomization], InvalidOperationException
+ FullyQualifiedErrorId : [Server=PN3PR01MB6965,RequestId=ae9bb759-e489-41b7-b026-a46657461465,TimeStamp=21-10-2022 11:16:33] [FailureCategory=Cmdlet-InvalidOperati
onException] 27C5555F,Microsoft.Exchange.Management.Deployment.EnableOrganizationCustomizationTask
+ PSComputerName : outlook.office365.com
PS C:\WINDOWS\system32> $sourceTenantId="349f849d-29cd-4981-be5b-356a1a46ba45"
$orgrels=Get-OrganizationRelationship
$existingOrgRel = $orgrels | ?{$_.DomainNames -like $sourceTenantId}
If ($null -ne $existingOrgRel)
{
Set-OrganizationRelationship $existingOrgRel.Name -Enabled:$true -MailboxMoveEnabled:$true -MailboxMoveCapability Inbound
}
If ($null -eq $existingOrgRel)
{
New-OrganizationRelationship "MaiboxMigration" -Enabled:$true -MailboxMoveEnabled:$true -MailboxMoveCapability Inbound -DomainNames $sourceTenantId
}
The command you tried to run isn't currently allowed in your organization. To run this command, you first need to run the command: Enable-OrganizationCustomization.
+ CategoryInfo : NotSpecified: (:) [New-OrganizationRelationship], InvalidOperatio...ontextException
+ FullyQualifiedErrorId : [Server=PN3PR01MB6965,RequestId=bde720b0-ce41-4963-addf-920c40c418c3,TimeStamp=21-10-2022 11:20:27] [FailureCategory=Cmdlet-InvalidOperati
onInDehydratedContextException] D04D3255,Microsoft.Exchange.Management.SystemConfigurationTasks.NewOrganizationRelationship
+ PSComputerName : outlook.office365.com
PS C:\WINDOWS\system32>
Oct 21 2022 04:51 PM - edited Oct 21 2022 04:58 PM
This isn't a PowerShell issue, it's an Exchange Online issue.
One generic pointer would be to ensure you're using a recent version of the ExchangeOnlineManagement module (currently on version 3.0.0.)
If you run the following commandlet and it returns True, then Enable-OrganizationCustomization isn't producing the expected result.
But if it returns False then I'd suggest you either need to ask in an Exchange forum (if you're not in a hurry) or lodge a Microsoft Premier Support request (if you are.)
(Get-OrganizationConfig).IsDehydrated
Cheers,
Lain
Edited for a correction.