Script to update all Azure Powershell Modules

Use this script to update all your Azure Powershell Modules to their latest versions.

Get-Module -Name azure* -ListAvailable |
  Where-Object -Property Name -ne 'AzureRM' |
  ForEach-Object {
    $currentVersion = [Version] $_.Version
    $newVersion = [Version] (Find-Module -Name $_.Name).Version
    if ($newVersion -gt $currentVersion) {
      Write-Host -Object "Updating $_ Module from $currentVersion to $newVersion"
      Update-Module -Name $_.Name -RequiredVersion $newVersion -Force
      Uninstall-Module -Name $_.Name -RequiredVersion $currentVersion -Force

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.