Skip to content

Powershell Setup


Admin Rights required

1. Install Powershell 7

Run this command


2. Update PowerShellGet

Install-PackageProvider -Name NuGet -Forces -scope AllUsers
Install-Module -Name PowerShellGet -Force -scope AllUsers
Update-Module -Name PowerShellGet -scope AllUsers

3. Install Module for Azure

Install the Powershell Modules you would like to use e.g.:

Install-Module -Name Az -AllowClobber -Force -scope AllUsers
Install-Module -Name AzureAD -AllowClobber -Force -scope AllUsers
Install-Module -Name PSScriptAnalyzer -AllowClobber -Force -scope AllUsers

Consider updating them from time to time with this command:

Update-Module -scope AllUsers -Force


Install powershell on Ubuntu 20.04

sudo apt update # Update the list of packages
sudo apt install -y wget apt-transport-https software-properties-common # Install pre-requisite packages.
wget -q # Download the Microsoft repository GPG keys
sudo dpkg -i packages-microsoft-prod.deb # Register the Microsoft repository GPG keys
sudo apt update # Update the list of products
sudo add-apt-repository universe # Enable the "universe" repositories
sudo apt install -y powershell # Install PowerShell
pwsh # Start PowerShell


Use the latest Modules

For example Az modules can be installed in various versions when updated. Follow these three steps to update, find old modules and delete all but the latest:

1. Update Az.Modules:

Update-Module -Name Az

2. Find out what versions you have installed

Get-InstalledModule -Name Az -AllVersions | Select-Object -Property Name, Version

3. Delete the older Module (or all and start over)

Install the module "Az.Tools.Installer" to be able to delete an older Az Module version:

Install-Module -Name Az.Tools.Installer
Uninstall-AzModule -Name Az