在管道中使用AzureCLI任务时出错 [英] Error using the AzureCLI task in pipeline

查看:49
本文介绍了在管道中使用AzureCLI任务时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Azure管道使用了 Azure CLI 任务

My Azure pipeline makes use of the Azure CLI task

- task: AzureCLI@2
    inputs:
      azureSubscription: '...'
      scriptType: pscore
      scriptLocation: 'inlineScript'
      inlineScript: |
        containers=$(az storage container list --connection-string '...')

任务失败,出现以下错误:

The task fails with this error:

The term 'containers=$(az storage container list --connection-string '...')' 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 D:\a\_temp\azureclitaskscript1582829158619_inlinescript.ps1:1 char:1
+ containers=$(az storage container list --connection-string 'DefaultEn ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (containers=$(az sto\u2026ame}" --output tsv):String) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : CommandNotFoundException

##[error]Script failed with error: Error: The process 'C:\Program Files\PowerShell\6\pwsh.exe' failed with exit code 1
C:\windows\system32\cmd.exe /D /S /C ""C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" account clear"
Finishing: AzureCLI

我不知道为什么会发生.

I can't figure out why it happens.

推荐答案

在这种情况下,此问题是由于语法错误引起的:

in this case the issue was due to a syntax mistake:

$containers=$(az storage container list --connection-string '...')

这篇关于在管道中使用AzureCLI任务时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆