Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connect-M365Tenant cannot connect to ExchangeOnline with Managed Identity #186

Open
raandree opened this issue Dec 3, 2024 · 1 comment

Comments

@raandree
Copy link
Member

raandree commented Dec 3, 2024

When trying to connect to ExchangeOnline using Connect-M365Tenant

Connect-M365Tenant -Workload ExchangeOnline -Identity -TenantId MngEnvMCAP576786.onmicrosoft.com

you may get the following error:

Value cannot be null.
Parameter name: Organization cannot be null for Managed Identity based connections.
At C:\Program Files\WindowsPowerShell\Modules\ExchangeOnlineManagement\3.4.0\netFramework\ExchangeOnlineManagement.psm1:762 char:21
+                     throw $_.Exception.InnerException;
+                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [], ArgumentNullException
    + FullyQualifiedErrorId : Value cannot be null.
Parameter name: Organization cannot be null for Managed Identity based connections.

Unfortunately, the error handling obfuscates the real error.

In case of the error, Get-MSCloudLoginOrganizationName does not return anything.

Get-MSCloudLoginOrganizationName -Identity
@raandree
Copy link
Member Author

raandree commented Dec 3, 2024

Reason for this bug is that Get-MSCloudLoginOrganizationName uses Get-MgDomain internally. Get-MgDomain is defined in Microsoft.Graph.Identity.DirectoryManagement but this module is not a dependency of Microsoft365DSC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant