Configure Azure PowerShell upgrade notifications

This article is designed to raise awareness about the new in-tool upgrade notification feature added to Azure PowerShell in Az PowerShell module version 10.3.0. This new feature notifies you when a new version of the Az PowerShell module is available.

An Azure subscription and the Az PowerShell module are required to follow along in the examples shown in this article.

Use the Get-AzConfig cmdlet with the CheckForUpgrade parameter to determine if upgrade notifications are enabled:

1Get-AzConfig -CheckForUpgrade
1Key             Value Applies To  Scope       Help Message
2----            ----- ----------- -----       ------------
3CheckForUpgrade False Az          CurrentUser When enabled, Azure PowerShell will check for updates
4                                              automatically and d...

Piping Get-AzConfig -CheckForUpgrade to Select-Object -Property * or Format-List -Property * returns all properties, including additional information:

1Get-AzConfig -CheckForUpgrade | Select-Object -Property *
1Key          : CheckForUpgrade
2Value        : True
3Scope        : CurrentUser
4AppliesTo    : Az
5HelpMessage  : When enabled, Azure PowerShell will check for updates automatically and display a
6               message when an update is available. The default value will be changed from false to
7               true in Az version 11.0.0.
8DefaultValue : False

Use the Update-AzConfig cmdlet with the CheckForUpgrade parameter and $true for its value to enable upgrade notifications:

1Update-AzConfig -CheckForUpgrade $true
1Key             Value Applies To  Scope       Help Message
2----            ----- ----------- -----       ------------
3CheckForUpgrade True  Az          CurrentUser When enabled, Azure PowerShell will check for updates
4                                              automatically and d...

Use the Update-AzConfig cmdlet with the CheckForUpgrade parameter and $false for its value to turn off upgrade notifications:

1Update-AzConfig -CheckForUpgrade $false
1Key             Value Applies To  Scope       Help Message
2----            ----- ----------- -----       ------------
3CheckForUpgrade False Az          CurrentUser When enabled, Azure PowerShell will check for updates
4                                              automatically and d...

Az version 10.3.0 also added the Set-AzConfig alias for the Update-AzConfig cmdlet.

The upgrade notification message is displayed in your interactive PowerShell session when using cmdlets from the Az PowerShell module. The following example shows the upgrade notification message that's displayed when a new version of the Az PowerShell module is available:

1(Get-AzResourceGroup).ResourceGroupName
1WARNING: You're using Az version 10.3.0. The latest version of Az is 10.4.1. Upgrade your Az modules
2         using the following commands:
3Update-Module Az -WhatIf -- Simulate updating your Az modules.
4Update-Module Az         -- Update your Az modules.
5cloud-shell-storage-southcentralus
6ResourceGroup01

You can configure granular settings for the upgrade notification feature in the $HOME/.Azure/AzPSFrequencyService.json configuration file. The following example shows the default settings:

1Get-Content -Path $HOME/.Azure/AzPSFrequencyService.json | ConvertFrom-Json -AsHashtable
1Name                           Value
2----                           -----
3VersionUpgradeCheck            {[Frequency, 2.00:00:00], [LastCheckTime, 10/2/2023 5:50:51AM]}
4VersionUpgradeNotification     {[Frequency, 30.00:00:00], [LastCheckTime, 10/2/2023 5:50:51AM]}

Summary

The Az PowerShell module is updated monthly, and it's easy to miss a new version being released. The new in-tool upgrade notification feature helps to ensure you're always using the latest version of Azure PowerShell.

References