You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using Bicep to develop and maintain the source code for the Azure WebLogic on AKS marketplace offer. The marketplace requires converting Bicep scripts to ARM templates, following this ARM structure, where the resources section must be an array.
However, when building with bicep build or az bicep build, I receive an object instead of an array for the resources section, leading to a Partner Center error: Package acceptance validation error: JsonSchemaValidationError The json file 'mainTemplate.json' is invalid for the provided schema. Line Number: '0', Error: 'Invalid type. Expected Array but got Object.'
I traced this issue to user-defined functions in the Bicep script. Without them, the resources section builds correctly as an array. You can view the built ARM template and error in this GitHub action.
To Reproduce
Bicep script without user defined function. Run az bicep build -f main.bicep to build the following content.
galiacheng
changed the title
az bicep build builds inconsistent ARM template
Bicep build generates Object instead of Array for resources when using user-defined functions
Oct 8, 2024
I would expect there to be documentation specifying which features trigger a language version 2.0 template, as the Java EE on Azure team uses Bicep extensively to build marketplace offers.
Bicep version
0.30.23
Describe the bug
I am using Bicep to develop and maintain the source code for the Azure WebLogic on AKS marketplace offer. The marketplace requires converting Bicep scripts to ARM templates, following this ARM structure, where the
resources
section must be an array.However, when building with
bicep build
oraz bicep build
, I receive an object instead of an array for theresources
section, leading to a Partner Center error: Package acceptance validation error: JsonSchemaValidationError The json file 'mainTemplate.json' is invalid for the provided schema. Line Number: '0', Error: 'Invalid type. Expected Array but got Object.'I traced this issue to user-defined functions in the Bicep script. Without them, the
resources
section builds correctly as an array. You can view the built ARM template and error in this GitHub action.To Reproduce
Bicep script without user defined function. Run
az bicep build -f main.bicep
to build the following content.Got ARM template as following, type of
resources
is Array.Bicep script with user defined function. Run
az bicep build -f main.bicep
to build the following content.Got ARM template as following, type of
resources
is Object.Additional context
The expected outcome is that, in both cases, the
resources
section should be an array, consistent with the ARM template definition.The text was updated successfully, but these errors were encountered: