Allow generation of stable but unique name for resources
See original GitHub issueIs your feature request related to a problem? Please describe. Generating globally unique names for resources that require a (globally unique) dns entry is challenging. In ARM templates, I would use the uniqueString function, seeding it with the “name” of the storage account (and possibly containing resource group name) that I want to create in order to get a “presudo-random” (but stable) name. Attempting to do so from a shell script is annoying.
Describe the solution you’d like
It would be of a lot of value to expose the functionality from the az create commands - e.g. az storage account create -g somegroup -n somename --uniqify-name
Describe alternatives you’ve considered
- Make name optional and default it to a uniqueString equivalent.
- Provide an
az name create --resource-group some group --name someame
Additional context
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Name generation pattern - Azure Resource Manager
Unique : Azure resource names need to be unique, but the scope of uniqueness depends on the resource. Deterministic: It's important that your ......
Read more >Identifiers - AWS Cloud Development Kit (AWS CDK) v2
Unique IDs serve as the logical identifiers (or logical names) of resources in the generated AWS CloudFormation templates for constructs that represent AWS ......
Read more >Projects - Argo CD - Declarative GitOps CD for Kubernetes
Projects provide the following features: restrict what may be deployed (trusted Git source repositories); restrict where apps may be deployed to (destination ...
Read more >Best practices for using Terraform
To simplify conditional logic, give boolean variables positive names—for ... unique project ID and non-overlapping resource names within each project.
Read more >Managing Resources
Because kubectl outputs resource names in the same syntax it accepts, ... The labels allow us to slice and dice our resources along...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@nthewara, currently there is no plan to implement such feature due to other high priority tasks. Also, adding
--uniqify-nameargument would require changes in all mgmt-plane commands’--namearguments, or possibly even--vnet-namefromaz network vnet subnet create,--account-namefromaz storage container create. This will certainly make commands exponentially more complicated.We recommend using your own hash function to achieve the same effect.
I wrote a sample Python script using
hashlibandbase64to mimic the behavior ofuniqueString:To invoke it:
Of course, you may tweak the script to customize it to suit your needs.
@yonzhan @qianwens - Any update on this ? This would be good feature to have specifically when we need to re-run cli scripts