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

Creation of VNET exceeds the maximum character limit for the VNET name #881

Closed
ositobio opened this issue Dec 21, 2021 · 6 comments · Fixed by #1078
Closed

Creation of VNET exceeds the maximum character limit for the VNET name #881

ositobio opened this issue Dec 21, 2021 · 6 comments · Fixed by #1078
Assignees
Labels
bug Something isn't working engineering engineering work Status: Fixed

Comments

@ositobio
Copy link

ositobio commented Dec 21, 2021

When creating a landing zone, if the Resource Group name is too long, when the template creates the name for the VNET attaching the IDs and RG name, it causes an exception and gives the following error:

While selecting this, we could see that the virtual network created as part of this step has the subscription ID tagged in its name and deployment failed with the error: code\\\": \\\"NetcfgInvalidVirtualNetworkSite\\\",\\r\\n \\\"message\\\": \\\"Virtual network site is not valid as specified with the name 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXNameTooLongToCauseAProblemWithExceedeingLength'

As per Microsoft Documentation, the limit is 64 characters

image

Crating the VNET manually doesn't happen, but the templates or the logic shouldn't let the name exceed the limit.

@ositobio
Copy link
Author

Tagging @jtracey93 as requested by him

@jtracey93 jtracey93 self-assigned this Dec 21, 2021
@jtracey93
Copy link
Collaborator

Thanks @ositobio - assigning this to myself to investigate and resolve 👍

@jtracey93 jtracey93 added bug Something isn't working engineering engineering work labels Dec 21, 2021
@jtracey93
Copy link
Collaborator

Initial Investigation

VNet names passed in by the eslzArm.json orchestration template (used by portal deployments) can pass in VNet names longer than 64 characters (max supported length) depending on the region and length of the ESLZ Prefix entered.

VNET Naming Patter Today Explained

-vnet-
<36 chars + 10 chars max>-<6 chars>-

Total possible length of SUBID + enterpriseScaleCompanyPrefix + "-vnet-" = 52 characters

This leaves only 12 characters for the location section.

Locations names that are longer than 12 characters in length

Using the below PowerShell against Azure Public, I have found the following list of regions that are longer than 12 characters in length:

$locations = Get-AzLocation

$locationHashTable = @{}
foreach ($location in $locations) {
  $locationLength = $location.Location.Length
  $locationDisplayName = $location.DisplayName
  $locationShortName = $location.Location

  if ($locationLength -ge 13) {
    Write-Host -ForegroundColor Yellow "$locationDisplayName is longer than 12 characters: $locationShortName is actually $locationLength characters"
  } else {
    Write-Host -ForegroundColor Green "$locationDisplayName is 12 characters or less: $locationShortName is actually $locationLength characters"
  }

  $locationHashTable.Add($location.Location, $location.Location.Length)
}

$locationHashTable.GetEnumerator() | Sort-Object -Property Value -Descending

Locations potentially impacted

Azure Public

Name Length
germanywestcentral 18
australiasoutheast 18
australiacentral2 17
southafricanorth 16
australiacentral 16
switzerlandnorth 16
brazilsoutheast 15
switzerlandwest 15
southafricawest 15
northcentralus 14
southcentralus 14
francecentral 13
southeastasia 13
swedencentral 13
canadacentral 13
australiaeast 13
westcentralus 13

Azure Gov (Fairfax)

Name Length
usgovvirginia 13

Azure China (Mooncake)

No regions currently impacted

Summary

If a customer selects a region that is potentially impacted by this issue as listed in above tables and sets the ESLZ prefix to 10 characters (it's max length) then VNET deployments will fail using the ESLZ portal experience due to the VNet name being longer than 64 characters.

Workarounds (prior to fix being implemented)

  1. Deploying the VNet/s manually (Portal, ARM, Bicep etc.)
  2. Use a shorter ESLZ prefix (using the maths in the "VNET Naming Patter Today Explained" section above) to ensure your VNet name will be 64 characters or less

Next Steps

I will investigate the best way to fix this in the short term and longer term and create required PRs shortly

@jtracey93
Copy link
Collaborator

Linking to #674

@jtracey93
Copy link
Collaborator

Trigger ADO Sync 1

@jtracey93
Copy link
Collaborator

Trigger ADO Sync 2

jtracey93 added a commit to jtracey93/Enterprise-Scale that referenced this issue Oct 11, 2022
@ghost ghost added the Status: Fixed label Oct 12, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Nov 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working engineering engineering work Status: Fixed
Projects
None yet
2 participants