Identify invalid Azure container names

How can I programmatically determine if a container name is invalid for rules?


A valid name for the container in the firewall repository.

  • 3 to 63 characters
  • starts with a letter or number
  • Letters, numbers and dashes (-)
  • Each dash (-) must be immediately preceded by a letter or number.
  • All letters in the container name must be lowercase.
+6
source share
1 answer

A valid name for the container in the firewall repository.

  • 3 to 63 characters
  • starts with a letter or number
  • Letters, numbers and dashes (-)
  • Each dash (-) must be immediately preceded by a letter or number.
  • All letters in the container name must be lowercase.

In my WebAPI, I used the following:

if (container.Length < 3 || container.Length > 63 || !Regex.IsMatch(container, @"^[a-z0-9]+(-[a-z0-9]+)*$")) throw new HttpResponseException(Request.CreateResponse( HttpStatusCode.BadRequest, "Invalid Request!")); 
+12
source

Source: https://habr.com/ru/post/944552/


All Articles