For quite some time now, PowerShell (which was originally a Windows-only component) has been open source and cross-platform.
This means you can now use it on Mac OS as well as on all the many different flavors and distributions of Linux.
I have previously written about how to install Azure PowerShell on Windows. Now, you can do the same for Linux.
Here’s how to install PowerShell Core followed by Azure PowerShell on your Ubuntu machine…
Installing PowerShell Core On Ubuntu
# Download the GNU Privacy Guard (GnuPG or GPG) keys wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb # Register the GPG keys from the Microsoft repository sudo dpkg -i packages-microsoft-prod.deb # Routine update of packages sudo apt-get update # Now, enable the "universe" repos sudo add-apt-repository universe # Install PowerShell Core sudo apt-get install -y powershell # Routine upgrade of package sudo apt-get upgrade powershell
This process was tested on Ubuntu 18.04.
If you’re installing PowerShell on Ubuntu 16.04, replace the text 18.04 with 16.04 on this line:
wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
Now, let’s install Azure PowerShell…
Installing Azure PowerShell
# Run PowerShell pwsh # Install the PowerShell Az module Install-Module -Name Az -AllowClobber # Import the Az module to your profile # Note that this module is ONLY available on YOUR profile (that is the profile used to run these commands) Import-Module Az # Exit PowerShell exit