Azure pipelines fail to expand and use bicep template with error:
Failed to expand bicep source '...\application-insights.bicep'. Exception calling "GetBicepResources" with "3" argument(s): "Unable to expand resources because the source file '...\application-insights.bicep' was not valid. An error occurred evaluating expression '[parameters('resourceTags')]' line 0. The parameter named 'resourceTags' was not set or a defaultValue was defined."
AZURE_BICEP_FILE_EXPANSION: true
AZURE_BICEP_FILE_EXPANSION_TIMEOUT: 60
AZURE_PARAMETER_DEFAULTS:
...
resourceTags:
env: "test"
#string parameters seem to work fine
run Azure DevOps pipeline with above configuration targeting .bicep template that has input parameter with type object
Expected behaviour
Default parameter value for type Object is passed from ps-rule.yaml file
Error output
Failed to expand bicep source '...\application-insights.bicep'. Exception calling "GetBicepResources" with "3" argument(s): "Unable to expand resources because the source file '...\application-insights.bicep' was not valid. An error occurred evaluating expression '[parameters('resourceTags')]' line 0. **The parameter named 'resourceTags' was not set or a defaultValue was defined.**"
Module in use and version:
From Azure DevOps pipeline:
Using PSRule v2.0.0+ae35a2ed4f7463f36a1f2a1ea1901b9cc932d5e9
Using PSRule.Rules.Azure v1.14.0
Description of the issue
Azure pipelines fail to expand and use bicep template with error: Failed to expand bicep source '...\application-insights.bicep'. Exception calling "GetBicepResources" with "3" argument(s): "Unable to expand resources because the source file '...\application-insights.bicep' was not valid. An error occurred evaluating expression '[parameters('resourceTags')]' line 0. The parameter named 'resourceTags' was not set or a defaultValue was defined."
in ps-rule.yaml we have it defined as (took example from https://github.com/Azure/PSRule.Rules.Azure/blob/0f63b3fe7c42a86607cbc9dd86699c90f97d32ac/tests/PSRule.Rules.Azure.Tests/ps-rule-options.yaml):
.bicep template have these params:
pipeline task:
To Reproduce
Steps to reproduce the issue:
Expected behaviour
Default parameter value for type Object is passed from ps-rule.yaml file
Error output
Module in use and version:
From Azure DevOps pipeline:
Additional context