Allow declaration of deployment name in bicep file
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.
targetScope = 'subscription'
var version = '7.1.0'
deploymentName = 'myproduct_${version}'
...
We are planning to add support for "deploy" settings in the bicep params file as per #7301:

No ETA on when this will be implemented, but if that is where this setting lived would it work for you?
@alex-frankel may be support for deployment stack should also be added so from bicep file you define deployment stack deployment.
Agreed - ideally the command just becomes az deploy -f foo.bicepparam and everything needed is in that file. Or maybe even az deploy with a convention to look for something like main.bicepparam
@alex-frankel From the functional point it would work out. However if you see the bicep params as the template consumer owned part and the main.bicep as the template provider then I would prefer to have a way to define the deployment name as the template provider.
Also it might come handy to allow defining the tags of the deployment, as you could furtherly enrich the deployment with meta information. (Didn't test myself if this shows up in Ibiza Portal at all or this is only present on API).
However if you see the bicep params as the template consumer owned part and the main.bicep as the template provider then I would prefer to have a way to define the deployment name as the template provider.
This is fair. I can see us needing to do this eventually. We will plan to start with bicepparam and then expand as needed.
Hi pho-enix, this issue has been marked as stale because it was labeled as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. Thanks for contributing to bicep! :smile: :mechanical_arm:
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.bicepcause this is how you can find the entrypoint if there is multiple files. By default theMicrosoft.Resources/deploymentswill be named after the filenamemain. 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
deploymentNameto declare deployment name in bicep file. A deployment name specified as commandline option should take precedence.targetScope = 'subscription' var version = '7.1.0' deploymentName = 'myproduct_${version}' ...
@pho-enix I definitely agree with you! It would be a nice feature also for our needs.
Hi pho-enix, this issue has been marked as stale because it was labeled as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. Thanks for contributing to bicep! :smile: :mechanical_arm:
+1 for the original request. I'd love to use this in an actual bicep file - instead of in the params one. Btw: @alex-frankel It's nice to see someone like you actively responding to such requests. Saw too many maintainers not responding at all. :)
I'm reopening this one as I think the automation closed it in error. Sounds like a potential interesting consideration for 'bicep deploy'.
I was hoping that this had been implemented by now. Any progress or ETA? ;-)