Update Microsoft.Graph Modules on Azure Automation with Managed Identity V2
Hi All,
Over a Year ago, i wrote an Article on how to Update the Microsoft.Graph PowerShell Modules on Azure Automate with ManagedIdentity
Why do you write an Article again?
There has been some improvements. With the AZ 11.2.0 released in January 2024 there was an update with the Az.Automation Module
- Az.Automation 1.10.0
- Updated Module operation cmdlets to support Powershell 7.2
I did publish an Article about that here
In Summary there are now Commandlets that allow to install, update and uninstall PowerShell 5.1 and PowerShell 7.2 Modules.
Update Microsoft.Graph Modules Runbook V2
The Azure Automation Account needs to have a System assigned Managed Identity
The Managed Identity needs to have “Contributor” Merpmissions on the Azure Automation Account
I’ve updated my Script for the Azure Runbook with running a PowerShell 7.2 Script
Requires Modules:
- PackageManagement
- PowerShellGet
- Az.Accounts 2.15.1
- Az.Automation 1.10.0
- PowerShellGet 2.2.5
- PackageManagement 1.4.8.1
Microsoft.Graph Modules bevore the update
Here is the state of the Microsoft.Graph Modules bevore the update
Running the Runbook
Now let’s run the PowerShell 7.2 runbook
The Microsoft.Graph.Authentication PowerShell Module needs to be installed/upgraded first, as it is the Prerequisit of all other Modules
Whent hat has suceeded, the other Modules can be installed
Same routine for the PowerShell 7.2 Version of the Microsoft.Graph Modules
At the End all the PowerShell Modules defined in the Array of the Azure Automation Runbook are updated for PowerShell 5.1 and PowerShell 7.2 to the latest version available from the PowerShell Gallery
The whole Runbook is available on my GitHub Repo AutomationAccount_UpdateGraphModulesV2.ps1
Regards
Andres Bohren