Before Installing the Azure cmdlets for PowerShell, it is recommended to upgrade it to the PowerShell version 7.X to leverage the new features.
To install the PowerShell cmdlets for Azure, you need to download and install the AZ module.
Install-Module -Name Az -AllowClobber -Scope CurrentUser
To install it for all the users,
Install-Module -Name Az -AllowClobber -Scope AllUsers
If the AzureRM module is already installed, you first need to uninstall it because both modules AzureRM and AZ cannot reside in the same console and the AzureRm module is going to decommission soon. So anyway we need to upgrade it to the latest AZ Module.
To uninstall the AzureRM module use command,
Uninstall-Module AzureRm -Force -Verbose