microsoft / CloudAdoptionFramework

Code samples and extended documentation to support the guidance provided in the Microsoft Cloud Adoption Framework
https://aka.ms/CAF
Creative Commons Attribution 4.0 International
864 stars 621 forks source link

AZNamingTool not aligned with Azure resources #83

Closed nicoride93 closed 5 months ago

nicoride93 commented 2 years ago

Hi,

Thanks for the tool. Is very useful! I was setting some names for my environment and found that is not aligned to what Azure asks for. IE. I created a storage account with dashes as delimiter and the generated name is with dashes. image If I change the delimiter to period, it will eliminate the period. image

Any guidance on this? Thanks!

BryanSoltis commented 2 years ago

Hi @nicoride93,

Each resource type has a regex that gets applied. This regex will likely contain characters that are not allowed for the resource. In the case of storage account, they cannot contain a ".". The Naming Tool will remove any of these characters and attempt to validate the name again. If it can, it will display a message (as in your screen shot above) of the valid name with the delimiter removed.

On the Reference page, you can view the current regex values for any resource type in the system. This information is also viewable on the Generate page after selecting a resource type and expanding the "Naming Guidelines" section.

Hope this helps!

-BryanSoltis

nicoride93 commented 2 years ago

Hi @BryanSoltis Thanks for reaching out! The storage account doesnt support dashes image

and in Azure doesnt support it either image

Thanks!

BryanSoltis commented 2 years ago

Ah.. now I see your point! We recently put out a change to simplify the API for generating a name. As part of this, we only pass the "short name" value for each component, including the resource type. The issue you are seeing is because there are multiple resource types with the same short name value ("sa" in the case of a storage account). The code is finding a different resource type's regex and applying it, which is allowing the "-" to go through.

To resolve this, we can push a new version of the resourcetypes.json file to the GitHub. Once that is completed, you can update your local version with the updated file using the following process.

To update the resource types with the latest data:

If you want to, you could update your local version of the /settings/resourcetypes.json with the correct data. Specifically, you will want to do the following:

This will update your local configuration until we can publish the GitHub update. You can also use the "Export/Import" feature for the Resource Types on the Configuration page to update the data, if that helps.

Thank you for helping us find these bugs! I hope this helps and we will push the change out ASAP.

nicoride93 commented 2 years ago

Awesome! Thanks! Is working now. Ill make sure that there are no duplicated values.

Thanks!

BryanSoltis commented 2 years ago

Hi @nicoride93,

I wanted to let you know that we pushed the updated resourcetypes.json file. You can use the Refresh process listed in my previous comment to update, if needed.

Also, in researching it more, I actually forgot about some functionality I put into the site that allows you update the Short Name value for a resource type directly within the UI. Here's how you can do it (without having to manually change the JSON)

This will change the resource type short name and avoid the issue you were seeing. I will work on adding functionality to this process to confirm the value is unique and this will be released in a future tool update.

Thank you for again for the great feedback and let us know how you like to tool!

-BryanSoltis

ctmillerlin commented 2 years ago

What's the suggest practice when the resource name does not support dash '-'? In this case, Azure does not allow us to use '-' for the storage account name. refers to azure doc What's the suggested character to use as the delimiter?

Zimmergren commented 5 months ago

The AzNamingTool repo moved: https://github.com/mspnp/AzureNamingTool Please use the new repo to file a ticket if there are still questions or issues with the tool.