September 29, 2020

Powershell on MacOS

Powershell on MacOS

Install pre-requisites:

xcode-select –install
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install openssl

Install Powershell Core:

brew cask install powershell

After the installation, start Powershell from the terminal by running pwsh.

Check the version:

$PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.0.3
PSEdition                      Core
GitCommitId                    7.0.3
OS                             Darwin 19.6.0 Darwin Kernel Version 19.6.0: Mon Aug 31 22:12:52 PDT 2020; root:xnu-6153.141.2~1/RELEASE_X86_64
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Get the Azure module:

Install-Module -Name Az -AllowClobber

Once installed, run Connect-AzAccount and follow the on-screen instructions.

Documents/Hello>  Connect-AzAccount                                         WARNING: To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code ≤CODE≥ to authenticate.