Skip to content

Instantly share code, notes, and snippets.

@techdecline
Created June 22, 2020 12:22
Show Gist options
  • Select an option

  • Save techdecline/58ba1bfd2129715da612e839392e330d to your computer and use it in GitHub Desktop.

Select an option

Save techdecline/58ba1bfd2129715da612e839392e330d to your computer and use it in GitHub Desktop.
function New-AzureUniqueName {
param ($prefix,$NameLength = 24)
$length = $prefix.length
if ($length -ge $NameLength) {
throw "Name prefix too long"
}
else {
$fillUnique = ((New-Guid).toString() -replace "-","").Substring(0,($NameLength-$length))
}
$kvName = $prefix + $fillUnique
return $kvName
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment