Azure / Azure/bicep

Allow declaration of deployment name in bicep file

Open
#10,129 11 comments 15 reactions 0 assignees View on GitHub
enhancement Needs: Upvote revisit
Dominant language
Bicep
Stars
3.6k
Forks
830
Avg merge
1d 21m
Merged PRs (30d)
79

Description

**Is your feature request related to a problem? Please describe.**
I guess it's a common thing that people name their main bicep file `main.bicep` cause this is how you can find the entrypoint if there is multiple files.
By default the `Microsoft.Resources/deployments` will be named after the filename `main`.
In automation scenarios this bears the risk for concurrent deployments to interfere with each other resulting in undefined behavior.
> For the details take a look here: https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/deploy-powershell#deployment-name
> Start reading from _If you run concurrent deployments ..._
> To me this almost sounds like someone making a bad joke :D

Yes it is possible to declare a deployment name as a commandline option.
However in my use-case I as a template author would like to define the deployment name inside the bicep file.
This would allow me to ship better quality templates as chances for conflicts is lower and consumers don't have to specify the deployment name as a commandline option.

**Describe the solution you'd like**
Add new keyword `deploymentName` to declare deployment name in bicep file.
A deployment name specified as commandline option should take precedence.

```bicep
targetScope = 'subscription'

var version = '7.1.0'

deploymentName = 'myproduct_${version}'

...
```

Contributor guide

Open the contributing guide

Research direction

Start with the main.bicep example and the deployment-name command-line option described in the issue. Define how a deploymentName declaration should work, including command-line precedence, and verify that the requested syntax supports the targetScope example.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
cloud, infrastructure
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.