Azure Cli Alternative with Powershell on macOS

by | Feb 15, 2021 | Powershell

Last year I didn’t post much on my blog. So here again a post that is the first for this year. Let’s see if I can find the time to do more this year.

Recently I am kept busy with Microsoft Azure and often switch between Mac OS and Windows. PowerShell is working great on Windows machines but I found it helpfull to be able to edit and run the scripts also on Mac OS. Keep in mind that not all modules and commands are available on Mac OS, this is being improved over time.

To install PowerShell on Mac OS you can open an Terminal en run the command if you have Brew (https://brew.sh/) installed:

brew install powershell

After you have installed PowerShell you can start to switch to PowerShell in the Terminal with command:

pwsh

Most popular powershell commands are available, you can list them with ‘Get-Command’.

PowerShell module Az

Next step is to install the Azure PowerShell module, this will be the ‘core’ version that is compatible with PowerShell on Mac OS. Again, this will may not include all command. Run the following inside PowerShell:

Install-Module Az

This command will ask you to install from an untrusted repository, type Y (and enter) to continue. If you receive an error message that Administrator rights are needed, then exit the current PowerShell session and run PowerShell with ‘sudo pwsh’.

Once the module is installed you have to import it before you can run the commands:

Install-Module Az

Now the commands for managing Microsoft Azure are available and you can login with:

Login-AzAccount

When you run the ‘Get-Command’ now you will see many more commands are added for Microsoft Azure.

AzureRm commands

Some of you might be used to the Windows PowerShell command from the AzureRM module. Or maybe you have scripts already that are using some AzureRM command, for example ‘Get-AzureRmVm’ or ‘Get-AzureRmSubscriptions’. To make use of those commands you will need to run the following:

Enable-AzureRmAlias

Now you can run all the AzureRm command like in Windows Powershell.

Have fun with PowerShell on the MAC.

eighty data blog

Azure Static Webapps

Azure Static Webapps We are using Azure Static Webapps to host several apps & tooling developed for our customers. However how do you setup the hosting / deployment. In the upcoming series of blogs we will share some tips and tricks to setup that multi environment...

New office and branding!

New office and branding!

New office! This month we moved in to a brand new office located on Zomerdijk 2a in Maassluis. Having our own office is a major milestone which comes with many benefits. It allows us to work together even more closely on our projects, receive customers and hosts a...

Build ASP.NET Core webapp with Docker

Build ASP.NET Core webapp with Docker

It’s a time ago I wrote something on my blog, so it is time again. In this post I want to explain how I build Microsoft NET core applications in an docker container and run them also as an docker. Since some time also Microsoft SQL server is available in an Linux...