Azure管道ARM部署任务YAML多行 [英] Azure pipelines ARM deployment task YAML multiline

查看:48
本文介绍了Azure管道ARM部署任务YAML多行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在Azure Pipelines任务的YAML中使用 multiline ?例如,对于ARM部署任务,有一个 overrideParameters 属性.如果可以跨多行拆分而不是将所有内容放在一行中,那就太好了

Is it possible to use multiline in YAML in Azure Pipelines tasks? For instance for the ARM deployment task, there is an overrideParameters property. It would be nice if this could be split accross several lines instead of putting everything in one line:

- task: AzureResourceManagerTemplateDeployment@3
          displayName: 'ARM deploy MyFunctionAPP'
          inputs:
            deploymentScope: 'Resource Group'
            azureResourceManagerConnection: ${{ parameters.serviceConnection }}
            subscriptionId: ${{ parameters.subscriptionId }}
            action: 'Create Or Update Resource Group'
            resourceGroupName: ${{ parameters.resourceGroupName }}
            location: 'West Europe'
            templateLocation: 'Linked artifact'
            csmFile: '$(ARMtemplatesPath)\MyFunctionAPP\template.json'
            csmParametersFile: '$(ARMtemplatesPath)\MyFunctionAPP\parameters.json'
            deploymentMode: 'Incremental'
            overrideParameters: '-environment_name ${{ parameters.environmentName }} -vnetAddressPrefix ${{ parameters.vnetAddressPrefix }} -subnet1Prefix ${{ parameters.subnet1Prefix }} -APIkey ${{ parameters.APIkey }} -queueName ${{ parameters.queueNameMyQueue }} -SendGridAPIkey ${{ parameters.SendGridAPIkey }} -StorageConnectionAppSetting ${{ parameters.StorageConnectionAppSetting }}'

是否可以在多行上拆分overrideParameters值?

Is it somehow possible to split the overrideParameters values on multiple lines?

推荐答案

这对我有用:

overrideParameters: >-
  -environment_name "${{ parameters.environmentName }}" 
  -vnetAddressPrefix "${{ parameters.vnetAddressPrefix }}" 
  -subnet1Prefix "${{ parameters.subnet1Prefix }}"
  -APIkey "${{ parameters.APIkey }}"
  -queueName "${{ parameters.queueNameMyQueue }}" 
  -SendGridAPIkey "${{ parameters.SendGridAPIkey }}"
  -StorageConnectionAppSetting "${{ parameters.StorageConnectionAppSetting }}"

因此,在一行上使用>-,然后使用双引号将设置值引起来.

So using >- on a single line and then using double-quotes to surround settings values works.

这篇关于Azure管道ARM部署任务YAML多行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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