-
-
Save cporteou/722fc51c3672cbaec3d807822c8d7f6a to your computer and use it in GitHub Desktop.
Azure pipelines YAML file containing a test and prod deploy step and using environments for blog article: CI/CD for Azure Data Factory: Adding a production deployment stage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CICD Pipeline for Azure Data Factory | |
# Author: Craig Porteous (@cporteous) | |
trigger: | |
- adf_publish | |
pool: | |
vmImage: 'vs2017-win2016' | |
stages: | |
- stage: QAtesting | |
jobs: | |
- deployment: Testdeploy | |
displayName: Test environment deployment | |
environment: 'Test' | |
strategy: | |
runOnce: | |
deploy: | |
steps: | |
- checkout: self | |
- checkout: 'git://CICD with Azure Data Factory/cpo-configs@refs/heads/main' | |
- task: AzurePowerShell@5 | |
displayName: 'Stop ADF triggers' | |
inputs: | |
azureSubscription: 'Visual Studio Enterprise()' | |
ScriptType: 'FilePath' | |
ScriptPath: '$(System.DefaultWorkingDirectory)/cpo-configs/adf-maintenance.ps1' | |
ScriptArguments: -armTemplate "$(System.DefaultWorkingDirectory)/cpo-datafactory/cpo-adf-dev/ARMTemplateForFactory.json" | |
-ResourceGroupName "ModernDataPlatform" | |
-DataFactoryName "cpo-adf-uat" | |
-predeployment $true | |
-deleteDeployment $false | |
azurePowerShellVersion: 'LatestVersion' | |
- task: AzureResourceManagerTemplateDeployment@3 | |
displayName: 'ARM Template deployment' | |
inputs: | |
deploymentScope: 'Resource Group' | |
azureResourceManagerConnection: 'Visual Studio Enterprise()' | |
subscriptionId: '' | |
action: 'Create Or Update Resource Group' | |
resourceGroupName: 'ModernDataPlatform' | |
location: 'UK South' | |
templateLocation: 'Linked artifact' | |
csmFile: '$(System.DefaultWorkingDirectory)/cpo-datafactory/cpo-adf-dev/ARMTemplateForFactory.json' | |
csmParametersFile: '$(System.DefaultWorkingDirectory)/cpo-datafactory/cpo-adf-dev/ARMTemplateParametersForFactory.json' | |
overrideParameters: -factoryName "cpo-adf-uat" | |
-cpo_kv_properties_typeProperties_baseUrl "" | |
-cpodatalake_properties_typeProperties_url "" | |
-cposqlsource_properties_typeProperties_connectionString_secretName "" | |
deploymentMode: 'Incremental' | |
- task: AzurePowerShell@5 | |
displayName: 'Clean resources and start ADF triggers' | |
inputs: | |
azureSubscription: 'Visual Studio Enterprise()' | |
ScriptType: 'FilePath' | |
ScriptPath: '$(System.DefaultWorkingDirectory)/cpo-configs/adf-maintenance.ps1' | |
ScriptArguments: -armTemplate "$(System.DefaultWorkingDirectory)/cpo-datafactory/cpo-adf-dev/ARMTemplateForFactory.json" | |
-ResourceGroupName "ModernDataPlatform" | |
-DataFactoryName "cpo-adf-dev" | |
-predeployment $false | |
-deleteDeployment $true | |
azurePowerShellVersion: 'LatestVersion' | |
- stage: Production | |
jobs: | |
- deployment: Proddeploy | |
displayName: Production environment deployment | |
environment: 'Production' | |
strategy: | |
runOnce: | |
deploy: | |
steps: | |
- checkout: self | |
- checkout: 'git://CICD with Azure Data Factory/cpo-configs@refs/heads/main' | |
- task: AzurePowerShell@5 | |
displayName: 'Stop ADF triggers' | |
inputs: | |
azureSubscription: 'Visual Studio Enterprise()' | |
ScriptType: 'FilePath' | |
ScriptPath: '$(System.DefaultWorkingDirectory)/cpo-configs/adf-maintenance.ps1' | |
ScriptArguments: -armTemplate "$(System.DefaultWorkingDirectory)/cpo-datafactory/cpo-adf-dev/ARMTemplateForFactory.json" | |
-ResourceGroupName "ModernDataPlatform" | |
-DataFactoryName "cpo-adf-prod" | |
-predeployment $true | |
-deleteDeployment $false | |
azurePowerShellVersion: 'LatestVersion' | |
- task: AzureResourceManagerTemplateDeployment@3 | |
displayName: 'ARM Template deployment' | |
inputs: | |
deploymentScope: 'Resource Group' | |
azureResourceManagerConnection: 'Visual Studio Enterprise()' | |
subscriptionId: '' | |
action: 'Create Or Update Resource Group' | |
resourceGroupName: 'ModernDataPlatform' | |
location: 'UK South' | |
templateLocation: 'Linked artifact' | |
csmFile: '$(System.DefaultWorkingDirectory)/cpo-datafactory/cpo-adf-dev/ARMTemplateForFactory.json' | |
csmParametersFile: '$(System.DefaultWorkingDirectory)/cpo-datafactory/cpo-adf-dev/ARMTemplateParametersForFactory.json' | |
overrideParameters: -factoryName "cpo-adf-prod" | |
-cpo_kv_properties_typeProperties_baseUrl "" | |
-cpodatalake_properties_typeProperties_url "" | |
-cposqlsource_properties_typeProperties_connectionString_secretName "" | |
deploymentMode: 'Incremental' | |
- task: AzurePowerShell@5 | |
displayName: 'Clean resources and start ADF triggers' | |
inputs: | |
azureSubscription: 'Visual Studio Enterprise()' | |
ScriptType: 'FilePath' | |
ScriptPath: '$(System.DefaultWorkingDirectory)/cpo-configs/adf-maintenance.ps1' | |
ScriptArguments: -armTemplate "$(System.DefaultWorkingDirectory)/cpo-datafactory/cpo-adf-dev/ARMTemplateForFactory.json" | |
-ResourceGroupName "ModernDataPlatform" | |
-DataFactoryName "cpo-adf-prod" | |
-predeployment $false | |
-deleteDeployment $true | |
azurePowerShellVersion: 'LatestVersion' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is the best demo on ADF CICD using YAML. Thank you for sharing!!!