-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: azure hack for delete from az image rg with stopped vms
Signed-off-by: Adrian Riobo Lorenzo <[email protected]>
- Loading branch information
1 parent
3b8bda4
commit 8294b1f
Showing
2 changed files
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
|
||
az graph query -q "Resources | ||
| where type == 'microsoft.compute/virtualmachines' | ||
| where properties.extended.instanceView.powerState.code == 'PowerState/deallocated' | ||
| project resourceGroup" > groups.json | ||
|
||
jq -r 'recurse | scalars' groups.json > groups.list | ||
|
||
# Define the file path | ||
file="groups.list" | ||
|
||
# Read the file line by line | ||
while IFS= read -r line | ||
do | ||
echo "Processing resource group: $line" | ||
# Perform operations, e.g., delete the resource group | ||
az group delete --name $line --yes --no-wait | ||
done < "$file" |
File renamed without changes.