我有一个 Azure 数据工厂 (ADF) 管道,只要检测到某些更改,它就会通过 Azure DevOps CI/CD 管道自动部署。
只要部署管道运行,GitHub 就会与 ADF 断开连接
主题已经在这两个 stackoverflow 问题中被问到(据我所知):
但我仍然不知道在哪里添加
repoConfiguration
选项(在arm-template-parameters-definition.json
?如何?)所以当我从ADF发布时,ARMTemplateForFactory.json
包含repoConfiguration
选项。
我尝试编辑
arm-template-parameters-definition.json
,使其包含如下内容(根据 this Microsoft 学习页面):
{
"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 允许它。我不太喜欢这种替代方法,因为它只能绕过问题,但不能解决问题。
# Create a new task that runs an HTTP request that connects ADF to the GitHub repo
# https://learn.microsoft.com/en-us/rest/api/datafactory/factories/configure-factory-repo?tabs=HTTP
- 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'