For system, network and cloud administrators

How to verify if the Az PowerShell module is installed and imported

Az stands for the formal Azure PowerShell module containing cmdlets for Azure features. The following PowerShell code will search for the Az module and if it will not find it installed, it will with all of its dependencies. And then, it ill import it into the session.

if (-not (Get-Module Az -ListAvailable)) {
 Install-Module Az -Scope CurrentUser -Force -Verbose
 Import-Module -Name Az -Verbose
}
else { 
 Import-Module -Name Az -Verbose
}