Geetika
Geetika

Reputation: 336

Azure Devops - Domain name is invalid

I am trying to create a virtual machine using ARM template. I have added ARM template in my visual studio and have checked-in into the Azure Repos. On running release pipeline I am receiving below error:

InvalidDomainNameLabel: The domain name label $(dns) is invalid. It must conform to the following regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$. []

Below is the parameter.json file:

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "adminUsername": {
      "value": "Myadmin"
    },
    "dnsNameForPublicIP": {
      "value": "mynewdevvmbox003"
    }
  }
}

dns name "mynewdevvmbox003" is matching the regular expression requirement but still, I am getting this error.

Upvotes: 0

Views: 1487

Answers (1)

Mengdi Liang
Mengdi Liang

Reputation: 19016

InvalidDomainNameLabel: The domain name label $(dns) is invalid.

According to this error message, the value of domain name that this task server got is $(dns), not mynewdevvmbox003.

I think you should specified the override parameter value in Override template parameters of Azure resource group deployment task, such as -dnsNameForPublicIP $(dns).

enter image description here

If you indeed specify like this, the value in parameter.json will not be parsed any more. Because the override content has higher priority than parameter.json. Here, dns is a pipeline varibale.


Please ensure select the parameter.json file in Template parameters:

enter image description here

And, do not specify adminUsername and dnsNameForPublicIP again in Override template parameters of the task.

Upvotes: 1

Related Questions