Last active
January 24, 2021 02:55
-
-
Save PlagueHO/ddc66b26a3d314fc3c2666d1c4a39e8d to your computer and use it in GitHub Desktop.
Azure DevOps Multi-Stage YAML Pipeline triggered off Main Branch with access to Secrets & Service Connections
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
trigger: | |
branches: | |
include: | |
- 'main' | |
pr: none | |
stages: | |
- stage: Build | |
jobs: | |
- template: templates/build.yml | |
- stage: QA | |
displayName: 'Quality Assurance' | |
jobs: | |
- deployment: deploy_qa | |
displayName: 'Deploy to QA' | |
pool: | |
vmImage: 'Ubuntu-16.04' | |
variables: | |
- group: 'QA Secrets' | |
strategy: | |
runOnce: | |
deploy: | |
steps: | |
- task: AzureResourceManagerTemplateDeployment@3 | |
displayName: 'Deploy Azure Resources' | |
inputs: | |
azureResourceManagerConnection: 'Azure QA' | |
subscriptionId: '<redacted>' | |
resourceGroupName: 'dsr-qa-rg' | |
location: 'East US' | |
csmFile: '$(Pipeline.Workspace)/arm/azuredeploy.json' | |
overrideParameters: '-sqlServerName dsr-qa-sql -sqlDatabaseName dsrqadb -sqlAdministratorLoginUsername $(SQLAdministratorLoginUsername) -sqlAdministratorLoginPassword $(SQLAdministratorLoginPassword) -hostingPlanName "dsr-qa-asp" -webSiteName "dsrqaapp"' | |
- stage: Production | |
displayName: 'Release to Production' | |
jobs: | |
- deployment: deploy_production | |
displayName: 'Deploy to Production' | |
pool: | |
vmImage: 'Ubuntu-16.04' | |
variables: | |
- group: 'PRODUCTION Secrets' | |
strategy: | |
runOnce: | |
deploy: | |
steps: | |
- task: AzureResourceManagerTemplateDeployment@3 | |
displayName: 'Deploy Azure Resources' | |
inputs: | |
azureResourceManagerConnection: 'Azure PRODUCTION' | |
subscriptionId: '<redacted>' | |
resourceGroupName: 'dsr-production-rg' | |
location: 'East US' | |
csmFile: '$(Pipeline.Workspace)/arm/azuredeploy.json' | |
overrideParameters: '-sqlServerName dsr-production-sql -sqlDatabaseName dsrproductiondb -sqlAdministratorLoginUsername $(SQLAdministratorLoginUsername) -sqlAdministratorLoginPassword $(SQLAdministratorLoginPassword) -hostingPlanName "dsr-production-asp" -webSiteName "dsrproductionapp"' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment