Azure devops Azure数据工厂-更新集成管道中的环境变量

Azure devops Azure数据工厂-更新集成管道中的环境变量,azure-devops,azure-data-factory,azure-resource-manager,Azure Devops,Azure Data Factory,Azure Resource Manager,我最近开始使用ARM和Azure Data Factory,现在我在尝试将ADF部署到其他环境时遇到了一个问题。因为源连接字符串在每个环境中都是不同的,我不能在adf.content.parameters.json文件中保留静态值。 因此,我为每个环境创建了三个YML文件,分别为Dev.YML、Test.YML和Prod.YML。我有三份档案 adf.content.json adf.content.parameters.json Dev.yml、test.yml和prod.yml 在文件adf

我最近开始使用ARM和Azure Data Factory,现在我在尝试将ADF部署到其他环境时遇到了一个问题。因为源连接字符串在每个环境中都是不同的,我不能在adf.content.parameters.json文件中保留静态值。 因此,我为每个环境创建了三个YML文件,分别为Dev.YML、Test.YML和Prod.YML。我有三份档案

  • adf.content.json
  • adf.content.parameters.json
  • Dev.yml、test.yml和prod.yml
  • 在文件adf.content.json中,我有一个连接字符串作为源。此值在每个环境中都会发生变化。以下是adf.content.parameters.json

    "parameters": {
    "source_connectionString": {
      "type": "secureString",
      "metadata": "Secure string for 'connectionString' of 'source-db'"
    },
    
    我从adf.content.parameters.json中删除了这个参数,但是我把它添加到了Dev.yml文件中,看起来像这个(Test.yml和prod.yml是相同的,只是值不同)

    在我的ci-deply.yml文件中,如下所示

    task: AzureResourceGroupDeployment@2
              displayName: "Deploy Azure Data Factory Content"
              inputs:
                azureSubscription: '...'
                action: '...'
                resourceGroupName: '...'
                location: '...'
                templateLocation: '...'
                csmFile: '$(System.ArtifactsDirectory)/.../arm/adf.content.json'
                csmParametersFile: '$(System.ArtifactsDirectory)/../arm/adf.content.parameters.json'
                overrideParameters: ' -source_connectionString$(SourceConnectionString) 
                deploymentMode: 'Incremental' 
    
    但是我在
    重写参数:'-source\u connectionString$(SourceConnectionString)


    我不知道这样做是否正确?如果有人能理解为什么我不能获取密钥?

    这个错误通常是由错误的语法引起的

    ci deply.yml
    中,脚本
    重写参数:'-source\u connectionString$(SourceConnectionString)
    丢失一个
    '

    因此,
    ci deply.yml
    中的任务应该如下所示:

    - task: AzureResourceGroupDeployment@2
      displayName: "Deploy Azure Data Factory Content"
      inputs:
        azureSubscription: '...'
        action: '...'
        resourceGroupName: '...'
        location: '...'
        templateLocation: '...'
        csmFile: '$(System.ArtifactsDirectory)/.../arm/adf.content.json'
        csmParametersFile: '$(System.ArtifactsDirectory)/../arm/adf.content.parameters.json'
        overrideParameters: ' -source_connectionString$(SourceConnectionString) '
        deploymentMode: 'Incremental'
    

    哦,我在这里复制的时候好像没看到。但是谢谢你的帮助answer@ShrnPrmshr错误消息表明语法不正确。也许你用了制表符而不是空格,或者别的什么。此外,此错误消息通常会混淆错误的位置,因此最好检查整个文件。你可以试着用我的代码替换你的代码,看看它是否仍然出错。如果仍然失败,请检查所有空格,并将整个文件中的所有“”替换为“”。如果有任何更新,请让我知道。嗨,这个问题有更新吗?
    task: AzureResourceGroupDeployment@2
              displayName: "Deploy Azure Data Factory Content"
              inputs:
                azureSubscription: '...'
                action: '...'
                resourceGroupName: '...'
                location: '...'
                templateLocation: '...'
                csmFile: '$(System.ArtifactsDirectory)/.../arm/adf.content.json'
                csmParametersFile: '$(System.ArtifactsDirectory)/../arm/adf.content.parameters.json'
                overrideParameters: ' -source_connectionString$(SourceConnectionString) 
                deploymentMode: 'Incremental' 
    
    - task: AzureResourceGroupDeployment@2
      displayName: "Deploy Azure Data Factory Content"
      inputs:
        azureSubscription: '...'
        action: '...'
        resourceGroupName: '...'
        location: '...'
        templateLocation: '...'
        csmFile: '$(System.ArtifactsDirectory)/.../arm/adf.content.json'
        csmParametersFile: '$(System.ArtifactsDirectory)/../arm/adf.content.parameters.json'
        overrideParameters: ' -source_connectionString$(SourceConnectionString) '
        deploymentMode: 'Incremental'