bicep icon indicating copy to clipboard operation
bicep copied to clipboard

New-AzDeployment -What-If returns JSON error with imported User Defined Types using Azure Pipelines

Open russellds opened this issue 10 months ago • 2 comments

Bicep version

Bicep CLI version 0.26.170 (e9abaf16a5)

Describe the bug

When running New-AzDeployment -What-If with an imported User Defined Type I am getting the following Json error:

##[error]Additional content found in JSON reference object. A JSON reference object should only have a $ref property. Path 'naming.metadata'.

The weird thing is that this doesn't happen when I run it locally on my computer, only when I run it via Azure Pipelines. It doesn't matter if the Microsoft Hosted Agent is either Windows or Linux.

To Reproduce

Run New-AzDeployment -What-If from an Azure Pipeline with an imported User Defined Type.

Additional context

Here is my user defined type:

@export()
type namingType = {
  environment: string
  application: string
  applicationShort: string?
  component: string
  componentShort: string?
  location: string
}

russellds avatar May 03 '24 18:05 russellds

I suspect this may be an issue that was already fixed - is it possible Azure DevOps is running with an older version of the Az powershell modules?

Here are some changes that may be related: https://github.com/Azure/azure-powershell/pull/24140 https://github.com/Azure/azure-powershell/pull/24174 https://github.com/Azure/azure-powershell/pull/24282

anthony-c-martin avatar May 03 '24 18:05 anthony-c-martin

Hi @russellds, this issue has been marked as stale because it was labeled as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 3 days of this comment. Thanks for contributing to bicep! :smile: :mechanical_arm: