bicep icon indicating copy to clipboard operation
bicep copied to clipboard

Allow declaration of deployment name in bicep file

Open pho-enix opened this issue 2 years ago • 11 comments

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}'

...

pho-enix avatar Mar 17 '23 15:03 pho-enix

We are planning to add support for "deploy" settings in the bicep params file as per #7301: image

No ETA on when this will be implemented, but if that is where this setting lived would it work for you?

alex-frankel avatar Mar 21 '23 16:03 alex-frankel

@alex-frankel may be support for deployment stack should also be added so from bicep file you define deployment stack deployment.

slavizh avatar Mar 22 '23 07:03 slavizh

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 avatar Mar 22 '23 18:03 alex-frankel

@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).

pho-enix avatar Mar 23 '23 13:03 pho-enix

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.

alex-frankel avatar Mar 23 '23 17:03 alex-frankel

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:

ghost avatar May 24 '23 04:05 ghost

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}'

...

@pho-enix I definitely agree with you! It would be a nice feature also for our needs.

lucabovo avatar May 29 '23 10:05 lucabovo

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:

ghost avatar Jun 05 '23 16:06 ghost

+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. :)

pitscher avatar Oct 04 '23 14:10 pitscher

I'm reopening this one as I think the automation closed it in error. Sounds like a potential interesting consideration for 'bicep deploy'.

anthony-c-martin avatar Oct 04 '23 15:10 anthony-c-martin

I was hoping that this had been implemented by now. Any progress or ETA? ;-)

lee-40square avatar May 12 '24 08:05 lee-40square