Skip to content

Commit

Permalink
Update nightly Bicep pipelines resource clean up scripts (#567)
Browse files Browse the repository at this point in the history
  • Loading branch information
glennmusa authored Dec 8, 2021
1 parent d92fb50 commit d2441cb
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
17 changes: 15 additions & 2 deletions .azure-devops/nightlybuild/mlz-bicep-azurecloud-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,13 @@ jobs:
azureSubscription: $(ServiceConnectionName)
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: 'az monitor diagnostic-settings subscription list --query "value[? contains(@.name, ''$1'')].name" -o table |grep ''mlz''| awk ''{system(" az monitor diagnostic-settings delete --resource ''"/subscriptions/$(subId)"'' --name "$1)}'''
inlineScript: |
az monitor diagnostic-settings subscription list \
--query "value[].name" \
--output tsv \
| xargs -t -I % az monitor diagnostic-settings subscription delete \
--yes \
--name %
- task: AzureCLI@2
displayName: "Clean up Resources"
Expand All @@ -106,4 +112,11 @@ jobs:
azureSubscription: $(ServiceConnectionName)
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: 'az group list -o table | grep ''mlz'' | awk ''{system("az group delete -y --no-wait -g "$1)}'''
inlineScript: |
az group list \
--query "[].name" \
--output tsv \
| xargs -t -I % az group delete \
--yes \
--no-wait \
--name %
17 changes: 15 additions & 2 deletions .azure-devops/nightlybuild/mlz-bicep-azuregov-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,13 @@ jobs:
azureSubscription: $(GServiceConnectionName)
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: 'az monitor diagnostic-settings subscription list --query "value[? contains(@.name, ''$1'')].name" -o table |grep ''mlz''| awk ''{system(" az monitor diagnostic-settings delete --resource ''"/subscriptions/$(GSubId)"'' --name "$1)}'''
inlineScript: |
az monitor diagnostic-settings subscription list \
--query "value[].name" \
--output tsv \
| xargs -t -I % az monitor diagnostic-settings subscription delete \
--yes \
--name %
- task: AzureCLI@2
displayName: "Clean up Resources"
Expand All @@ -105,4 +111,11 @@ jobs:
azureSubscription: $(GServiceConnectionName)
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: 'az group list -o table | grep ''mlz'' | awk ''{system("az group delete -y --no-wait -g "$1)}'''
inlineScript: |
az group list \
--query "[].name" \
--output tsv \
| xargs -t -I % az group delete \
--yes \
--no-wait \
--name %

0 comments on commit d2441cb

Please sign in to comment.