Publish Bicep modules to registries with the source.

Publish Bicep modules to registries with the source.

?? This post contains a hidden question. Find and answer it by replying to the post where I shared this article to win a paperback version of my Bicep book; I will draw 1 winner!! ??

Bicep offers the ability to store your modules in a registry in Azure. This is based on storing them in an Azure Container Registry (ACR).

This approach offers several advantages, especially regarding DevOps practices, version control, shared access, and reusability.

Let's consider the module below, which creates several Azure Virtual Desktop (AVD)- related resources, such as host pools, workspaces, and application groups.

Publishing your modules to an ACR is quite easy. In this example, I'll use Azure CLI. First, create an ACR in case you don't have one yet. Since an ACR is just another resource in Azure, you can use Bicep to create one, as shown below.

Now use the publish command, provide the bicep module you want to publish, and provide the target location, the ACR, and where you want to store it.

The result looks like the below: a container repository is visible under repositories.

You can now start using modules inside your Bicep templates. In the example below, I'm referencing the module stored in the ACR that creates the Azure Virtual Desktop resources.

Today, you already have the ability in VScode to view the source of the module; simply hit F12, and you are provided with the source.

This is, however, the transpiled version based on ARM Templates in JSON. Wouldn't you rather want to see the Bicep module instead? You now can.

There is an experimental feature called publishSource that you can add to your bicepconfig.json. Afterward, you can add the option --with-source to your publish command.

Based on the header image of this article, what country will I be visiting this month? Reply to this post with your answer to win a copy of my book!

When you now press F12 you can see the original Bicep module containing our AVD resources! ?? When you hover over the file name, you can see the source location, the ACR, module name, and version.

This makes working with Aure Container Registries a lot more convenient!

?? Looking to get started with Bicep? I authored and published the book Getting started with Bicep: Infrastructure as code on Azure

Drabdul Qadeer

?? SEO & Guest Posting Specialist | 4+ Years in Link Building | High DA Connections | SEO Reseller Expert ??

6 个月

yes

回复
Freek Berson

Empowering hybrid and remote workforces with a digital workspace from any device, anywhere. EUC Enthusiast, Microsoft MVP, ?? public speaker, ?? Author. #Parallels #Alludo #AVD #RDS #Bicep ?? #Automation

1 年

And the book's winner is...Vincent Klep! Congratulations! I'll contact you via DM to ensure you receive a copy. Thanks to everyone who joined the raffle! You can still order it here ?? : https://www.amazon.com/Getting-started-Bicep-Infrastructure-Azure/dp/B098WK3MR7 #Biceplang #Community #MVPBuzz

回复
??Anders Kristiansen

Security Lead Architect @ Storebrand CDC | MVP Microsoft Security

1 年

I guess you are hunting for northern lights in Norway ??????

Martin Ehrnst

Principal Architect @ Simplifai | Microsoft Azure MVP since 2019 | Platform Architecture Expert | Kubernetes lover and hater ??

1 年

I you're going to Norway, Finland, or Sweden- My guess is Spitsbergen, Norway. Anyway, I have some experience with ACR and Bicep modules, but I have never missed this feature. We had all modules (sources) stored in GIT and published from a pipeline. In what cases do you think this feature would be good to have?

Tor Ivar Asb?lmo

Azure IaC with Bicep and Terraform | GitHub code & CI/CD | Azure CAF Architect | DevOps-focused

1 年

Nice to know! Thanks for sharing ?? I don't use bicep as much because recent projects been all in on Terraform. You might want to wear a poncho or something to cover the third ARM when you visit us in Norway to see the Aurora ?? Hard to find jackets that fit, but it must be practical when writing bicep with both hands, while drinking coffee ??

要查看或添加评论,请登录

Freek Berson的更多文章

社区洞察