Skip to content

Instantly share code, notes, and snippets.

@cporteou
Created January 11, 2021 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cporteou/dfaa6b97aadb98ce103c009d3c58ba5b to your computer and use it in GitHub Desktop.
Save cporteou/dfaa6b97aadb98ce103c009d3c58ba5b to your computer and use it in GitHub Desktop.
Azure pipelines YAML files 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'
# 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: ManualValidation@0
timeoutInMinutes: 1440 # task times out in 1 day
inputs:
notifyUsers: |
craig@craigporteous.com
instructions: 'ADF triggers in cpo-adf-uat have been paused. Please run manual tasks and resume deployment'
onTimeout: 'resume'
- 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