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 Date: Wed, 17 Apr 2024 18:47:59 +0000 Subject: [PATCH 3/3] Commit from GitHub Actions (Create Powershell modules from script files) --- modules/plzm.Azure/plzm.Azure.psd1 | 6 +++--- modules/plzm.Azure/plzm.Azure.psm1 | 12 ++++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/modules/plzm.Azure/plzm.Azure.psd1 b/modules/plzm.Azure/plzm.Azure.psd1 index 8a94a62..1ac14ea 100644 --- a/modules/plzm.Azure/plzm.Azure.psd1 +++ b/modules/plzm.Azure/plzm.Azure.psd1 @@ -3,7 +3,7 @@ # # Generated by: Patrick El-Azem # -# Generated on: 03/14/2024 +# Generated on: 04/17/2024 # @{ @@ -12,13 +12,13 @@ RootModule = '.\modules\plzm.Azure\plzm.Azure.psm1' # Version number of this module. -ModuleVersion = '2.1' +ModuleVersion = '2.2' # Supported PSEditions # CompatiblePSEditions = @() # ID used to uniquely identify this module -GUID = '0bcb4f70-0028-4525-ae85-0df7ed367cff' +GUID = '6923ed40-81bd-4e16-b880-5d9886c145d7' # Author of this module Author = 'Patrick El-Azem' diff --git a/modules/plzm.Azure/plzm.Azure.psm1 b/modules/plzm.Azure/plzm.Azure.psm1 index bfea834..3c4db96 100644 --- a/modules/plzm.Azure/plzm.Azure.psm1 +++ b/modules/plzm.Azure/plzm.Azure.psm1 @@ -4134,12 +4134,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 }