Skip to content

Commit

Permalink
Merge pull request #90 from plzm/develop
Browse files Browse the repository at this point in the history
Fix empty tags for ARM template
  • Loading branch information
plzm authored Apr 17, 2024
2 parents 0533e8a + 3199499 commit 938f943
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 11 deletions.
3 changes: 3 additions & 0 deletions azgraph.md
Original file line number Diff line number Diff line change
@@ -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"

6 changes: 3 additions & 3 deletions modules/plzm.Azure/plzm.Azure.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Generated by: Patrick El-Azem
#
# Generated on: 03/14/2024
# Generated on: 04/17/2024
#

@{
Expand All @@ -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'
Expand Down
12 changes: 8 additions & 4 deletions modules/plzm.Azure/plzm.Azure.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
12 changes: 8 additions & 4 deletions scripts/AzureUtility.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 938f943

Please sign in to comment.