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.
- First download the PowerShell package for mac from here
- After you download run the setup on the mac. (Make sure you allow the packages from 3rd party sources.)
- Once it is installed launch the terminal and type in PowerShell.
-
Then launch the below command on the PowerShell window.Install-Module AzureRM.NetCore.Preview -Scope CurrentUser
- 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
- After the installation is complete Download the Dot Net core SDK for Mac from this link and complete the setup.
- Following the successful dot net setup run the below command to verify the AzureRm PowerShell is functional.
Import-Module AzureRM.NetCore.Preview - Then enter Login-AzureRMAccount to connect to your Azure portal.
- Open your browser and enter the url “https://aka.ms/devvicelogin” and enter the code shown above to authenticate with the portal.
- Once its successfully authenticated you will see on the browser as below and on the terminal you will see the portal details.
- 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!
Hi there,
I’ve just tried following the above steps and still get the “The term ‘Login-AzureRMAccount’ is not recognized as the name of a cmdlet, function, script file, or operable program.” error.
Can you please help?
Can you check if all the modules are installed with the command Get-Module -List
Post the powershell version as well?
Hi, tried to follow your tutorial with no luck
1st issue
Install-Module AzureRM.NetCore.Preview -Scope CurrentUser
PackageManagement\Install-Package : No match was found for the specified search criteria and module name ‘AzureRM.NetCore.Preview’. Try Get-PSRepository to see all available registered module repositories.
+ … $null = PackageManagement\Install-Package @PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Microsoft.PowerShel\u2026lets.InstallPackage:InstallPackage) [Install-Package], Exception
Solution: i tried to install the following
https://www.powershellgallery.com/packages/AzureRM.Netcore/0.13.2
2nd issue
Import-Module AzureRM.NetCore
WARNING: AzureRM.Netcore has been deprecated. Use the ‘Az’ module instead. The ‘Az’ module is avalable from the PSGallery https://www.powershellgallery.com/packages/Az/. You can find information about getting started with ‘Az’ at https://docs.microsoft.com/en-us/powershell/azure/new-azureps-module-az. To uninstall AzureRM.Netcore you can use the provided ‘Uninstall-AzureRMNetcore’ cmdlet.
3rd issue
Login-AzureRMAccount
Login-AzureRMAccount : The term ‘Login-AzureRMAccount’ is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Login-AzureRMAccount
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Login-AzureRMAccount:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I typed the Get-Module -List
And there are all the modules listed.
I think the AZ modules are overriding the past modules quickly. I was just trying to follow also the tutorial:
https://docs.microsoft.com/en-us/azure/cloud-services/cloud-services-nodejs-develop-deploy-express-app
But when i get to the
New-AzureServiceProject expressapp
It crashes:
4th issue
The term ‘New-AzureServiceProject’ is not recognized as the name of a cmdlet, function, script file, or operable program.
Any update or suggestion will be appreciated.
What is your MAC version?
Hi Renjith ,
I have similar issue. My Mac Version is 10.14.3