Private Bicep Module Registry


Since it is now possible to create your own private Bicep module registries, I wanted to write a short article on this. I have been using Bicep on and off for a little while, and it keeps getting better and better!

Version 0.4.1008 is the one you need to install if you want to test this functionality. Please be aware of the following (as stated in release notes):

I did not initially take in what this update meant, but pretty soon realized. When I tried to run az bicep publish, it just wouldn’t work. This will also apply for using Bicep via PowerShell module. Since I have been using the very practical “az bicep”-command, I had to update my “machine” version of Bicep. This is easy, and fast. You can find guidance here.


You need:

  • An Azure account
  • Visual Studio Code
  • WSL or access to Linux
    • You can use PowerShell and Windows, but then you need to mind the line breaks (” / “) for commands over multiple lines.
  • Bicep installed
  • Azure CLI installed

Private registry

With Bicep v0.4.1008, you can use private module registry, and this is achieved with using an Azure Container Registry. This means that you need to create an ACR for storing your modules. Of course I created this with Bicep! You can find the bicep file i used here. Deployment with this command:

az login
az account set -s <your subscription name or id>

az group create --name <your group> --location <location>

az deployment group create \
  --resource-group <your group> \
  --name MyBicepDeploymentTesting \
  --location <location> \
  --template-file deploy.bicep

You can also create this registry directly with Az CLI if you prefer. I just like to use Bicep whenever I can now.

Make sure you record the loginserver, because you will need this later. This information will be output by deployment via provided Bicep file.

Create or copy Module

You can get a basic Bicep module from anywhere, but I have not tested with nested modules. You can use any Bicep file you have lying around, if it is somewhat generalized. For simplicity, you can use this basic ACR module for testing purposes.

My guess is that when Bicep public module registries become supported, we will see this useful Microsoft repository transformed to a public registry. After that, everyone can hopefully refer to central modules created and curated by Microsoft + the open source community. This takes Bicep another step towards Terraform.

Publish Module

bicep publish <your module filename> --target br:<your acr login server>/<modulename>:<version>

Please note that you can choose whichever storage structure you like. The “br:” in front denotes Bicep Registry schema, and is required. Versioning is up to you. For my testing, I have used “v1″,”v2″,”v3”, etc., but any versioning will do. SemVer or SimVer is probably the best approach in a more important scenario. The feature is not in GA yet, so it shouldn’t be used in production environments anyway.

Consume Module

When it comes to using your modules hosted in a Private Registry, it is as simple as referencing it from your main bicep file.

I created an ACR, and published a module like this:

az group create --name tia-biceptest-rg --location norwayeast

az deployment group create \
  --resource-group tia-biceptest-rg \
  --name MyBicepDeploymentTesting \
  --location norwayeast \
  --template-file deploy.bicep

output -

bicep publish acr.bicep --target ''

After this is created, and module is published, I can use it in VSCode like this:

module containerRegistry '' = {
  name: 'acrDeploy'
  params: {
    acrName: 'deploytest1234'
    prefix: 'acr'

VSCode will check to see if your module is available, and will notify you if it is not. This obviously requires Bicep extension installed on your VSCode.

You can find some more information on private Bicep modules registry from Microsoft here.

In summary

I like the possibility of hosting a private module registry for internal consumption. This gives nice possibilities of having curated internal modules, for use by your teams. TemplateSpecs are also supported by Bicep now, but this is lacking documentation as of now. I will start testing this when it is more mature, and documentation from Microsoft is more available.

This is a great new feature for Bicep, and will be used by many going forward. What I am more exited about, is the fact that public repositories will be available in v0.5! I expect this version will be released around Ignite, which is early November. Stay tuned for the next version!


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.