Azure Private DNS Zone
This page shows how to write Terraform and Azure Resource Manager for Private DNS Zone and write them securely.
azurerm_private_dns_zone (Terraform)
The Zone in Private DNS can be configured in Terraform with the resource name azurerm_private_dns_zone
. The following sections describe 10 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "azurerm_private_dns_zone" "azureautomation" {
provider = azurerm.Connectivity
name = "privatelink.azure-automation.net"
resource_group_name = azurerm_resource_group.dnsprivatezones.name
}
resource "azurerm_private_dns_zone" "acr-dns" {
name = "privatelink.azurecr.io"
resource_group_name = azurerm_resource_group.net-rg.name
}
resource "azurerm_private_dns_zone" "azure_monitor" {
name = "privatelink.monitor.azure.com"
resource_group_name = var.resource_group_name
lifecycle { ignore_changes = [tags] }
}
resource "azurerm_private_dns_zone" "storage" {
name = "privatelink.blob.core.windows.net"
resource_group_name = azurerm_resource_group.terraform.name
}
resource "azurerm_private_dns_zone_virtual_network_link" "storage" {
resource "azurerm_private_dns_zone" "database" {
name = "privatelink.database.windows.net"
resource_group_name = local.resource_group_name
tags = var.tags
}
resource "azurerm_private_dns_zone" "private-storage-blob" {
name = "privatelink.blob.core.windows.net"
resource_group_name = azurerm_resource_group.tf-connectivity.name
}
resource "azurerm_private_dns_zone" "private-storage-file" {
resource "azurerm_private_dns_zone" "all-dns-zone" {
name = var.dns_names[count.index]
resource_group_name = azurerm_resource_group.rg.name
tags = local.common_tags
count = 6
}
resource "azurerm_private_dns_zone" "acr-dns" {
name = "privatelink.azurecr.io"
resource_group_name = azurerm_resource_group.net-rg.name
}
resource "azurerm_private_dns_zone" "monitor" {
name = "privatelink.monitor.azure.com"
resource_group_name = var.rg.name
}
resource "azurerm_private_dns_zone" "oms" {
resource "azurerm_private_dns_zone" "c1" {
name = "customer1.com"
resource_group_name = azurerm_resource_group.C1RG.name
provider = azurerm.Customer1
}
Parameters
-
id
optional computed - string -
max_number_of_record_sets
optional computed - number -
max_number_of_virtual_network_links
optional computed - number -
max_number_of_virtual_network_links_with_registration
optional computed - number -
name
required - string -
number_of_record_sets
optional computed - number -
resource_group_name
required - string -
tags
optional - map from string to string -
soa_record
list block-
email
required - string -
expire_time
optional - number -
fqdn
optional computed - string -
host_name
optional computed - string -
minimum_ttl
optional - number -
refresh_time
optional - number -
retry_time
optional - number -
serial_number
optional computed - number -
tags
optional - map from string to string -
ttl
optional - number
-
-
timeouts
single block
Explanation in Terraform Registry
Enables you to manage Private DNS zones within Azure DNS. These zones are hosted on Azure's name servers.
Microsoft.Network/privateDnsZones (Azure Resource Manager)
The privateDnsZones in Microsoft.Network can be configured in Azure Resource Manager with the resource name Microsoft.Network/privateDnsZones
. The following sections describe how to use the resource and its parameters.
Example Usage from GitHub
"strongType": "Microsoft.Network/privateDnsZones",
"description": "Private DNS Zone Identifier"
}
},
"azureWebPrivateDnsZoneId": {
"type": "string",
"strongType": "Microsoft.Network/privateDnsZones",
"description": "Private DNS Zone Identifier"
}
},
"azureWebPrivateDnsZoneId": {
"type": "string",
"type": "Microsoft.Network/privateDnsZones",
"apiVersion": "2018-09-01",
"name": "[parameters('privateDnsZones_lablocaliza_lab_name')]",
"location": "global",
"properties": {
"maxNumberOfRecordSets": 25000,
"type": "Microsoft.Network/privateDnsZones",
"apiVersion": "2018-09-01",
"name": "[parameters('privateDnsZones_izzyacademy_com_name')]",
"location": "global",
"properties": {
"maxNumberOfRecordSets": 25000,
"type": "Microsoft.Network/privateDnsZones",
"apiVersion": "2020-06-01",
"name": "privatelink.azure-automation.net",
"location": "global"
},
{
"strongType": "Microsoft.Network/privateDnsZones",
"description": "Private DNS Zone Identifier"
}
},
"azureWebPrivateDnsZoneId": {
"type": "string",
"strongType": "Microsoft.Network/privateDnsZones",
"description": "Private DNS Zone Identifier"
}
},
"azureBatchPrivateDnsZoneId": {
"type": "string",
"strongType": "Microsoft.Network/privateDnsZones",
"description": "Private DNS Zone Identifier"
}
},
"azureWebPrivateDnsZoneId": {
"type": "string",
"strongType": "Microsoft.Network/privateDnsZones",
"description": "Private DNS Zone Identifier"
}
},
"azureWebPrivateDnsZoneId": {
"type": "string",
"strongType": "Microsoft.Network/privateDnsZones",
"description": "Private DNS Zone Identifier"
}
},
// US_Gov_Error_004
"azureWebPrivateDnsZoneId": {
Frequently asked questions
What is Azure Private DNS Zone?
Azure Private DNS Zone is a resource for Private DNS of Microsoft Azure. Settings can be wrote in Terraform.
Where can I find the example code for the Azure Private DNS Zone?
For Terraform, the liamfoneill/NotQuiteEnterpriseScale, neelampawar1988/Azure-Arc-Kubenetescluster and microsoft/AzureTRE source code examples are useful. See the Terraform Example section for further details.
For Azure Resource Manager, the saq1bahmed/EntScale, tschwarz01/tf-caf-data-management-zone and L4ur0Resend3/Lab source code examples are useful. See the Azure Resource Manager Example section for further details.