Questions tagged [azure-bicep]

Bicep is a Domain Specific Language (DSL) for deploying Azure resources declaratively. It aims to drastically simplify the authoring experience with a cleaner syntax and better support for modularity and code re-use. Bicep compiles down to standard ARM Template JSON files, which means the ARM JSON is effectively being treated as an Intermediate Language (IL).

Bicep is an alternative to using terraform as Infrastructure-as-Code to programmatically create, modify or destroy Azure resources.

A productive aspect of Bicep is the ability to take a snapshot of an existing Azure resource then compile that snapshot into the Bicep language to be used as a template from which to manage such a resource.

A common usage pattern is to execute your Bicep code in an Azure pipeline to engage its definitions to manage resources

688 questions
2
votes
1 answer

How do I lookup an existing roleDefinition ID by name using Bicep?

I want to look up the roleDefinition ID in Azure to allow me to use a role name rather than ID - as it is more user friendly This is what I have tried param roleDefinitionName string = '' resource existingRoleDefinition…
2
votes
1 answer

Azure Bicep\ARM - Get shortened region name for resource naming

I am trying to write a generic Bicep file that creates a storage account. I am trying to following the standard naming convention when creating the resource, eg: it would be something like st<###>. What I want to do is…
dan
  • 45
  • 3
2
votes
1 answer

Validate Azure Bicep string variable's length before deployment

Similar to how a Bicep Module input parameter can be validated (e.g. allowed string length), is it possible to validate a string variable's length? param input1 string param input2 string var combo = '${input1}${input2}' // Validate length of…
2
votes
1 answer

Azure Bicep - Timing of Dependent Module

I'd like a module that could add a fixed set of ip restriction rules to an existing app service (function app in this case). I have added a call to a "ipSecurityRestrictions" module from my main.bicep as follows: module ipRestrictions…
Rob Bowman
  • 7,632
  • 22
  • 93
  • 200
2
votes
1 answer

Referencing resource created in one module in another module Azure Bicep?

Suppose I have two files/modules in Azure Bicep, both are called in a 'main.bicep'. One is called 'storage.bicep' and contains, among others, the following code to create a storageAccount: resource storageAccountTemp…
Tim
  • 147
  • 8
2
votes
1 answer

Azure Bicep - What if command showing resource changes when deploying with the same template

I am new to using Azure bicep. I am trying to deploy a simple app service plan/app service with the following bicep file: resource azBicepAsp1 'Microsoft.Web/serverfarms@2020-12-01' = { name: 'test-dev-aue-asp1' location:…
dan
  • 45
  • 3
2
votes
1 answer

Assign NSG to VNet subnet using Bicep template

I want to add an existing NSG to existing VNet subnet. I tried doing it this way: @description('Name of nsg') param nsgName string @description('Name of vnet') param vnetName string @description('Name of subnet') param subnetName string resource…
2
votes
1 answer

How to get Azure AD Group in Bicep to create SQL Server with azureADOnlyAuthentication

Is there a way to create or access an existing Azure AD Group using Azure Bicep. The scenario is that I want to create an Azure SQL Database, but in order to do so I need to create a server first. I want to create the server with an AD group as an…
lcj
  • 1,355
  • 16
  • 37
2
votes
1 answer

Azure Bicep - Referencing a variable that cannot be calculated at the start

I need to: create a data factory create a storage account create a function app add a role assignment for the data factory to the storage account add a role assignment for the function app to the storage account The data factory is created in a…
Rob Bowman
  • 7,632
  • 22
  • 93
  • 200
2
votes
1 answer

How can I create a resource group and add a key vault to it using Bicep?

I'm trying to create a resource group and add a key vault to it. However, I'm not able to set the new resource group as a target resource group for the key vault. How can I have the key vault assigned to the newly created resource group without…
AxD
  • 2,714
  • 3
  • 31
  • 53
2
votes
3 answers

Microsoft Azure: 'New-AzResourceGroupDeployment : A parameter cannot be found that matches parameter name 'location'

I'm a beginner at Microsoft Azure so please bear with me. I'm following this tutorial on deploying bicep templates with parameters, my bicep file is the exact same as the one in the tutorial. However, when I attempt to deploy it I get the following…
Lucas
  • 33
  • 6
2
votes
1 answer

roleAssignment with current user id

I'm using Azure AD app registration principles to deploy resources via Azure Resource Manager to deploy via Pipelines. During the deployment I need to set some permissions to the deployment user to ensure it has enough permission to - for example -…
2
votes
2 answers

How to deploy App Service with managed SSL certificate using ARM

I want create an Azure App Service with a custom hostname binding and a managed SSL certificate. When I create a single Bicep-template, the certificate resource can only be deployed if the hostname binding is already created. But to create a…
2
votes
1 answer

How to assign correct roles on Service Bus entities to Azure functions managed identity with Bicep?

I have an Azure Functions project, with a Function that uses a Service Bus binding (that is used to Listen on a subscription and to Send to a topic). The Azure functions deployment is running under a managed identity. And as we want to deploy…
2
votes
1 answer

Bicep modules and loop

how I can use loop in modules in Bicep? I mean like this. module vnet01 'vNet.bicep' = [ for vnet in vnets : { name: vnet.name scope: virtualNetworkRg params: { vnetName: vnet.name vnetAddressPrefix:…
Stefan
  • 555
  • 5
  • 18