Working with Azure PowerShell on Mac

Since PowerShell announced as open source it has support on Linux and Mac as well and the extended support makes below possible.

  • Managing Azure using PowerShell from Linux or Mac
  • Managing Linux and Windows Containers with Docker
  • Native Linux Management with PowerShell
  • Manage AWS using PowerShell from Linux
  • Manage VMware using PowerShell from linux

Today we will look at how to install the PowerShell on Mac.

  1. First download the PowerShell package for mac from here
  2. After you download run the setup on the mac. (Make sure you allow the packages from 3rd party sources.)
  3. Once it is installed launch the terminal and type in PowerShell.
  4. Then launch the below command on the PowerShell window.Install-Module AzureRM.NetCore.Preview -Scope CurrentUser

  5. If you don’t mention the -scopeCurrent user it will throw an error message as below.  PackageManagement\Install-Package : Administrator rights are required to instal l or update. Log on to the computer with an account that has Administrator righ ts, and then try again, or install by adding “-Scope CurrentUser” to your comma nd. You can also try running the Windows PowerShell session with elevated right s (Run as Administrator).                                                       At /usr/local/microsoft/powershell/6.0.0-beta.7/Modules/PowerShellGet/1.1.3.2/P SModule.psm1:1867 char:21                                                       + …          $null = PackageManagement\Install-Package @PSBoundParameters     +                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~         + CategoryInfo          : InvalidArgument: (System.Collections.ArrayList:S     tring) [Install-Package], Exception                                              + FullyQualifiedErrorId : AdministratorRightsNeededOrSpecifyCurrentUserSco     pe,Copy-Module,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage       
  6. After the installation is complete Download the Dot Net core SDK for Mac from this link and complete the setup.
  7. Following the successful dot net setup run the below command to verify the AzureRm PowerShell is functional.
    Import-Module AzureRM.NetCore.Preview
  8. Then enter Login-AzureRMAccount to connect to your Azure portal.
  9. Open your browser and enter the url “https://aka.ms/devvicelogin” and enter the code shown above to authenticate with the portal.
  10. Once its successfully authenticated you will see on the browser as below and on the terminal you will see the portal details.
  11. From here you can launch your AzureRM PowerShell commands and manage your portal.

I hope it was informative . Let me know your feedback on this by commenting below!

Leave a Reply

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