Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Next »

Run the code blocks in one of the following sections to update or install the latest version of the Azure PowerShell modules from the PSGallery: 

  • Update modules:

 Click here to expand...

This will perform the following actions for each PowerShell module:

  • Remove the modules from the current session if loaded

  • Update the module if installed and install the module if not

Define Azure PowerShell modules respecting dependency on Az.Accounts

$Modules, $BaseModule = (Get-Module -Name 'Az.*').Where({$_.Name -ne 'Az.Accounts'},[System.Management.Automation.WhereOperatorSelectionMode]::Split)

Unload Azure PowerShell modules respecting dependency on Az.Accounts

$Modules | ForEach-Object { Remove-Module -Name $_.Name -Force }; $BaseModule | ForEach-Object { Remove-Module -Name $_.Name -Force }

Update Azure PowerShell modules

Get-Module -ListAvailable -Name Az.* | ForEach-Object { Update-Module -Name $_.Name } 
  • Reinstall modules 

 Click here to expand...

This will perform the following actions for each PowerShell module:

  • Remove the modules from the current session if loaded

  • Remove the module files from the AllUsers scope

  • Install the modules from the PowerShell gallery

Define Azure PowerShell modules respecting dependency on Az.Accounts

$Modules, $BaseModule = (Get-Module -Name 'Az.*').Where({$_.Name -ne 'Az.Accounts'},[System.Management.Automation.WhereOperatorSelectionMode]::Split)

Unload Azure PowerShell modules respecting dependency on Az.Accounts

$Modules | ForEach-Object { Remove-Module -Name $_.Name -Force }; $BaseModule | ForEach-Object { Remove-Module -Name $_.Name -Force }

Remove Azure PowerShell modules

Get-ChildItem -Path "$env:ProgramFiles\WindowsPowerShell\Modules" -Filter 'Az.*' | Remove-Item -Recurse -Force

Install Azure PowerShell modules

Save-Module -Path "$env:ProgramFiles\WindowsPowerShell\Modules" -Name Az -Force

  • No labels