generated from Azure/caf-terraform-landingzones-accelerator
-
Notifications
You must be signed in to change notification settings - Fork 0
467 lines (424 loc) · 23.8 KB
/
deploy-aks-online-landingzone.yaml
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
name: Deploy_AKS_Online_Landingzone
# The pipeline is triggered on:
# - PR/Issue comments "/deploy-all", "/deploy-launchpad", "/deploy-shared-services", "/deploy-networking-hub",
# "/deploy-networking-spoke", "/deploy-aks", "/deploy-addons"
on:
workflow_dispatch:
push:
branches:
- starter
# issue_comment:
# types:
# - created
env:
AZURE_CREDENTIALS: '{"clientId":"${{ secrets.ARM_CLIENT_ID }}", "clientSecret":"${{ secrets.ARM_CLIENT_SECRET }}", "subscriptionId":"${{ secrets.ARM_SUBSCRIPTION_ID }}", "tenantId":"${{ secrets.ARM_TENANT_ID }}"}'
event_sha: +refs/pull/${{ github.event.issue.number }}/merge
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }}
ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }}
ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }}
ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }}
ARM_PARTNER_ID: "f85b2775-ec1d-4fef-949e-bbd6957082af"
ENVIRONMENT: "2${{ github.run_id }}"
jobs:
deploy-launchpad:
runs-on: ubuntu-latest
container:
image: aztfmod/rover:1.0.1-2106.3012
options: --user 0
outputs:
prefix: ${{ steps.test.outputs.PREFIX }}
steps:
- name: Checkout Repository
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-launchpad') || github.event_name != 'issue_comment'
uses: actions/checkout@v2
- name: Checkout PR code
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-launchpad')
run: |
git fetch origin ${{ env.event_sha }}
git checkout FETCH_HEAD
- name: Azure Login
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-launchpad') || github.event_name != 'issue_comment'
uses: azure/login@v1
with:
creds: ${{ env.AZURE_CREDENTIALS }}
- name: Launchpad
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-launchpad') || github.event_name != 'issue_comment'
run: |
cp -rs ${GITHUB_WORKSPACE}/* /tf/caf && cp -r ${GITHUB_WORKSPACE}/.devcontainer /tf/caf/
/tf/caf/enterprise_scale/construction_sets/aks/online/aks_secure_baseline/landingzone/scripts/launchpad.sh
- name: Test
id: test
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-launchpad') || github.event_name != 'issue_comment'
run: |
cd /tf/caf/enterprise_scale/construction_sets/aks/online/aks_secure_baseline/test
export ACTION="output -json -o /tf/caf/rover.output"
/tf/caf/enterprise_scale/construction_sets/aks/online/aks_secure_baseline/landingzone/scripts/launchpad.sh
prefix_output=$(cat /tf/caf/rover.output | jq -r .objects.value.launchpad.global_settings.prefixes[0])
echo $prefix_output
echo "PREFIX"
export PREFIX=$prefix_output
echo "::set-output name=PREFIX::$prefix_output"
go test -v launchpad/launchpad_test.go
deploy-shared-services:
runs-on: ubuntu-latest
needs: deploy-launchpad
container:
image: aztfmod/rover:1.0.1-2106.3012
options: --user 0
outputs:
prefix: ${{ steps.test.outputs.PREFIX }}
steps:
- name: Checkout Repository
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-shared-services') || github.event_name != 'issue_comment'
uses: actions/checkout@v2
- name: Checkout PR code
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-shared-services')
run: |
git fetch origin ${{ env.event_sha }}
git checkout FETCH_HEAD
- name: Azure Login
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-shared-services') || github.event_name != 'issue_comment'
uses: azure/login@v1
with:
creds: ${{ env.AZURE_CREDENTIALS }}
- name: Deploy
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-shared-services') || github.event_name != 'issue_comment'
run: |
cp -rs ${GITHUB_WORKSPACE}/* /tf/caf && cp -r ${GITHUB_WORKSPACE}/.devcontainer /tf/caf/
cd /tf/caf/enterprise_scale/construction_sets/aks/online/aks_secure_baseline/landingzone/
./scripts/deploy_level_with_rover.sh level1 shared_services
- name: Test
id: test
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-shared-services') || github.event_name != 'issue_comment'
run: |
cd /tf/caf/enterprise_scale/construction_sets/aks/online/aks_secure_baseline/test
export PREFIX="${{needs.deploy-launchpad.outputs.prefix}}"
echo "::set-output name=PREFIX::$PREFIX"
go test -v shared_services/shared_services_test.go
deploy-networking-hub:
runs-on: ubuntu-latest
needs: deploy-launchpad
container:
image: aztfmod/rover:1.0.1-2106.3012
options: --user 0
steps:
- name: Checkout Repository
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-networking-hub') || github.event_name != 'issue_comment'
uses: actions/checkout@v2
- name: Checkout PR code
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-networking-hub')
run: |
git fetch origin ${{ env.event_sha }}
git checkout FETCH_HEAD
- name: Azure Login
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-networking-hub') || github.event_name != 'issue_comment'
uses: azure/login@v1
with:
creds: ${{ env.AZURE_CREDENTIALS }}
- name: Deploy
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-networking-hub') || github.event_name != 'issue_comment'
run: |
cp -rs ${GITHUB_WORKSPACE}/* /tf/caf && cp -r ${GITHUB_WORKSPACE}/.devcontainer /tf/caf/
cd /tf/caf/enterprise_scale/construction_sets/aks/online/aks_secure_baseline/landingzone/
./scripts/deploy_level_with_rover.sh level1 networking_hub
- name: Test
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-networking-hub') || github.event_name != 'issue_comment'
run: |
echo "Invoke integration test"
deploy-networking-spoke:
runs-on: ubuntu-latest
needs: deploy-networking-hub
container:
image: aztfmod/rover:1.0.1-2106.3012
options: --user 0
steps:
- name: Checkout Repository
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-networking-spoke') || github.event_name != 'issue_comment'
uses: actions/checkout@v2
- name: Checkout PR code
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-networking-spoke')
run: |
git fetch origin ${{ env.event_sha }}
git checkout FETCH_HEAD
- name: Azure Login
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-networking-spoke') || github.event_name != 'issue_comment'
uses: azure/login@v1
with:
creds: ${{ env.AZURE_CREDENTIALS }}
- name: Deploy
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-networking-spoke') || github.event_name != 'issue_comment'
run: |
cp -rs ${GITHUB_WORKSPACE}/* /tf/caf && cp -r ${GITHUB_WORKSPACE}/.devcontainer /tf/caf/
cd /tf/caf/enterprise_scale/construction_sets/aks/online/aks_secure_baseline/landingzone/
./scripts/deploy_level_with_rover.sh level1 networking_spoke
- name: Test
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-networking-spoke') || github.event_name != 'issue_comment'
run: |
echo "Invoke integration test"
deploy-aks:
runs-on: ubuntu-latest
needs: [deploy-networking-hub, deploy-networking-spoke, deploy-shared-services]
container:
image: aztfmod/rover:1.0.1-2106.3012
options: --user 0
outputs:
prefix: ${{ steps.test.outputs.PREFIX }}
steps:
- name: Checkout Repository
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-aks') || github.event_name != 'issue_comment'
uses: actions/checkout@v2
- name: Checkout PR code
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-aks')
run: |
git fetch origin ${{ env.event_sha }}
git checkout FETCH_HEAD
- name: Azure Login
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-aks') || github.event_name != 'issue_comment'
uses: azure/login@v1
with:
creds: ${{ env.AZURE_CREDENTIALS }}
- name: Deploy
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-aks') || github.event_name != 'issue_comment'
run: |
cp -rs ${GITHUB_WORKSPACE}/* /tf/caf && cp -r ${GITHUB_WORKSPACE}/.devcontainer /tf/caf/
cd /tf/caf/enterprise_scale/construction_sets/aks/online/aks_secure_baseline/landingzone/
./scripts/deploy_level_with_rover.sh level2 aks
- name: Test
id: test
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-aks') || github.event_name != 'issue_comment'
run: |
cd /tf/caf/enterprise_scale/construction_sets/aks/online/aks_secure_baseline/test
export PREFIX="${{needs.deploy-shared-services.outputs.prefix}}"
echo "::set-output name=PREFIX::$PREFIX"
go test -v aks/aks_test.go
deploy-addons:
runs-on: ubuntu-latest
needs: deploy-aks
container:
image: aztfmod/rover:1.0.1-2106.3012
options: --user 0
steps:
- name: Checkout Repository
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-addons') || github.event_name != 'issue_comment'
uses: actions/checkout@v2
- name: Checkout PR code
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-addons')
run: |
git fetch origin ${{ env.event_sha }}
git checkout FETCH_HEAD
- name: Azure Login
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-addons') || github.event_name != 'issue_comment'
uses: azure/login@v1
with:
creds: ${{ env.AZURE_CREDENTIALS }}
- name: Deploy
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-addons') || github.event_name != 'issue_comment'
run: |
cp -rs ${GITHUB_WORKSPACE}/* /tf/caf && cp -r ${GITHUB_WORKSPACE}/.devcontainer /tf/caf/
cd /tf/caf/enterprise_scale/construction_sets/aks/online/aks_secure_baseline/landingzone/
./scripts/deploy_level_with_rover.sh level2 aks_secure_baseline /add-ons/aks_secure_baseline_v2
/tf/rover/rover.sh \
-lz /tf/caf/landingzones/caf_solution/add-ons/aks_secure_baseline_v2 \
-tfstate aks_secure_baseline.tfstate \
-level level2 \
-env $ENVIRONMENT \
-a output -json -o $(pwd)/rover.output
echo $(cat rover.output | jq -r .aks_clusters_kubeconfig.value.aks_kubeconfig_admin_cmd) | bash
- name: Test
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-addons') || github.event_name != 'issue_comment'
run: |
cd /tf/caf/enterprise_scale/construction_sets/aks/online/aks_secure_baseline/test
export PREFIX="${{needs.deploy-aks.outputs.prefix}}"
go test -v flux/flux_test.go
env:
KUBECONFIGPATH: /github/home/.kube/config
destroy-addons:
runs-on: ubuntu-latest
needs: deploy-addons
container:
image: aztfmod/rover:1.0.1-2106.3012
options: --user 0
steps:
- name: Checkout Repository
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-launchpad') || github.event_name != 'issue_comment'
uses: actions/checkout@v2
- name: Checkout PR code
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-launchpad')
run: |
git fetch origin ${{ env.event_sha }}
git checkout FETCH_HEAD
- name: Azure Login
if: contains(github.event.comment.body, '/destroy-all') || contains(github.event.comment.body, '/destroy-addons') || github.event_name != 'issue_comment'
uses: azure/login@v1
with:
creds: ${{ env.AZURE_CREDENTIALS }}
- name: Destroy
if: contains(github.event.comment.body, '/destroy-all') || contains(github.event.comment.body, '/destroy-addons') || github.event_name != 'issue_comment'
run: |
cp -rs ${GITHUB_WORKSPACE}/* /tf/caf && cp -r ${GITHUB_WORKSPACE}/.devcontainer /tf/caf/
cd /tf/caf/enterprise_scale/construction_sets/aks/online/aks_secure_baseline/landingzone/
./scripts/deploy_level_with_rover.sh level2 aks_secure_baseline /add-ons/aks_secure_baseline_v2
env:
ACTION: "destroy -auto-approve"
destroy-aks:
runs-on: ubuntu-latest
needs: [destroy-addons]
container:
image: aztfmod/rover:1.0.1-2106.3012
options: --user 0
steps:
- name: Checkout Repository
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-launchpad') || github.event_name != 'issue_comment'
uses: actions/checkout@v2
- name: Checkout PR code
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-launchpad')
run: |
git fetch origin ${{ env.event_sha }}
git checkout FETCH_HEAD
- name: Azure Login
if: contains(github.event.comment.body, '/destroy-all') || contains(github.event.comment.body, '/destroy-aks') || github.event_name != 'issue_comment'
uses: azure/login@v1
with:
creds: ${{ env.AZURE_CREDENTIALS }}
- name: Destroy
if: contains(github.event.comment.body, '/destroy-all') || contains(github.event.comment.body, '/destroy-aks') || github.event_name != 'issue_comment'
run: |
cp -rs ${GITHUB_WORKSPACE}/* /tf/caf && cp -r ${GITHUB_WORKSPACE}/.devcontainer /tf/caf/
cd /tf/caf/enterprise_scale/construction_sets/aks/online/aks_secure_baseline/landingzone/
./scripts/deploy_level_with_rover.sh level2 aks
env:
ACTION: "destroy -auto-approve"
destroy-shared-services:
runs-on: ubuntu-latest
needs: destroy-aks
container:
image: aztfmod/rover:1.0.1-2106.3012
options: --user 0
steps:
- name: Checkout Repository
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-launchpad') || github.event_name != 'issue_comment'
uses: actions/checkout@v2
- name: Checkout PR code
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-launchpad')
run: |
git fetch origin ${{ env.event_sha }}
git checkout FETCH_HEAD
- name: Azure Login
if: contains(github.event.comment.body, '/destroy-all') || contains(github.event.comment.body, '/destroy-shared-services') || github.event_name != 'issue_comment'
uses: azure/login@v1
with:
creds: ${{ env.AZURE_CREDENTIALS }}
- name: Destroy
if: contains(github.event.comment.body, '/destroy-all') || contains(github.event.comment.body, '/destroy-shared-services') || github.event_name != 'issue_comment'
run: |
cp -rs ${GITHUB_WORKSPACE}/* /tf/caf && cp -r ${GITHUB_WORKSPACE}/.devcontainer /tf/caf/
cd /tf/caf/enterprise_scale/construction_sets/aks/online/aks_secure_baseline/landingzone/
./scripts/deploy_level_with_rover.sh level1 shared_services
env:
ACTION: "destroy -auto-approve"
destroy-networking-spoke:
runs-on: ubuntu-latest
needs: destroy-aks
container:
image: aztfmod/rover:1.0.1-2106.3012
options: --user 0
steps:
- name: Checkout Repository
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-launchpad') || github.event_name != 'issue_comment'
uses: actions/checkout@v2
- name: Checkout PR code
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-launchpad')
run: |
git fetch origin ${{ env.event_sha }}
git checkout FETCH_HEAD
- name: Azure Login
if: contains(github.event.comment.body, '/destroy-all') || contains(github.event.comment.body, '/destroy-networking-spoke') || github.event_name != 'issue_comment'
uses: azure/login@v1
with:
creds: ${{ env.AZURE_CREDENTIALS }}
- name: Destroy
if: contains(github.event.comment.body, '/destroy-all') || contains(github.event.comment.body, '/destroy-networking-spoke') || github.event_name != 'issue_comment'
run: |
cp -rs ${GITHUB_WORKSPACE}/* /tf/caf && cp -r ${GITHUB_WORKSPACE}/.devcontainer /tf/caf/
cd /tf/caf/enterprise_scale/construction_sets/aks/online/aks_secure_baseline/landingzone/
./scripts/deploy_level_with_rover.sh level1 networking_spoke
env:
ACTION: "destroy -auto-approve"
destroy-networking-hub:
runs-on: ubuntu-latest
needs: destroy-networking-spoke
container:
image: aztfmod/rover:1.0.1-2106.3012
options: --user 0
steps:
- name: Checkout Repository
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-launchpad') || github.event_name != 'issue_comment'
uses: actions/checkout@v2
- name: Checkout PR code
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-launchpad')
run: |
git fetch origin ${{ env.event_sha }}
git checkout FETCH_HEAD
- name: Azure Login
if: contains(github.event.comment.body, '/destroy-all') || contains(github.event.comment.body, '/destroy-networking-hub') || github.event_name != 'issue_comment'
uses: azure/login@v1
with:
creds: ${{ env.AZURE_CREDENTIALS }}
- name: Destroy
if: contains(github.event.comment.body, '/destroy-all') || contains(github.event.comment.body, '/destroy-networking-hub') || github.event_name != 'issue_comment'
run: |
cp -rs ${GITHUB_WORKSPACE}/* /tf/caf && cp -r ${GITHUB_WORKSPACE}/.devcontainer /tf/caf/
cd /tf/caf/enterprise_scale/construction_sets/aks/online/aks_secure_baseline/landingzone/
./scripts/deploy_level_with_rover.sh level1 networking_hub
env:
ACTION: "destroy -auto-approve"
destroy-launchpad:
runs-on: ubuntu-latest
needs: [destroy-networking-hub, destroy-shared-services]
container:
image: aztfmod/rover:1.0.1-2106.3012
options: --user 0
steps:
- name: Checkout Repository
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-launchpad') || github.event_name != 'issue_comment'
uses: actions/checkout@v2
- name: Checkout PR code
if: contains(github.event.comment.body, '/deploy-all') || contains(github.event.comment.body, '/deploy-launchpad')
run: |
git fetch origin ${{ env.event_sha }}
git checkout FETCH_HEAD
- name: Azure Login
if: contains(github.event.comment.body, '/destroy-all') || contains(github.event.comment.body, '/destroy-launchpad') || github.event_name != 'issue_comment'
uses: azure/login@v1
with:
creds: ${{ env.AZURE_CREDENTIALS }}
- name: Launchpad
if: contains(github.event.comment.body, '/destroy-all') || contains(github.event.comment.body, '/destroy-launchpad') || github.event_name != 'issue_comment'
run: |
cp -rs ${GITHUB_WORKSPACE}/* /tf/caf && cp -r ${GITHUB_WORKSPACE}/.devcontainer /tf/caf/
/tf/caf/enterprise_scale/construction_sets/aks/online/aks_secure_baseline/landingzone/scripts/launchpad.sh
env:
ACTION: "destroy -auto-approve"
purge:
name: purge
runs-on: ubuntu-latest
if: ${{ failure() || cancelled() }}
needs: [deploy-launchpad, deploy-shared-services, deploy-networking-hub, deploy-networking-spoke,deploy-aks, deploy-addons, destroy-addons, destroy-aks, destroy-networking-spoke, destroy-networking-hub, destroy-shared-services, destroy-launchpad]
container:
image: aztfmod/rover:1.0.1-2106.3012
options: --user 0
steps:
- name: Login azure
run: |
az login --service-principal -u '${{ env.ARM_CLIENT_ID }}' -p '${{ env.ARM_CLIENT_SECRET }}' --tenant '${{ env.ARM_TENANT_ID }}'
az account set -s ${{ env.ARM_SUBSCRIPTION_ID }}
- name: Complete purge
run: |
for i in `az monitor diagnostic-settings subscription list -o tsv --query "value[?contains(name, '$ENVIRONMENT' )].name"`; do echo "purging subscription diagnostic-settings: $i" && $(az monitor diagnostic-settings subscription delete --name $i --yes); done
for i in `az monitor log-profiles list -o tsv --query '[].name'`; do az monitor log-profiles delete --name $i; done
# for i in `az ad group list --query "[?contains(displayName, '$ENVIRONMENT')].objectId" -o tsv`; do echo "purging Azure AD group: $i" && $(az ad group delete --verbose --group $i || true); done
# for i in `az ad app list --query "[?contains(displayName, '$ENVIRONMENT')].appId" -o tsv`; do echo "purging Azure AD app: $i" && $(az ad app delete --verbose --id $i || true); done
for i in `az keyvault list-deleted --query "[?tags.testing_job_id=='$ENVIRONMENT'].name" -o tsv`; do az keyvault purge --name $i; done
for i in `az group list --query "[?tags.testing_job_id=='$ENVIRONMENT'].name" -o tsv`; do echo "purging resource group: $i" && $(az group delete -n $i -y --no-wait || true); done
for i in `az role assignment list --query "[?contains(roleDefinitionName, '$ENVIRONMENT')].roleDefinitionName" -o tsv`; do echo "purging role assignment: $i" && $(az role assignment delete --role $i || true); done
for i in `az role definition list --query "[?contains(roleName, '$ENVIRONMENT')].roleName" -o tsv`; do echo "purging custom role definition: $i" && $(az role definition delete --name $i || true); done