Closed
Description
New issue checklist
- I searched for existing GitHub issues
- I read pipeline troubleshooting guide
- I checked how to collect logs
Task name
AzureResourceManagerTemplateDeployment
Task version
3
Issue Description
I have the following in my yaml file
- task: AzureResourceManagerTemplateDeployment@2
displayName: "Provision test environment"
inputs:
azureResourceManagerConnection: ${{ variables.azureSubscription }}
resourceGroupName: ${{ variables.resourceGroupName }}
location: ${{ variables.location }}
csmFile: "$(Pipeline.Workspace)/software/Deployment/Test.bicep"
overrideParameters: >-
-isDevEnvironment False
And this is my bicep file
@description('Indicates if it is a dev environment')
param isDevEnvironment bool
resource consumptionHostingPlan 'Microsoft.Web/serverfarms@2022-03-01' = if (isDevEnvironment) {
name: 'test'
location: resourceGroup().location
sku: {
name: 'Y1'
tier: 'Dynamic'
}
properties: {}
}
resource premiumHostingPlan 'Microsoft.Web/serverfarms@2022-03-01' = if (!isDevEnvironment) {
name: 'test'
location: resourceGroup().location
sku: {
name: 'EP1'
tier: 'ElasticPremium'
}
kind: 'elastic'
properties: {
maximumElasticWorkerCount: 100
}
}
I get the following error:
2023-11-23T11:54:14.6917754Z There was an error while overriding 'isDevEnvironment' parameter because of 'SyntaxError: Unexpected token F in JSON at position 0', make sure it follows JavaScript Object Notation (JSON)
2023-11-23T11:54:15.4211233Z Starting template validation.
2023-11-23T11:54:15.5491241Z Deployment name is Test-20231123-115415-0112
2023-11-23T11:54:15.7593371Z There were errors in your deployment. Error code: InvalidTemplate.
2023-11-23T11:54:15.7636920Z ##[error]Deployment template validation failed: 'The provided value for the template parameter 'isDevEnvironment' is not valid. Expected a value of type 'Boolean', but received a value of type 'String'. Please see https://aka.ms/arm-create-parameter-file for usage details.'.
2023-11-23T11:54:15.7651178Z ##[warning]Validation errors were found in the Azure Resource Manager template. This can potentially cause template deployment to fail. Task failed while creating or updating the template deployment.. Please follow https://docs.microsoft.com/en-us/azure/azure-resource-
If I send false
instead of False
(lowercase) it works fine. But in a real case, the boolean comes from a variable and it is not lowercase.
I have the same error if I use AzureResourceGroupDeployment
Using azure cli, works fine
- task: AzureCLI@2
displayName: "Provisioning test environment"
inputs:
azureSubscription: '${{ variables.azureSubscription }}'
scriptType: pscore
scriptLocation: inlineScript
inlineScript: |
az deployment group create `
--name "test" `
--resource-group "${{ variables.resourceGroupName }}" `
--mode "Complete" `
--template-file `
"$(Pipeline.Workspace)/software/Deployment/Test.bicep" `
--parameters `
isDevEnvironment=False
Environment type (Please select at least one enviroment where you face this issue)
- Self-Hosted
- Microsoft Hosted
- VMSS Pool
- Container
Azure DevOps Server type
dev.azure.com (formerly visualstudio.com)
Azure DevOps Server Version (if applicable)
No response
Operation system
Windows 10
Relevant log output
2023-11-23T11:54:14.6917754Z There was an error while overriding 'isDevEnvironment' parameter because of 'SyntaxError: Unexpected token F in JSON at position 0', make sure it follows JavaScript Object Notation (JSON)
2023-11-23T11:54:15.4211233Z Starting template validation.
2023-11-23T11:54:15.5491241Z Deployment name is Test-20231123-115415-0112
2023-11-23T11:54:15.7593371Z There were errors in your deployment. Error code: InvalidTemplate.
2023-11-23T11:54:15.7636920Z ##[error]Deployment template validation failed: 'The provided value for the template parameter 'isDevEnvironment' is not valid. Expected a value of type 'Boolean', but received a value of type 'String'. Please see https://aka.ms/arm-create-parameter-file for usage details.'.
2023-11-23T11:54:15.7651178Z ##[warning]Validation errors were found in the Azure Resource Manager template. This can potentially cause template deployment to fail. Task failed while creating or updating the template deployment.. Please follow https://docs.microsoft.com/en-us/azure/azure-resource-
Full task logs with system.debug enabled
No response
Repro steps
No response