CloudAdoptionFramework icon indicating copy to clipboard operation
CloudAdoptionFramework copied to clipboard

AZNamingTool not aligned with Azure resources

Open nicoride93 opened this issue 1 year ago • 6 comments

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!

nicoride93 avatar Aug 10 '22 19:08 nicoride93

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

BryanSoltis avatar Aug 10 '22 20:08 BryanSoltis

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

and in Azure doesnt support it either image

Thanks!

nicoride93 avatar Aug 10 '22 20:08 nicoride93

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:

  • Log in as the Admin
  • Go to the Configuration Page
  • Under Component Configuration, expand Resource Types
  • Expand the Configuration section
  • Select the Refresh the Resource Types Configuration option to update the configuration from the GitHub repo

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:

  • Open the /settings/resourcetypes.json file
  • Find the type with ID 129 (DataLakeAnalytics/accounts/storageAccounts)
  • Change the "ShortName" value to "dlasa"
  • Save the file
  • Attempt to generate the name again

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.

  • BryanSoltis

BryanSoltis avatar Aug 10 '22 21:08 BryanSoltis

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

Thanks!

nicoride93 avatar Aug 10 '22 22:08 nicoride93

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)

  • On the Configuration page, expand the Resource Types section
  • For the desired resource type, click the "Edit" button
  • Update the Short Name to any unique value
  • Click Save

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

BryanSoltis avatar Aug 11 '22 14:08 BryanSoltis

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?

ctmillerlin avatar Aug 12 '22 06:08 ctmillerlin

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.

Zimmergren avatar May 27 '24 11:05 Zimmergren