-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
81 lines (71 loc) · 2.33 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#Build database project, Deploy ARM template
variables:
dbname: 'appdb'
targetrg: 'cust-east2'
location: 'East US 2'
stages:
- stage: 'Build'
displayName: 'Build database application (DACPAC)'
jobs:
- job: 'buildDACPAC'
displayName: 'DACPAC build'
pool:
vmImage: 'windows-latest'
demands: azureps
steps:
- task: DotNetCoreCLI@2
displayName: 'Restore project dependencies'
inputs:
command: 'restore'
projects: '**/*.csproj'
- task: VSBuild@1
displayName: 'Build the database project'
inputs:
project: '**/*.sqlproj'
- task: CopyFiles@2
displayName: 'Copy dacpac file to staging directory'
inputs:
contents: |
SampleDB/bin/**/*.dacpac
targetFolder: '$(Build.StagingDirectory)'
- task: CopyFiles@2
displayName: 'Copy ARM Templates to staging directory'
inputs:
contents: |
Templates/**
targetFolder: '$(Build.StagingDirectory)'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact'
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: dropDacpac
condition: succeededOrFailed()
- stage: 'DeployDB'
displayName: 'Deploy SQL Infra and Schema'
jobs:
- deployment: 'deploySQLInfra'
pool:
vmImage: 'windows-latest'
demands: azureps
environment: Dev
variables:
- group: Dev
strategy:
runOnce:
deploy:
steps:
- download: current
artifact: dropDacpac
- task: AzureResourceManagerTemplateDeployment@3
inputs:
deploymentScope: 'Resource Group'
ConnectedServiceName: 'Azure Customers RG'
subscriptionName: '$(subscriptionID)'
action: 'Create Or Update Resource Group'
resourceGroupName: '$(targetrg)'
location: '$(location)'
templateLocation: 'Linked artifact'
csmFile: '$(Pipeline.Workspace)/dropDacpac/Templates/sql/azuredeploy.json'
csmParametersFile: '$(Pipeline.Workspace)/dropDacpac/Templates/sql/azuredeploy.parameters.json'
overrideParameters: '-sqlServerName $(sqlservername) -administratorLogin $(sqladmin) -administratorLoginPassword $(sqlpwd)'
deploymentMode: 'Incremental'