A few months ago in November 2023 PowerShell 7.2 was made “General Available” in Azure Automation. One important feature was yet missing from the documentation: deployment using Bicep or ARM templates.
As confirmed by Microsoft, the API was already supporting this behind the scenes.
Yes, both Bicep and ARM template support is available.
After I checked with a few people to no avail, Jan-Henrik finally gave my the right hint.
PowerShell 7.1 and API version 2023-11-01 are missing from the documentation
… the Azure REST API Specifications GitHub repository, that should also be the source of the documentation is up to date.
PowerShell72 as an option in the Azure REST API Specifications GitHub repo
Info
On 30.01.2024 the official documentation was updated. The runbookType PowerShell72 is now listed.
Deploy a PowerShell 7.2 runbook using bicep
And here is how you deploy a PowerShell 7.2 runbook:
paramautomationAccountNamestringparamlocationstring=resourceGroup().locationparamartifactsLocationstring='https://gist.githubusercontent.com/f-bader/aded6f8726a2a416b0e90e91c61b283f/raw/97fd92756038aa6440a5ce54c0c4c00725efdee1/'resourcemyAutomationAccount'Microsoft.Automation/automationAccounts@2022-08-08'existing={name:automationAccountNamescope:resourceGroup()}resourceexampleRunbookPowerShellCore'Microsoft.Automation/automationAccounts/runbooks@2023-11-01'={name:'exampleRunbookPowerShellCore'parent:myAutomationAccountlocation:locationproperties:{description:'Search for service principals and application to build a watchlist WorkloadIdentityInfo'runbookType:'PowerShell72'logProgress:falselogVerbose:falsepublishContentLink:{uri:uri(artifactsLocation,'justatest.ps1')version:'1.0.0.0'}}}
Deploy a PowerShell 7.2 module to Azure Automation
It also super simple to deploy a new PowerShell module or update an existing module for the PowerShell 7.2 runbooks.