Azure Data Factory部署后如何维持与GitHub仓库的连接?
项目背景
我有一个Azure Data Factory(ADF)管道,当检测到变更时会通过Azure DevOps CI/CD管道自动部署。

问题描述
每当部署管道运行时,GitHub与ADF的连接就会断开。
该问题已在以下两个Stack Overflow问题中被提出:
- ADF Git Configure Disconnection After Publish with AzureResourceGroupDeployment & ARMTemplates
- Azure ARM Template deployment of DataFactory with Azure DevOps Git configuration
但我仍不清楚应在何处添加repoConfiguration配置项(是否在arm-template-parameters-definition.json中?如何添加?),以便从ADF发布时,ARMTemplateForFactory.json能包含repoConfiguration配置。
已尝试方案
我尝试编辑arm-template-parameters-definition.json,添加如下配置(参考Microsoft Learn文档):
{ "Microsoft.DataFactory/factories": { "properties": { "globalParameters": { "*": { "value": "=" } }, "globalConfigurations": { "*": "=" }, "encryption": { "*": "=", "identity": { "*": "=" } }, "repoConfiguration": { "accountName": "=", "repositoryName": "=", "collaborationBranch": "=", "rootFolder": "=", "clientId": "=", "clientSecret": { "byoaSecretAkvUrl": "=", "byoaSecretName": "=" }, "hostName": "=" } }, "location": "=", "identity": { "type": "=", "userAssignedIdentities": "=" } } }
但并未成功。这种方法是否可行?还有其他解决方案吗?
备选方案
如果其他方法都无效,我最后的备选方案是在Azure DevOps部署管道中添加InvokeRESTAPI@1任务,重新连接ADF与GitHub,因为Factories_ConfigureFactoryRepo接口支持该操作。但我不太喜欢此方案,因为它只是绕过问题而非解决问题。
# 创建一个执行HTTP请求的任务,重新连接ADF与GitHub仓库 - task: InvokeRESTAPI@1 inputs: connectionType: 'AzureRM' azureSubscriptionEndpoint: 'MyAzureServiceConnection' method: 'POST' url: 'https://management.azure.com/subscriptions/************/providers/Microsoft.DataFactory/locations/West Europe/configureFactoryRepo?api-version=2018-06-01' body: | { "factoryResourceId": "/subscriptions/************/resourceGroups/resource_name/providers/Microsoft.DataFactory/factories/data-factory-name", "repoConfiguration": { "type": "FactoryGitHubConfiguration", "accountName": "GitHubAccountName", "collaborationBranch": "main", "repositoryName": "GitHubRepoName", "rootFolder": "/", "clientId": "client-id", "clientSecret": "client-secret" } } contentType: 'application/json'
内容的提问来源于stack exchange,提问作者Pietro D'Antuono
相关产品推荐
相关产品推荐

