forked from Ba4bes/AzDo-Bicep
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
56 lines (51 loc) · 1.63 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
name: Bicep-StorageAccount-PrivateEndpoint
trigger:
- main
variables:
resourceGroupName: 'example'
location: 'westeurope'
azureSubscription: 'AzureConnection'
resourcePrefix: 'bicep'
pool:
vmImage: ubuntu-latest
stages:
- stage: Build
jobs:
- job: Build
steps:
- task: AzureCLI@2
displayName: 'build bicep artifact'
inputs:
azureSubscription: $(azureSubscription)
scriptType: 'pscore'
scriptLocation: 'inlineScript'
inlineScript: 'az bicep build --file main.bicep'
- task: PublishBuildArtifacts@1
displayName: 'Publish artifact in pipeline'
inputs:
PathtoPublish: '$(Build.SourcesDirectory)/main.json'
ArtifactName: 'finishedTemplate'
publishLocation: 'Container'
- stage: deploy
jobs:
- deployment: biceptoAzure
displayName: 'Deploy bicep to Azure'
environment: 'AzureDeployment'
strategy:
runOnce:
deploy:
steps:
- checkout: self
- task: AzureCLI@2
displayName: 'deploy bicep template'
inputs:
azureSubscription: $(azureSubscription)
scriptType: 'pscore'
scriptLocation: 'inlineScript'
inlineScript: |
az group create --name $(ResourceGroupName) --location $(location)
az deployment group create `
--template-file $(Build.SourcesDirectory)/main.bicep `
--parameters $(Build.SourcesDirectory)/main.parameters.json `
--resource-group $(ResourceGroupName) `
--parameters resourcePrefix=$(resourceprefix)