forked from sodalabsab/scalingcloud
-
Notifications
You must be signed in to change notification settings - Fork 0
26 lines (22 loc) · 945 Bytes
/
tare-down-workflow.yml
File metadata and controls
26 lines (22 loc) · 945 Bytes
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
name: Delete Azure Resource Group
on:
workflow_dispatch: # Allows manual triggering of the workflow
jobs:
delete-resource-group:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
# Step 1: Log in to Azure using the stored credentials
- name: Log in to Azure
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
# Step 2: Delete the Resource Group using Azure CLI
- name: Delete Resource Group
run: |
# Get all resource groups with the tag 'Project: Lab' and delete them
az group list --subscription ${{ secrets.AZURE_SUBSCRIPTION_ID }} --tag Project=scalingCloudLab --query "[].name" -o tsv | xargs -I {} az group delete --name {} --subscription ${{ secrets.AZURE_SUBSCRIPTION_ID }} --yes --no-wait