Error while using Test-OrganizationRelationship: "Object reference not set to an instance of an object"

m.lopiccolo 25 Reputation points
2024-01-05T11:17:14.63+00:00

Hi, I am trying to set a bidirectional Organization Relationship between two Microsoft 365 tenants.

I've set up the two relationships in the two tenants, with the necessary domains, but when I go to test it with the command Test-OrganizationRelationship it gives the same error from both tenants:

immagine

Am I doing something wrong?

Thank you

Microsoft Exchange Online
Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
4,752 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,816 questions
{count} votes

Accepted answer
  1. Yuki Sun-MSFT 41,216 Reputation points Microsoft Vendor
    2024-01-09T07:04:43.4833333+00:00

    Hi @m.lopiccolo ,

    This is the config, both are the same, except of course for the domains.

    I compared it with the configuration on my end and noticed that the TargetApplicationUri and TargetAutodiscoverEpr are empty in your output:
    User's image

    Could you try updating your configuration by including these settings and check the result?
    You can refer the instructions in this link.
    User's image

    1 person found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. m.lopiccolo 25 Reputation points
    2024-01-08T07:47:20.6633333+00:00

    Hi @Hiroyuki Sunaga and @Vasil Michev

    I confirm that I've created the relationship in both tenants.

    When I run the command with -Verbose and -Debug this is what I get:

    immagine

    I get the same in both tenants.

    Maybe I did something wrong when creating the relationships? But it seems pretty straightforward...

    0 comments No comments

  2. Yuki Sun-MSFT 41,216 Reputation points Microsoft Vendor
    2024-01-08T09:07:43.9433333+00:00

    Hi @m.lopiccolo ,

    I tested further and realized that in my case, the error in my test earlier is not due to the configuration on the remote organization. It actually depends on whether the organization identity is provided in the commend.

    User's image

    User's image

    Could you try the syntax below from your end and see how it goes?

    Get-OrganizationRelationship <OrganizationRelationshipIdParameter> | Test-OrganizationRelationship -UserIdentity <RecipientIdParameter>
    
    

    If error persists, would you confirm the things below?

    1. Despite of the error message, does the configuration actually work for both tenants?
    2. Are there any additional information in your output?

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.