gpt4 book ai didi

azure - 如何使用 Azure DevOps 发布变量将环境特定值传递到 azure 数据工厂中的管道参数

转载 作者:行者123 更新时间:2023-12-03 02:20:50 26 4
gpt4 key购买 nike

我使用 ARM 模板创建了 Azure 数据工厂,然后在其中创建了数据集和管道。

在其中一个管道中,我使用了带有硬编码值的参数(EmailToSubject),如下所示:

        {
"name": "[concat(parameters('factoryName'), '/pl_xxxxxxxx')]",
"type": "Microsoft.DataFactory/factories/pipelines",
"apiVersion": "2018-06-01",
"properties": {
"activities": [
{
"name": "xxxxxxxxxx_Columns",
"type": "Lookup",
"dependsOn": [],
"policy": {
"timeout": "0.00:01:00",
"retry": 3,
"retryIntervalInSeconds": 60,
"secureOutput": false,
"secureInput": false
},
"userProperties": [],
"typeProperties": {
"source": {
"type": "SqlMISource",
"partitionOption": "None"
},
"dataset": {
"referenceName": "ds_xxxxxxxxxxx_New_Columns",
"type": "DatasetReference",
"parameters": {}
},
"firstRowOnly": false
}
},
{
"name": "foreach_New_Column",
"type": "ForEach",
"dependsOn": [
{
"activity": "lkp_xxxxxxxxx_New_Columns",
"dependencyConditions": [
"Succeeded"
]
}
],
"userProperties": [],
"typeProperties": {
"items": {
"value": "@activity('lkp_xxxxxxxxxxx_New_Columns').output.value",
"type": "Expression"
},
"activities": [
{
"name": "pl_Notify_xxxxxxxxxxx_New_Column",
"description": "Sends email to xxxxxxxxxxxx.",
"type": "ExecutePipeline",
"dependsOn": [],
"userProperties": [],
"typeProperties": {
"pipeline": {
"referenceName": "pl_xxxxxxxx_Email_Notification",
"type": "PipelineReference"
},
"waitOnCompletion": true,
"parameters": {
"EmailTo": "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8af2f3f0bbb8b9b9caebe8e9a4e9e5e7" rel="noreferrer noopener nofollow">[email protected]</a>",
"ErrorMessage": {
"value": "@concat(item().TABLE_NAME, ',', item().COLUMN_NAME, ' has been added in xxx. Please review. Change will be processed to xxxxx automatically in 7 days.' )",
"type": "Expression"
},
"PipelineName": {
"value": "@pipeline().Pipeline",
"type": "Expression"
},
"Subject": {
"value": "xxxxxxxxxxxx",
"type": "Expression"
}
}
}
}
]
}
}
],
"folder": {
"name": "xxxx/Sub-Pipelines"
},
"annotations": [],
"lastPublishTime": "2021-09-01T19:40:30Z"
},
"dependsOn": [
]
},

我想根据上述管道参数的环境(开发、QA 等......)将动态值传递给上述参数。

最佳答案

您实际上可以使用任务replacetokens在您的发布管道中。它将用变量值替换文件中的标记。您可以首先设置库中的所有变量(DEV、QA、PROD...)。在ARM模板文件中,您需要指定 token 前缀和 token 后缀,如下所示:

"EmailTo": ${emailAddress}$

在您的 YAML 文件中,任务应如下所示(例如使用版本 3):

- task: replacetoken@3
displayName: 'Replace variables'
inputs:
targetFiles: |
*.json
rootDirectory: '$(Pipeline.Workspace)/files'
tokenPrefix: '${'
tokenSuffix: '}$'

关于azure - 如何使用 Azure DevOps 发布变量将环境特定值传递到 azure 数据工厂中的管道参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69134427/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com