Set Resource Group Location In Bicep

This blog post will show you how to set a resource group location inside a Bicep deployment using a built-in function.

Built-in Functions

Bicep built-in functions help us write cleaner and more effective code . Using the Bicep extension in VS Code we don’t need to reference documentation outside the code editor.

The extension is powered by Intellisense which auto-completes functions, resources and parameters.

Resource Group

To set the resource group using a function without hard coding the name, we use the following function.

location: resourceGroup().location

Below you see how it looks in action using. use the space key on your keyboard to active Intellisense.

About Azure Bicep

The Resource Manager template language Azure Bicep enables you to deploy Azure resources declaratively. It’s a domain-specific language, which implies it was created specifically for the purpose of deploying Azure resources. Bicep is only used to create Resource Manager templates.

Bicep is designed to be simple to understand and learn, regardless of your prior experience with other programming languages. Bicep templates can use all resource types, API versions, and property values.