Closed
Description
Description
I am passing a HashTable of tags as a value for the Tags parameter as the directions state, but this does not work.
Platforms affected
- Azure DevOps
- GitHub Actions - Standard Runners
- GitHub Actions - Larger Runners
Runner images affected
- Ubuntu 22.04
- Ubuntu 24.04
- macOS 13
- macOS 13 Arm64
- macOS 14
- macOS 14 Arm64
- macOS 15
- macOS 15 Arm64
- Windows Server 2019
- Windows Server 2022
- Windows Server 2025
Image version and build link
I am using the Manual Image Generation Customization
main branch
Is it regression?
no
Expected behavior
I first create the hash table.
$Tags = @{ "BusinessUnit" = "Infrastructure" "ProjectName" = "GitHub Runners" }
I then run the script.
GenerateResourcesAndImage -Tags $Tags
Actual behavior
I get the error:
Packer template validation failed.
At C:\repos\.Public\runner-images\helpers\GenerateResourcesAndImage.ps1:224 char:9
+ throw "Packer template validation failed."
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Packer template validation failed.:String) [], RuntimeException
+ FullyQualifiedErrorId : Packer template validation failed.
Repro steps
I have also tried endless different types of syntax to feed tags directly as a parameter but always get the error:
`GenerateResourcesAndImage : Cannot process argument transformation on parameter 'Tags'. Cannot convert the
"BusinessUnit=Infrastructure" value of type "System.String" to type "System.Collections.Hashtable".
At line:1 char:33
- GenerateResourcesAndImage -Tags BusinessUnit=Infrastructure
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : InvalidData: (:) [GenerateResourcesAndImage], ParentContainsErrorRecordException
- FullyQualifiedErrorId : ParameterArgumentTransformationError,GenerateResourcesAndImage`