I am trying to deploy a test bicep file in Azure DevOps. I created a simple keyvault, exported the ARM template, then decompiled it to a bicep file in VS Code. I am using v3.* (I'm not sure how to find the exact version) of the ARM template deployment task in my pipeline. I have Azure CLI and bicep CLI installed on the agent (Bicep CLI version 0.32.4 and Azure-CLI 2.67.0). I keep getting this error:
2025-01-14T00:25:21.8280483Z ##[error]Error: Ensure the Template file ( 'F:\Pipeline\agent\_work\r6\a\_TEST\drop\prereqs-keyvault.bicep' ) is valid. Task failed while parsing with following error: Unexpected token p in JSON at position 0
I get it no matter what bicep file I try. It almost seems like it is expecting an ARM instead of a bicep but from what I researched, it does handle bicep files. The bicep file is valid. The first line of my file defines the params so it seems like it chokes at the very beginning. I'm not sure what the issue is. It's pretty barebones but here is my yaml:
steps:
- task: AzureResourceManagerTemplateDeployment@3
displayName: 'ARM Template deployment: Resource Group scope'
inputs:
azureResourceManagerConnection: 'dev zone'
subscriptionId: 'CENSORED'
resourceGroupName: 'RGP-02'
location: 'US Virginia'
csmFile: 'F:/Pipeline/agent/_work/4/s/IaC/test-template.bicep'
overrideParameters: '-ENV dev'
I the issue with any bicep file, even this example:Bicep Playground Any ideas?
EDIT: I have some more information that might be relevant. I did some digging and troubleshooting and I think it might have something to do with user permissions. I read that the task uses the AZURE_CONFIG_DIR variable for the location of the bicep binary. Also, the Windows service uses the NT AUTHORITY\NETWORK SERVICE. I think the service just doesn't have the right permissions or something and changing the AZURE_CONFIG_DIR to a directory it has access to didn't seem to help. There might be something else I am overlooking. Changing the user that the service runs on might work, but I would have to convince the powers that be to do so.