'Can you deploy bicep template with AzureResourceGroupDeployment task?

Can you deploy directly bicep templates within a devops pipeline as in the following task? I keep getting issues about not being able to find the file so I'm wondering whether this task is just for json artifact deployment and not .bicep files

  - task: AzureResourceGroupDeployment@3
    displayName: "X) AzureResourceGroupDeployment"
    enabled: true
    inputs:
      azureSubscription: ${{parameters.azureServiceConnection}}
      action: 'Create Or Update Resource Group' # Options: create Or Update Resource Group, select Resource Group, start, stop, stopWithDeallocate, restart, delete, deleteRG
      resourceGroupName: "$(resourceGroupNameVar)"
      location: "${{parameters.location}}" # Required when action == Create Or Update Resource Group
      templateLocation: 'Linked artifact' # Options: linked Artifact, uRL Of The File
      csmFile: bicep/modules/storageAccount.bicep # Required when  TemplateLocation == Linked Artifact


Solution 1:[1]

With version 3 of the task, no. You have to transpile the Bicep to JSON first. i.e.

- script: | 
    az bicep install 
    az bicep build -f $BICEP_FILE_PATH
  displayName: 'Build Bicep'
  env:
    BICEP_FILE_PATH: ${{ parameters.BicepPath }}/${{ parameters.BicepTemplateName}}.bicep

Alternately, you could skip using the task and just use the az deployment command.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Daniel Mann