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

Improved Error Handling when Connecting to Exchange with Managed Identity (#186) #187

Closed

Conversation

raandree
Copy link
Member

@raandree raandree commented Dec 3, 2024

This pull request includes several changes to improve error handling and code clarity in the MSCloudLoginAssistant module. The most important changes include adding try-catch blocks to handle potential exceptions, improving verbose logging, and updating conditional checks for string values.

Error Handling Improvements:

  • Modules/MSCloudLoginAssistant/MSCloudLoginAssistant.psm1: Added try-catch blocks to handle CommandNotFoundException and other exceptions when retrieving the initial domain using Get-MgDomain or Get-MgBetaDomain. This ensures that appropriate error messages are logged when exceptions occur.

Logging Enhancements:

Code Clarity:

  • Modules/MSCloudLoginAssistant/Workloads/ExchangeOnline.psm1: Updated the conditional check to use [string]::IsNullOrEmpty for better readability and to handle both null and empty string cases. Additionally, added error handling to log an error message and stop execution if the organization name cannot be retrieved.

This PR fixes #186.


This change is Reviewable

@ykuijs
Copy link
Member

ykuijs commented Dec 11, 2024

Hi @raandree, we just merged a large PR that now is causing some merge conflicts. Can you please update with dev and resolve the conflicts?

@raandree
Copy link
Member Author

image

@raandree raandree closed this Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Connect-M365Tenant cannot connect to ExchangeOnline with Managed Identity
2 participants