Azure PowerShell Module Az 7.4.0 released

Hi All,

Just a few Hours ago the new Microsoft Azure PowerShell Module AZ 7.4.0 has been released.

Microsoft Azure PowerShell Module Az 7.4.0


To check your installed Module and what Version is available in the PowerShell Gallery you can use the following commands

Get-InstalledModule AZ
Find-Module AZ


AZ is just a Wrapper - the Modules have names Az.*

Get-InstalledModule AZ.*


I've checked my installed Modules. It's a mess - multiple Versions of the Modules.

Get-Module AZ.* -ListAvailable


So i've written a short Script to cleanup.

The Script is also available on my GitHub Repo

###############################################################################
# Cleanup-AzModules.ps1
# If you have multiple Versions of AZ.* PowerShell Module installed
# This Scripts uninstalls the Old versions and installs only the Current Version
# 25.04.2022 V0.1 - Initial Draft - Andres Bohren
###############################################################################
#Script needs to Run as Administrator to uninstall/install PowerShell Modules
#Requires -RunAsAdministrator

#Remove loaded az.* Modules
Remove-Module az.*

#Iterate through Modules and uninstall
$Modules = Get-Module AZ.* -ListAvailable | Where {$_.Name -ne "Az.Accounts"} | Select-Object Name -Unique
Foreach ($Module in $Modules)
{
    $ModuleName = $Module.Name
    $Versions = Get-Module $ModuleName -ListAvailable
    Foreach ($Version in $Versions)
    {
        $ModuleVersion = $Version.Version
        Write-Host "Uninstall-Module $ModuleName $ModuleVersion"
        Uninstall-Module $ModuleName -RequiredVersion $ModuleVersion
    }
}
#Uninstall Az.Accounts
$ModuleName = "Az.Accounts"
$Versions = Get-Module $ModuleName -ListAvailable
Foreach ($Version in $Versions)
{
    $ModuleVersion = $Version.Version
    Write-Host "Uninstall-Module $ModuleName $ModuleVersion"
    Uninstall-Module $ModuleName -RequiredVersion $ModuleVersion
}

#Install newest Module
Write-Host "Install newest AZ Module"
Install-Module AZ
Write-Host "Cleanup finished"



It takes a while to uninstall all the old modules and then the newest Modules


Just wait until "Cleanup finished" appears



Regards
Andres Bohren