-
Notifications
You must be signed in to change notification settings - Fork 305
/
Copy pathazure-petstore-db-iac.yml
66 lines (61 loc) · 1.92 KB
/
azure-petstore-db-iac.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
name: Deploy Database Infrastructure
parameters:
- name: resourceGroup
displayName: Database Resource Group
type: string
default: Test
- name: region
displayName: Database Region
type: string
default: East US 2
values:
- East US
- East US 2
- West US
- West US 2
- name: cosmosAccountName
displayName: Cosmos Account Name
type: string
default: AzurePetStore
- name: cosmosDatabaseName
displayName: Cosmos Database Name
type: string
default: E-Commerce
- name: cosmosContainerName
displayName: Cosmos Container Name
type: string
default: Orders
trigger: none
variables:
vmImageName: 'ubuntu-latest'
azureServiceConnection: 'Azure'
templateFile: 'petstore/iac/bicep/db/main.bicep'
pool:
vmImage: $(vmImageName)
stages:
- stage: Deploy
displayName: Deploy Database Infrastructure Stage
jobs:
- deployment: Deploy
displayName: Deploy Database Infrastructure Job
pool:
vmImage: 'ubuntu-latest'
environment: 'Development'
strategy:
runOnce:
deploy:
steps:
- checkout: self
- task: AzureCLI@2
inputs:
azureSubscription: $(azureServiceConnection)
scriptType: bash
scriptLocation: inlineScript
inlineScript: |
az --version
ls -l
if [ $(az group exists --name ${{ parameters.resourceGroup }}) = false ]; then
az group create --name ${{ parameters.resourceGroup }} --location 'eastus'
fi
az deployment group create \
--resource-group ${{ parameters.resourceGroup }} --template-file $(templateFile) --parameters accountName='${{ parameters.cosmosAccountName }}' location='${{ parameters.region }}' databaseName='${{ parameters.cosmosDatabaseName }}' containerName='${{ parameters.cosmosContainerName }}' partitionKeyPath='/partition' --verbose