Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit storageaccount name length to 24 characters #5396

Merged
merged 2 commits into from
Apr 13, 2022
Merged

Limit storageaccount name length to 24 characters #5396

merged 2 commits into from
Apr 13, 2022

Conversation

Tapanila
Copy link
Contributor

Description

If resource group name is long then the script will generate storage account name that's longer than 24 characters.
This change will limit the generated storageaccountname to 24 characters.

Document about limits



# Storage Account Name can only be 24 characters long
$storageAccountName = $storageAccountName.Substring(0, 24)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should check if the length of storageAccountName is more than 24:

PS > "ahbfff".Substring(0, 24)
MethodInvocationException: Exception calling "Substring" with "2" argument(s): "Index and length must refer to a location within the string. (Parameter 'length')"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somehow missed this completely. Added a check for the length

@miketimofeev miketimofeev merged commit 5da7f5b into actions:main Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants