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 every 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:
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 maybe not include all command. Run the following inside PowerShell:
This command will ask you to install from an untrusted repository, type Y (and enter) to continue. If you receive a 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:
Now the commands for managing Microsoft Azure are available and you can login with:
When you run the ‘Get-Command’ now you will see many more commands are added for Microsoft Azure.
Some of you will 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:
Now you can run all the AzureRm command like in Windows Powershell.
Have fun with PowerShell on the MAC.