-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines-build-sa.yml
106 lines (91 loc) · 3.3 KB
/
azure-pipelines-build-sa.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger: none
pool:
vmImage: 'vs2017-win2016'
variables:
azSubscription: 'UNI_WEBS - RS-UNI-CHE-HEALTH-BUDDY'
resourceGroup: 'RS-UNI-CHE-HEALTH-BUDDY'
storageAccount: saeuwprd1hbcovid01web
parameters:
- name: CreateSA
displayName: Create SA for HealthBuddy website
type: boolean
default: false
- name: DisableWebSite
displayName: Disable Web Site
type: boolean
default: false
- name: EnableWebSite
displayName: Enable Web Site
type: boolean
default: false
- name: ShowKeys
displayName: Show Keys
type: boolean
default: false
steps:
- task: AzureCLI@2
name: CreateSA
displayName: Create SA for HealthBuddy website
inputs:
azureSubscription: $(azSubscription)
scriptType: 'ps'
scriptLocation: 'inlineScript'
inlineScript: |
az storage account create --name $(storageAccount) --resource-group $(resourceGroup) `
--https-only false `
--access-tier Cool `
--sku Standard_LRS `
--kind StorageV2
$sacs = $(az storage account show-connection-string --name $(storageAccount) --resource-group $(resourceGroup) `
--query "connectionString")
az storage blob service-properties update --account-name $(storageAccount) `
--connection-string $sacs `
--static-website --404-document index.html `
--index-document index.html
condition: and(succeeded(), ${{ parameters.CreateSA }}, true)
- task: AzureCLI@2
name: DisableWebSite
displayName: Disable Web Site
inputs:
azureSubscription: $(azSubscription)
scriptType: 'ps'
scriptLocation: 'inlineScript'
inlineScript: |
$sacs = $(az storage account show-connection-string --name $(storageAccount) --resource-group $(resourceGroup) `
--query "connectionString")
az storage blob service-properties update --account-name $(storageAccount) `
--connection-string $sacs `
--static-website false
condition: and(succeeded(), ${{ parameters.DisableWebSite }}, true)
- task: AzureCLI@2
name: EnableWebSite
displayName: Enable Web Site
inputs:
azureSubscription: $(azSubscription)
scriptType: 'ps'
scriptLocation: 'inlineScript'
inlineScript: |
$sacs = $(az storage account show-connection-string --name $(storageAccount) --resource-group $(resourceGroup) `
--query "connectionString")
az storage blob service-properties update --account-name $(storageAccount) `
--connection-string $sacs `
--static-website --404-document index.html `
--index-document index.html `
--static-website true
condition: and(succeeded(), ${{ parameters.EnableWebSite }}, true)
- task: AzureCLI@2
name: ShowKeys
displayName: Show Keys
inputs:
azureSubscription: $(azSubscription)
scriptType: 'ps'
scriptLocation: 'inlineScript'
inlineScript: |
az storage account show-connection-string --name $(storageAccount) --resource-group $(resourceGroup) `
--query "connectionString"
az storage account keys list --account-name $(storageAccount) --resource-group $(resourceGroup)
condition: and(succeeded(), ${{ parameters.ShowKeys }}, true)