Microsoft Graph PowerShell SDK v2 upgrade

A few days ago the new version of the Microsoft Graph PowerShell SDK module v2 was released. The team blogged about the module and shared more info:

Upgrade to Microsoft Graph PowerShell SDK v2, now generally available

Everything looks easy and makes you feel confident that this is an easy upgrade process. But not only me also teammates and other MVPs had other experiences.

Read more: Microsoft Graph PowerShell SDK v2 upgrade

What happened?

You should always keep your machine up-to-date. And so you should also keep your PowerShell modules at the latest bits.
Note: In prod environments I highly recommend to use only GA releases!
I knew that I had to update one of my mahines and used the Cmdlet Update-Module for this task. I didn’t pay attention and did n ot expect to be upgraded to v2.
First everything looked good and I experienced no issues, yet.

Until I tried to elevate my administrative account and use the Cmdlet Get-MgRoleManagementDirectoryRoleDefinition. All I got was the following error:

Almost at the same time I was approached by teammates, which suffered either the same or other errors from this module.

I also asked the community and received also various feedback about errors or not to use v1 and v2 side-by-side (even it’s explicitly supported!).

Fixing the issue

Long story short: to fix the issue perform the following steps:

  • uninstall all Microsoft Graph PowerShell SDK v1 modules (this includes user and machine-wide installations!)
    Note: Using the Cmdlet Uninstall-Module can take a very long time, which is a known issue!
  • reboot your machine
  • install the lates module from PowerShell Gallery
  • reboot your machine

That’s it.

Conclusion

There can always be an issue with software. That’s why you should properly test new versions before upgrading to a new one. However, Microsoft should spent more time for quality management. Maybe just me, but the number of revoked or broken updates is increasing (besides outages of certain services!).

Leave a comment