Sajeetharan
Sajeetharan

Reputation: 222582

How to resolve "DNS Zone does not have enough labels via PowerShell" error

I am trying to Create a Private DNS zone by specifying virtual network IDs with Powershell, and my command goes as follows,

New-AzDnsZone -Name 'dnszone01' -ResourceGroupName 'thisRG' -ZoneType 'Private' -RegistrationVirtualNetworkId @($vnet.Id)

I am getting an error as,

New-AzDnsZone : The zone name 'dnszone01' does not have enough labels. Zone names must have two or more labels. At line:1 char:1 + New-AzDnsZone -Name 'dnszone01' -ResourceGroupName 'thisRG' -Zon ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : CloseError: (:) [New-AzDnsZone], CloudException + FullyQualifiedErrorId : Microsoft.Azure.Commands.Dns.NewAzureDnsZone

what am I missing here?

Upvotes: 1

Views: 5528

Answers (2)

chandra kiran
chandra kiran

Reputation: 21

Add .azure.com to the name: Example -

resource "azurerm_private_dns_zone" "dnszone" {
 name = "${var.private_dns_zone_name}-pdz.postgres.database.azure.com"
 resource_group_name = var.resource_group_name

Upvotes: 2

Shiraz Bhaiji
Shiraz Bhaiji

Reputation: 65391

The dns name must be fully qualifed. for example:

  • dnszone1.local
  • dnszone.mysite.com

Upvotes: 12

Related Questions