我正在设置Azure devops管道,我想在其中操作我的订阅中的资源。为此,我尝试使用AzurePowerShell任务。
我将我的尝试减少到一个最基本的hello world示例,该示例与我的订阅相关:
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“,但结果却失败了
==============================================================================
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示例有什么问题?
发布于 2019-09-29 00:57:41
错误消息明确地告诉您确切的问题:托管代理上没有Az 6.2.3。可用的版本是documented。如果你需要一个不是默认安装的版本,你需要先用Install-Module安装它。
Azure Powershell任务首先使用指定的服务连接登录到你的Azure订阅。由于您告诉它使用不可用的版本,因此它会尝试加载模块,但立即失败。
https://stackoverflow.com/questions/58144783
复制相似问题