如何在发布后将 Azure 数据工厂参数获取到 ARM 模板参数文件 (ARMTemplateParametersForFactory.json)
How to get the Azure Data Factory parameters into the ARM template parameters file (ARMTemplateParametersForFactory.json) after publishing
我正在尝试为 Azure 数据工厂创建我的 Azure DevOps 发布管道。
我遵循了 Microsoft (https://docs.microsoft.com/en-us/azure/data-factory/continuous-integration-deployment ) regarding adding additional parameters to the ARM template that gets generated when you do a publish (https://docs.microsoft.com/en-us/azure/data-factory/continuous-integration-deployment#use-custom-parameters-with-the-resource-manager-template) 相当隐晦的指南
在 master 分支的路径中创建了一个 arm-template-parameters-definition.json
文件。当我发布时,adf_publish
分支中的 ARMTemplateParametersForFactory.json
保持完全不变。我尝试了很多配置。
我已经在数据工厂中定义了一些管道参数,并希望它们在我的部署管道中是可配置的。对我来说似乎是一个明显的要求。
我是不是漏掉了一些基本的东西?请帮忙!
JSON如下:
{
"Microsoft.DataFactory/factories/pipelines": {
"*": {
"properties": {
"parameters": {
"*": "="
}
}
}
},
"Microsoft.DataFactory/factories/integrationRuntimes": {
"*": "="
},
"Microsoft.DataFactory/factories/triggers": {},
"Microsoft.DataFactory/factories/linkedServices": {},
"Microsoft.DataFactory/factories/datasets": {}
}
以下是消除困惑的必要步骤:
- 将 arm-template-parameters-definition.json 添加到您的 master 分支。
- 关闭并重新打开您的 Dev ADF 门户
- 进行新的发布
您的 ARMTemplateParametersForFactory.json 将被更新。
几天来我一直在努力解决这个问题,但没有找到很多信息,所以这里是我发现的。您必须将 arm-template-parameters-definition.json
放在协作分支的已配置根文件夹中:
因此在我的示例中,它必须如下所示:
如果您在单独的分支机构工作,您可以通过从数据工厂下载 arm 模板来测试您的配置。当您更改参数定义时,您必须重新加载浏览器屏幕 (f5) 以刷新配置。
如果您真的想参数化所有管道中的所有参数,以下应该可行:
"Microsoft.DataFactory/factories/pipelines": {
"properties": {
"parameters":{
"*":{
"defaultValue":"="
}
}
}
}
我更喜欢指定要参数化的参数:
"Microsoft.DataFactory/factories/pipelines": {
"properties": {
"parameters":{
"LogicApp_RemoveFileFromADLSURL":{
"defaultValue":"=:-LogicApp_RemoveFileFromADLSURL:"
},
"LogicApp_RemoveBlob":{
"defaultValue":"=:-LogicApp_RemoveBlob:"
}
}
}
}
我遇到过类似的问题,ARMTemplateParametersForFactory.json
文件在我发布时没有更新,并且更改了 arm-template-parameters-definition.json
。
我想我可以通过执行以下操作强制更新发布分支:
- 根据需要更新自定义参数定义文件。
- 从发布分支中删除
ARMTemplateParametersForFactory.json
。
- 刷新 (F5) 数据工厂门户。
- 发布。
验证自定义参数的最简单方法。json 语法似乎是通过导出 ARM 模板,就像 Simon 提到的那样。
您的想法是正确的,但是 arm-template-parameters-definition.json 文件需要遵循您要参数化的元素的层次结构。
这是我的管道 activity 我想参数化。 "url" 应根据其部署的环境进行更改
{
"name": "[concat(parameters('factoryName'), '/ExecuteSPForNetPriceExpiringContractsReport')]",
"type": "Microsoft.DataFactory/factories/pipelines",
"apiVersion": "2018-06-01",
"properties": {
"description": "",
"activities": [
{
"name": "NetPriceExpiringContractsReport",
"description": "Passing values to the Logic App to generate the CSV file.",
"type": "WebActivity",
"typeProperties": {
"url": "[parameters('ExecuteSPForNetPriceExpiringContractsReport_properties_1_typeProperties')]",
"method": "POST",
"headers": {
"Content-Type": "application/json"
},
"body": {
"resultSet": "@activity('NetPriceExpiringContractsReportLookup').output"
}
}
}
]
}
}
这是将 URL 转换为参数的 arm-template-parameters-definition.json 文件。
{
"Microsoft.DataFactory/factories/pipelines": {
"properties": {
"activities": [{
"typeProperties": {
"url": "-::string"
}
}]
}
},
"Microsoft.DataFactory/factories/integrationRuntimes": {},
"Microsoft.DataFactory/factories/triggers": {},
"Microsoft.DataFactory/factories/linkedServices": {
"*": "="
},
"Microsoft.DataFactory/factories/datasets": {
"*": "="
}
}
所以基本上在 ARM 模板的管道中,它在 JSON 中查找属性 -> 活动 -> typeProperties -> url 并对其进行参数化。
只是为了澄清 Simon 的出色回答。如果您有非标准的 git 层次结构(即您将根移动到子文件夹,就像我在下面使用 "Source" 所做的那样),当文档引用 "repo root" 时可能会造成混淆.希望这张图能有所帮助。
我正在尝试为 Azure 数据工厂创建我的 Azure DevOps 发布管道。
我遵循了 Microsoft (https://docs.microsoft.com/en-us/azure/data-factory/continuous-integration-deployment ) regarding adding additional parameters to the ARM template that gets generated when you do a publish (https://docs.microsoft.com/en-us/azure/data-factory/continuous-integration-deployment#use-custom-parameters-with-the-resource-manager-template) 相当隐晦的指南
在 master 分支的路径中创建了一个 arm-template-parameters-definition.json
文件。当我发布时,adf_publish
分支中的 ARMTemplateParametersForFactory.json
保持完全不变。我尝试了很多配置。
我已经在数据工厂中定义了一些管道参数,并希望它们在我的部署管道中是可配置的。对我来说似乎是一个明显的要求。
我是不是漏掉了一些基本的东西?请帮忙!
JSON如下:
{
"Microsoft.DataFactory/factories/pipelines": {
"*": {
"properties": {
"parameters": {
"*": "="
}
}
}
},
"Microsoft.DataFactory/factories/integrationRuntimes": {
"*": "="
},
"Microsoft.DataFactory/factories/triggers": {},
"Microsoft.DataFactory/factories/linkedServices": {},
"Microsoft.DataFactory/factories/datasets": {}
}
以下是消除困惑的必要步骤:
- 将 arm-template-parameters-definition.json 添加到您的 master 分支。
- 关闭并重新打开您的 Dev ADF 门户
- 进行新的发布
您的 ARMTemplateParametersForFactory.json 将被更新。
几天来我一直在努力解决这个问题,但没有找到很多信息,所以这里是我发现的。您必须将 arm-template-parameters-definition.json
放在协作分支的已配置根文件夹中:
因此在我的示例中,它必须如下所示:
如果您在单独的分支机构工作,您可以通过从数据工厂下载 arm 模板来测试您的配置。当您更改参数定义时,您必须重新加载浏览器屏幕 (f5) 以刷新配置。
如果您真的想参数化所有管道中的所有参数,以下应该可行:
"Microsoft.DataFactory/factories/pipelines": {
"properties": {
"parameters":{
"*":{
"defaultValue":"="
}
}
}
}
我更喜欢指定要参数化的参数:
"Microsoft.DataFactory/factories/pipelines": {
"properties": {
"parameters":{
"LogicApp_RemoveFileFromADLSURL":{
"defaultValue":"=:-LogicApp_RemoveFileFromADLSURL:"
},
"LogicApp_RemoveBlob":{
"defaultValue":"=:-LogicApp_RemoveBlob:"
}
}
}
}
我遇到过类似的问题,ARMTemplateParametersForFactory.json
文件在我发布时没有更新,并且更改了 arm-template-parameters-definition.json
。
我想我可以通过执行以下操作强制更新发布分支:
- 根据需要更新自定义参数定义文件。
- 从发布分支中删除
ARMTemplateParametersForFactory.json
。 - 刷新 (F5) 数据工厂门户。
- 发布。
验证自定义参数的最简单方法。json 语法似乎是通过导出 ARM 模板,就像 Simon 提到的那样。
您的想法是正确的,但是 arm-template-parameters-definition.json 文件需要遵循您要参数化的元素的层次结构。
这是我的管道 activity 我想参数化。 "url" 应根据其部署的环境进行更改
{
"name": "[concat(parameters('factoryName'), '/ExecuteSPForNetPriceExpiringContractsReport')]",
"type": "Microsoft.DataFactory/factories/pipelines",
"apiVersion": "2018-06-01",
"properties": {
"description": "",
"activities": [
{
"name": "NetPriceExpiringContractsReport",
"description": "Passing values to the Logic App to generate the CSV file.",
"type": "WebActivity",
"typeProperties": {
"url": "[parameters('ExecuteSPForNetPriceExpiringContractsReport_properties_1_typeProperties')]",
"method": "POST",
"headers": {
"Content-Type": "application/json"
},
"body": {
"resultSet": "@activity('NetPriceExpiringContractsReportLookup').output"
}
}
}
]
}
}
这是将 URL 转换为参数的 arm-template-parameters-definition.json 文件。
{
"Microsoft.DataFactory/factories/pipelines": {
"properties": {
"activities": [{
"typeProperties": {
"url": "-::string"
}
}]
}
},
"Microsoft.DataFactory/factories/integrationRuntimes": {},
"Microsoft.DataFactory/factories/triggers": {},
"Microsoft.DataFactory/factories/linkedServices": {
"*": "="
},
"Microsoft.DataFactory/factories/datasets": {
"*": "="
}
}
所以基本上在 ARM 模板的管道中,它在 JSON 中查找属性 -> 活动 -> typeProperties -> url 并对其进行参数化。
只是为了澄清 Simon 的出色回答。如果您有非标准的 git 层次结构(即您将根移动到子文件夹,就像我在下面使用 "Source" 所做的那样),当文档引用 "repo root" 时可能会造成混淆.希望这张图能有所帮助。