[英]Will ADF deployment using azure devops affect existing Pipelines/Jobs in the environment
[英]Automated Deployment of ADF Pipelines using Azure DevOps CI/CD Pipelines
在https://docs.microsoft.com/en-us/azure/data-factory/continuous-integration-deployment (即)部署管道的幫助下,我使用 Azure DevOps CI/CD 管道自動化了 Azure ADF 管道部署過程從 DEV 到 PROD 環境 ADF。 我正在使用 ADF 的 ARM 模板將管道從一個環境部署到另一個環境。 因此,我將有一個單獨的 ARM_Parameter.json 對應於每個環境(開發/生產)。 問題是每個 ADF 管道可能有很少的基本參數,這些基本參數沒有被參數化,因此它在 parameter.json 中不可用。 在這個使用 CI/CD 管道的自動化 ADF 管道部署過程中,你們能幫我以自動化的方式在每個 ADF 管道下的基本參數部分用 PROD 值替換開發值嗎?
我看到兩個選項:
您可以將自定義參數與 ARM 模板一起使用。 Pipeline 的自定義參數可能如下所示:
"Microsoft.DataFactory/factories/pipelines": {
"properties": {
"parameters": {
"RUN_ENVIRONMENT": "=:-:string"
}
}
},
將開發值替換為基本參數部分中的 PROD 值
根據您的截圖, RUN_ENVIRONMENT
是管道的參數,這意味着在轉換為 ARM 模板時,其格式如下:
"resources": [
{
....
....
"properties": {
"parameters": {
"RUN_ENVIRONMENT": {
"type": "string",
"defaultValue": "pro"
}
},...
},...
}
]
它不能被 ARM 部署任務中使用Override template parameters
替換。 因為會提示The template parameters 'environment' in the parameters file are not valid; they are not present in the original template and can therefore not be provided at deployment time.
The template parameters 'environment' in the parameters file are not valid; they are not present in the original template and can therefore not be provided at deployment time.
要解決此錯誤,只需安裝一個擴展並將Replace token
任務添加到 ARM 部署任務之前的管道中。 此任務將在構建運行時替換 content 的值:
還有另一種從 master(協作)分支發布 ADF 的方法。 您可以為 JSON 文件(ADF 對象)中的每個節點(屬性)定義(替換)值。 它將解決您的問題,因為您可以為每個環境(階段)提供一個單獨的 CSV 配置文件。
CSV 配置文件示例 ( config-stage-UAT.csv
):
type,name,path,value
pipeline,PL_CopyMovies,activities[0].outputs[0].parameters.BlobContainer,UAT
然后只需在 PowerShell 中運行這樣的 cmdlet:
Publish-AdfV2FromJson -RootFolder "$RootFolder" -ResourceGroupName "$ResourceGroupName" -DataFactoryName "$DataFactoryName" -Location "$Location" -Stage "stage-UAT"
看看這個: azure.datafactory.tools (PowerShell 模塊)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.