Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
# 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