首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何修复失败的Azure-Powershell "hello world"-task,错误:找不到模块:'Az.Accounts‘,版本:'6.2.3’

如何修复失败的Azure-Powershell "hello world"-task,错误:找不到模块:'Az.Accounts‘,版本:'6.2.3’
EN

Stack Overflow用户
提问于 2019-09-28 16:51:35
回答 1查看 297关注 0票数 0

我正在设置Azure devops管道,我想在其中操作我的订阅中的资源。为此,我尝试使用AzurePowerShell任务。

我将我的尝试减少到一个最基本的hello world示例,该示例与我的订阅相关:

代码语言:javascript
复制
pool:
  vmImage: windows-2019
trigger: none

steps:
- task: AzurePowerShell@4
  displayName: 'hello world'
  inputs:
    azureSubscription: 'azure-connection-dev'
    azurePowerShellVersion: '6.2.3'
    inline: |
      Write-Output "Hello"
      Write-Output "world"

当我触发这个管道时,我希望管道打印"Hello world“,但结果却失败了

代码语言:javascript
复制
==============================================================================
Task         : Azure PowerShell
Description  : Run a PowerShell script within an Azure environment
Version      : 4.157.4
Author       : Microsoft Corporation
Help         : [Learn more about this task](https://go.microsoft.com/fwlink/?LinkID=613749)
==============================================================================
##[error]Could not find the modules: 'Az.Accounts' with Version: '6.2.3'. If the module was recently installed, retry after restarting the Azure 

上面的hello world示例有什么问题?

EN

回答 1

Stack Overflow用户

发布于 2019-09-29 00:57:41

错误消息明确地告诉您确切的问题:托管代理上没有Az 6.2.3。可用的版本是documented。如果你需要一个不是默认安装的版本,你需要先用Install-Module安装它。

Azure Powershell任务首先使用指定的服务连接登录到你的Azure订阅。由于您告诉它使用不可用的版本,因此它会尝试加载模块,但立即失败。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58144783

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档