简体   繁体   中英

Azure Az PowerShell module on macOS

I am trying to work with some ARM templates in Azure and I am completing some Microsoft exercises dedicated to ARM templates. Even though I have Powershell installed on my mac(M1 air with os Monterey v12.4) I can not install the Azure Az PowerShell module and therefore cannot work with ARM templates like I would like to.

My Powershell should work, at least from what I can see. When I use the command $PSversionTable I get this output: Powershell版本说明

When I navigated to Microsoft documentation that is dedicated to installing this module ( https://docs.microsoft.com/en-us/powershell/azure/install-az-ps?view=azps-8.1.0 ) I concluded that I am okay with the requirements (I have PWSH 7.1.3+).

When I executed the command Get-ExecutionPolicy -List I got this result: 评分 ExecutionPolicy 输出

In this section, they also write that

PowerShell script execution policy must be set to remote signed or less restrictive

which I guess I do have since I have Unrestricted everywhere. And also even if I wanted to set it to Remote signed I am not able to because if I execute this command Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser I get this output Set-ExecutionPolicy: Operation is not supported on this platform.

So when I finally tried to install the module with this command from the MS website Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force I got this: 未找到匹配项以及模块列表

I have tried to figure out why I do have only one module listed there and also why I am not able to install the Az Powershell module but I was not able to find the answer. Do you have any idea what could be wrong here?

In your mac machine if you already have a .NET SDK you can follow the below steps to install the Az PowerShell Module

  • Install the dotnet core latest stable version in your Mac

  • Install the PowerShell Core using below .NET command

dotnet tool install --global PowerShell 

After installing the PowerShell core we can use the pwsh command

  • Install Az PowerShell Module using below command
Install-Module -Name Az -AllowClobber -Scope CurrentUser

IF you don't have the .NET SDK in your machine, you can refer this for more information

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM