Installing PowerShell Core & Azure CLI on MacOS

One of the most essential tools I’m a big believer in is that of the command line. I remember when starting out in the industry, all fresh-faced and that, I used to love a good gui which flowed well. But with the emergence of DevOps, automation and all things fashionable in the IT world, avoiding the command line is something you cannot do.

So to that end, I need to get these tools firstly on my Mac (which is where I do a lot of administration from, both for my lab and for Azure.

PowerShell

Heard of Homebrew? You will do if you use a Mac, and so will need to get this installed as it’s the preferred package manager for MacOS. If you have not installed yet, you can follow their instructions here.

When you have brew installed, you can install PowerShell from the terminal:

brew cask install powershell

Confirm that the install has worked successfully by loading PowerShell:

pwsh

Once loaded, you can also use the familiar command of checking the version installed:

$PSVersionTable

That’s it! You now have a working version of PowerShell on your Mac.

Azure CLI

If like me you’re delving into the world of Azure and aiming for certification, then you will also need the Azure CLI. This is another command tool used to administer your cloud environment, and is featured in the AZ-103 and AZ-104 exams.

One of the dependancies you will need is the Xcode command line developer tools:

xcode-select --install

This should prompt you to launch the install automatically. Once notified of it’s completion you can install the Azure CLI:

brew install azure-cli

This will begin to download and install the necessary packages. Once finished, you can login to Azure:

az login

Your default browser should then open prompting you to login to Azure. If it doesn’t, open a browser page at https://aka.ms/devicelogin and enter the authorization code displayed in your terminal window.

The packages can be updated frequently, so it is worth every couple of weeks running:

brew update && brew cask upgrade azure-cli

OR:

brew update && brew cask upgrade powershell
0

Leave A Comment

Your email address will not be published. Required fields are marked *