0

我正在尝试使用 bash 进行 ARM 部署,但出现此错误

ArgumentUsageError: argument --template-uri/-u: expected one argument

我在这里做错了什么?

- task: AzureCLI@2
  inputs:
    azureSubscription: 'Pay-As-You-Go'
    scriptType: 'bash'
    scriptLocation: 'inlineScript'
    inlineScript: |
      armTemplateURI=$('https://xxxx.blob.core.windows.net/temp/Function-Deployment.json?'$(SASTOKEN))
      packageURI=$('https://xxxxx.blob.core.windows.net/fileupload/PrdFunctions.zip?'$(SASTOKEN))
      output=$(az deployment group create --name "Function-Deployment" --resource-group "rg-dev-xxxx" --template-uri $armTemplateURI --parameters appName="fapp-dev-xxxx" storageName="stgdevxxxx" location="Australia East" cosmosName="cosmos-xxxx" msdeployPackageUrl=$packageURI)
4

1 回答 1

0

如我所见,文档设置秘密变量显示了以安全方式设置秘密的方法。而在 bash 中,您不需要使用 将$()字符串设置为变量的值。所以对你来说正确的方法应该是这样的:

- task: AzureCLI@2
    inputs:
        azureSubscription: 'Pay-As-You-Go'
        scriptType: 'bash'
        scriptLocation: 'inlineScript'
        inlineScript: |
            armTemplateURI='https://xxxx.blob.core.windows.net/temp/Function-Deployment.json?'$MY_SASTOKEN
            packageURI='https://xxxxx.blob.core.windows.net/fileupload/PrdFunctions.zip?'$MY_SASTOKEN
            output=$(az deployment group create --name "Function-Deployment" --resource-group "rg-dev-xxxx" --template-uri $armTemplateURI --parameters appName="fapp-dev-xxxx" storageName="stgdevxxxx" location="Australia East" cosmosName="cosmos-xxxx" msdeployPackageUrl=$packageURI)
        env: 
            MY_SASTOKEN: $(SASTOKEN)
于 2021-01-13T06:07:17.973 回答