如何在Azure DevOps管道中覆盖数据工厂的参数?-ARM模板中的空白导致错误



我正在尝试在Azure数据工厂中添加参数,以便覆盖每个开发、测试和生产环境的参数值。目前我已经在DevOpsRelease中设置了静态字符串作为参数值。

然而,我从Azure DevOps中得到了奇怪的错误。我想知道为什么数据工厂将参数名称保存为";Web pipeline_properties_ parameters_;,其在Web之后具有空的空间。

  1. 编辑过"ARM模板"->quot;编辑参数配置";和公布的参数:

    "微软数据工厂/工厂/管道":{"属性":{"参数":{"LogicAppURL":{"defaultValue":"}}}

  2. Git Repo:中的ARMTemplateParametersForFactory.json

    {
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
    "factoryName": {
    "value": "my-warehouse-dev-df"
    },
    "Web pipeline_properties_parameters_LogicAppURL_defaultValue": {
    "value": "http://www.devpipeline.fi"
    }
    }
    

    }

创建版本时出错:

The detected encoding for file 'D:ar1a_Azure Data 
Factory DevOps-CIdropARMTemplateForFactory.json' is 'utf-8'

The detected encoding for file 'D:ar1a_Azure Data 
Factory DevOps-CIdropARMTemplateParametersForFactory.json' is 'utf-8'

There was an error while overriding 'Web' parameter 
because of 'TypeError: Cannot read property 'type' of undefined', make sure it 
follows JavaScript Object Notation (JSON)

There was an error while overriding '' parameter 
because of 'TypeError: Cannot read property 'type' of undefined', make sure it 
follows 
JavaScript Object Notation (JSON)

Starting template validation.
Deployment name is ARMTemplateForFactory-20211220-162118-0e5d
There were errors in your deployment. Error code: 
InvalidDeploymentParameterKey.
##[error]One of the deployment parameters has an empty 
key. Please see https://aka.ms/resource-manager-parameter-files for details.

这是一个已知的问题。如错误所示,请尝试按如下方式编辑参数名称。

然而,将其放置在" "之间就足够了。

"Web_pipeline_properties_parameters_LogicAppURL_defaultValue"

此外,如果您希望默认情况下参数值为空,您可以设置如下:

"Microsoft.DataFactory/factories/pipelines": {
"properties": {
"parameters": {
"LogicAppURL": {
"defaultValue": {}
}
}
}

在覆盖模板参数时,使用:

-param "value"

最新更新