Using the new .bicepparam file!

No more JSON Parameter files!?

Well, nearly. The .bicepparam feature is still in experimental mode currently, but looks to be coming soon as part of the future Bicep releases.

If you’ve worked on ARM templates or Bicep you will be very familiar with the joys of working with a JSON parameters file. It can be painful, tedious and cumbersome.

So what will the new feature bring? The beauty of bicepifying the parameter file!

How to enable the .biceppram feature on?

Make sure you’ve updated your Bicep to at least release v0.16.1 as per Release v0.16.1 · Azure/bicep · GitHub & have the Bicep VSCode Bicep extension installed.

The new bicepparam feature has now gone GA: Create parameters files for Bicep deployment – Azure Resource Manager | Microsoft Learn

Make sure you have upgraded to the latest bicep version. The rest of the guide is still relevant.

az bicep upgrade
az bicep version

Now we’re on the latest bicep release, we need to enable the experimental feature using the bicepconfig.json file like so:

If you’ve not got a bicepconfig.json file you can create one by following the official documentation for a step-by-step guide.

How to use the .bicepparam file?

Once all the above has been enabled we can start using .bicepparam in VSCode!

  • Create your file.bicepparam

Then you’ll need to specify the main bicep file you want it to reference:

using 'main.bicep'

And just like the JSON parameters, you can reference them in this file by in a more Bicep friendly manner, as an example:

prod.bicepparam:

using 'main.bicep'
param orgPrefix = 'rios'
param regionSh = 'uks'
param location = 'uksouth'
param tags = {
  Demo: 'Demo'
  Owner: 'Dan Rios'
  Env: 'Dev'
}

main.bicep:

targetScope = 'subscription'
// Resource Group Params
param orgPrefix string
param regionSh string
param location string 
param tags object

resource rg ''Microsoft.Resources/resourceGroups@2021-04-01' = {
  name: 'rg-demo'
  params:{
    parLocation: location
    parResourceGroupName: 'rg-${orgPrefix}-${regionSh}-demo'
    parTags: tags
  }
}

How to deploy?

In Azure CLI:

az login
az account show --output table
az account set --subscription "SubscriptionName"
az deployment sub what-if -l uksouth -f .\main.bicep -p .\prod.bicepparam 
az deployment sub create -n 'deployRG' -l uksouth -f .\main.bicep -p .\prod.bicepparam 

What-If shows us that the resource group will be deployed:

Now we’re happy knowing what is about to deploy we can switch to the create cmdlet to proceed – all done!

    "provisioningState": "Succeeded",
    "templateHash": "13799875250777117000",
    "templateLink": null,
    "timestamp": "2023-04-17T19:29:45.782399+00:00",
    "validatedResources": null
  },

Goodbye JSON params!

Although this is still an experimental feature, so subject to change I’m sure it’s much nicer to use the parameter file with it being now aligned to the Bicep language. It’s easy to use, intuitive and looks nicer to read.

That will be especially important when the files are large, which is where JSON param files can be a bit of a mess to read over. Bring on the official release!

Skip to content