On the earth of software program growth, upgrading libraries and dependencies is commonly a necessity to maintain up with evolving applied sciences, safety patches, and enhanced functionalities.
Nonetheless, in some circumstances, it’s not all the time simple to right away bounce to the most recent model, particularly when coping with crucial elements like Microsoft Graph SDK.
Microsoft Graph SDK gives highly effective capabilities for integrating Microsoft providers into your purposes. However what occurs when it’s good to improve to a more recent model whereas nonetheless sustaining compatibility with present code? That is the place the technique of working older variations in parallel comes into play.
To improve Microsoft SDK use:
Set up-Module Microsoft.Graph -AllowClobber -Drive
Word: Microsoft has modified the beta module now you don’t have to make use of Choose-MgProfile beta
Simply set up the beta module
Set up-Module Microsoft.Graph.Beta -AllowClobber -Drive
Make the most of cmdlets by including beta key phrases like:
Get-MgBetaUser
Now downside comes after improve is that present scripts the place you have got particularly used beta endpoint with beneath command begins failing.
Choose-MgProfile beta
Error is à
Choose-MgProfile: The time period ‘Choose-MgProfile’ is just not acknowledged because the title of a cmdlet, perform, script file, or operable program.
Examine the spelling of the title, or if a path was included, confirm that the trail is appropriate and check out once more.
To resolve this subject, we have now to make the most of import module to load particular variations of the older graph module(v1) or absolutely examine the script the place Beta has been used and replace it.
What we have now accomplished is up to date our scripts as beneath to make them run in Parallel:
Earlier we have been not utilizing the import-module command as PowerShell was auto detecting the module however after improve it was all the time detecting the most recent model due to which error was getting generated , we browsed to all our scripts that have been utilizing beta profile and up to date in similar means.
One other such script that was utilizing gadget instructions.
Now the query arises, why we have now simply not accomplished beneath and loaded particular modules as an alternative of complete ?
Import-Module Microsoft.Graph -RequiredVersion 1.18.0
We tried it however each time scripts run it takes extra time on the import-module half which we didn’t like so we have now utilized the precise modules that we’re using within the script.
Thanks for studying…
Tech Wizard