如何将Integration Runtime名称设为Data Factory ARM模板参数
解决Data Factory CI/CD中Integration Runtime名称参数化问题
我已搭建CI/CD流程,将DEV环境Data Factory的管道、全局参数、链接服务等内容部署到PROD环境,DEV与PROD各使用独立的自托管集成运行时(SHIR)。从连接Azure DevOps仓库的DEV Data Factory发布内容时,会生成ARMTemplateForFactory.json和ARMTemplateParametersForFactory.json文件,但默认SHIR名称未纳入参数文件。我希望将各环境的Integration Runtime名称设为发布时生成的ARM模板参数,已知可修改arm-template-parameters-definition.json实现,但不清楚语法,特询问具体配置方法。
我的Integration Runtime JSON描述
{ "name": "TestRuntimeSam", "properties": { "type": "Managed", "typeProperties": { "computeProperties": { "location": "AutoResolve", "dataFlowProperties": { "computeType": "General", "coreCount": 8, "timeToLive": 10, "cleanup": false } } } } }
基础arm-template-parameters-definition.json文件内容
{ "Microsoft.DataFactory/factories": { "properties": { "globalParameters": { "*": { "value": "=" } }, "globalConfigurations": { "*": "=" }, "encryption": { "*": "=", "identity": { "*": "=" } } }, "location": "=", "identity": { "type": "=", "userAssignedIdentities": "=" } }, "Microsoft.DataFactory/factories/pipelines": {}, "Microsoft.DataFactory/factories/integrationRuntimes": { "properties": { "typeProperties": { "ssisProperties": { "catalogInfo": { "catalogServerEndpoint": "=", "catalogAdminUserName": "=", "catalogAdminPassword": { "value": "-::secureString" } }, "customSetupScriptProperties": { "sasToken": { "value": "-::secureString" } } }, "linkedInfo": { "key": { "value": "-::secureString" }, "resourceId": "=" }, "computeProperties": { "dataFlowProperties": { "externalComputeInfo": [ { "accessToken": "-::secureString" } ] } } } } }, "Microsoft.DataFactory/factories/triggers": { "properties": { "pipelines": [ { "parameters": { "*": "=" } }, "pipelineReference.referenceName" ], "pipeline": { "parameters": { "*": "=" } }, "typeProperties": { "scope": "=" } } }, "Microsoft.DataFactory/factories/linkedServices": { "*": { "properties": { "typeProperties": { "accountName": "=", "accountEndpoint": "=", "username": "=", "userName": "=", "accessKeyId": "=", "endpoint": "=", "servicePrincipalId": "=", "userId": "=", "host": "=", "clientId": "=", "existingClusterId": "=", "clusterUserName": "=", "clusterSshUserName": "=", "hostSubscriptionId": "=", "clusterResourceGroup": "=", "subscriptionId": "=", "resourceGroupName": "=", "tenant": "=", "dataLakeStoreUri": "=", "baseUrl": "=", "database": "=", "serviceEndpoint": "=", "batchUri": "=", "poolName": "=", "databaseName": "=", "systemNumber": "=", "server": "=", "url": "=", "functionAppUrl": "=", "environmentUrl": "=", "aadResourceId": "=", "sasUri": "|:-sasUri:secureString", "sasToken": "|", "connectionString": "|:-connectionString:secureString", "hostKeyFingerprint": "=", "mlWorkspaceName": "=" } } }, "Odbc": { "properties": { "typeProperties": { "userName": "=", "connectionString": { "secretName": "=" } } } } }, "Microsoft.DataFactory/factories/datasets": { "*": { "properties": { "typeProperties": { "folderPath": "=", "fileName": "=" } } } }, "Microsoft.DataFactory/factories/credentials": { "*": { "properties": { "typeProperties": { "token": "=" } } } }, "Microsoft.DataFactory/factories/managedVirtualNetworks/managedPrivateEndpoints": { "properties": { "privateLinkResourceId": "=", "groupId": "=", "fqdns": "=" } }, "Microsoft.DataFactory/factories/globalparameters": { "properties": { "*": { "value": "=" } } } }
具体配置修改方法
要将Integration Runtime的名称转为ARM模板参数,只需在arm-template-parameters-definition.json的Microsoft.DataFactory/factories/integrationRuntimes节点下添加对name字段的参数化配置。
修改后的该节点内容如下:
"Microsoft.DataFactory/factories/integrationRuntimes": { "name": "=", "properties": { "typeProperties": { "ssisProperties": { "catalogInfo": { "catalogServerEndpoint": "=", "catalogAdminUserName": "=", "catalogAdminPassword": { "value": "-::secureString" } }, "customSetupScriptProperties": { "sasToken": { "value": "-::secureString" } } }, "linkedInfo": { "key": { "value": "-::secureString" }, "resourceId": "=" }, "computeProperties": { "dataFlowProperties": { "externalComputeInfo": [ { "accessToken": "-::secureString" } ] } } } } }
配置说明
"name": "="表示将Integration Runtime的name字段标记为可配置的ARM模板参数,发布时会自动将该字段的值提取到ARMTemplateParametersForFactory.json中。- 配置完成后,再次从DEV Data Factory发布内容时,
ARMTemplateParametersForFactory.json中会新增对应Integration Runtime名称的参数项,你可以根据PROD环境的需要修改该参数值,实现不同环境使用不同名称的SHIR。
内容的提问来源于stack exchange,提问作者samy KHEZNADJI
相关产品推荐
相关产品推荐

