From b3e3a128cf2c091ee9904edeebb9cd38c20b86f0 Mon Sep 17 00:00:00 2001 From: Patrick El-Azem
Date: Wed, 27 Mar 2024 08:19:44 -0400 Subject: [PATCH 1/3] Add file to progressively gather useful az graph queries --- azgraph.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 azgraph.md diff --git a/azgraph.md b/azgraph.md new file mode 100644 index 0000000..cf63255 --- /dev/null +++ b/azgraph.md @@ -0,0 +1,3 @@ +# CLI command to list all resources of type storage account which have a tag with specified name and value +az graph query -q "Resources | where type =~ 'Microsoft.Storage/storageAccounts' | where tags['foo'] =~ 'bar' | project id" + From 6f2dc0f06fab7d5cf502990424dcb0e264d6e8a1 Mon Sep 17 00:00:00 2001 From: Patrick El-Azem
Date: Wed, 17 Apr 2024 14:47:26 -0400
Subject: [PATCH 2/3] Fix empty tag for ARM template
---
scripts/AzureUtility.ps1 | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/scripts/AzureUtility.ps1 b/scripts/AzureUtility.ps1
index fde752b..d83f472 100644
--- a/scripts/AzureUtility.ps1
+++ b/scripts/AzureUtility.ps1
@@ -19,12 +19,16 @@ function Get-TagsForArmTemplate()
{
$tagKVArray = $tagKVPair.Split("=")
$tagsObject[$tagKVArray[0]] = $tagKVArray[1]
+
+ $tagsForArm = ConvertTo-Json -InputObject $tagsObject -Compress
+ $tagsForArm = $tagsForArm.Replace('"', '''')
+ $tagsForArm = "`"$tagsForArm`""
}
}
-
- $tagsForArm = ConvertTo-Json -InputObject $tagsObject -Compress
- $tagsForArm = $tagsForArm.Replace('"', '''')
- $tagsForArm = "`"$tagsForArm`""
+ else
+ {
+ $tagsForArm = $null
+ }
return $tagsForArm
}
From 31994993c922adc1356b20fab6cfeb7f4bca6e12 Mon Sep 17 00:00:00 2001
From: plzm