Monday, December 16, 2024

Bicep Christmas gift: the deployer() function

The Bicep language for Azure Infrastructure as Code (IaC) continues to evolve rapidly, reshaping how developers and cloud architects design, deploy, and manage Azure resources.

In this post, we’ll explore an exciting new function introduced in Bicep version 0.32, highlighting how it enhances the language’s capabilities for Azure Infrastructure as Code (IaC). These additions reflect Bicep’s continuous evolution, making it even more powerful and versatile for developers working with Azure.

A common challenge in Azure Infrastructure as Code (IaC) is identifying and reusing the identity executing a deployment. This capability would enable assigning roles or configuring access dynamically without hardcoding identity details or managing them externally.

Currently, Bicep provides functions like subscription(), retrieving metadata about the subscription in which the deployment is running. However, there wasn’t a built-in way to access details about the principal executing the deployment.

With Bicep 0.32 you now can! The function deployer() is introduced, which allows you to retrieve the object of the principal that is deploying the Bicep file!

The function deployer() allows you to retrieve the objectId of the principal that is deploying the Bicep file

The ability to natively access the deploying principal within Bicep would eliminate the need for additional automation scripts or manual intervention, making deployments more streamlined and robust.

One practical use case for this functionality is generating unique GUIDs for scenarios such as creating role assignments. By leveraging the unique attributes of the deploying identity — such as its Object ID or Tenant ID — along with other contextual details, you can create deterministic and consistent GUIDs.

generating unique GUIDs

The deployer() function also proves valuable in scenarios involving Azure Entra ID. For instance, when creating an Entra group using the new Graph extension, you can seamlessly assign the current user (or deploying identity) to that group. This dynamic capability simplifies group membership management and eliminates the need for workarounds.

Upgrade to 0.32 to get access to the deployer() function!

As we wrap up, it’s exciting to see how features like the deployer() function are expanding the capabilities of Bicep, making Azure Infrastructure as Code more powerful and intuitive.

With the holiday season upon us, it’s the perfect time to reflect. Whether you’re deploying in the cloud or just enjoying some downtime, here’s wishing you a joyous holiday season and a fantastic start to the new year! Looking forward to 2025!

***

Originally posted here: https://www.linkedin.com/pulse/bicep-christmas-gift-deployer-function-freek-berson-a8hye

Introducing Bicep on the Go: a new series of short videos!

Bicep on the Go: a new series of short videos showcasing specific Bicep features, having fun with Infrastructure as Code, and maybe even interviews with #community members! 💪Let me know if you’re interested!

(2) Bicep on the Go — Trailer — YouTube

Bicep on the Go — Trailer

Last weekend, an idea popped up💡… I’ve been presenting on Bicep infrastructure as Code at conferences around the world for quite some time now. Usually, these are 45 to 60-minute break-out sessions. I always prefer doing all demos live, so I was thinking, why not publish these demos as short clips for everyone to consume on demand?

Hence, the inception of Bicep on the Go! Easy-to-digest content designed to help you jump-start your IaC development

Link https://www.youtube.com/playlist?list=PLGLjpco69i8MAIyTX094CtLtNBiW-7iQ4 to the playlist, which already contains episode 1, about #Github #Copilot and the #Bicep visualizer!

📽️Most recently, I presented at the EUC User Group in Stockholm, so this trailer and the first few of on-the-go clips were taken from that event. Special thanks to Kent Söderlund and Gabriel Yttermalm for hosting the amazing End User Computing Sweden event earlier this month and recording!

#Bicep #MVPBuzz #IaC