Azure DNS SRV Record

This page shows how to write Terraform and Azure Resource Manager for DNS SRV Record and write them securely.

azurerm_dns_srv_record (Terraform)

The SRV Record in DNS can be configured in Terraform with the resource name azurerm_dns_srv_record. The following sections describe 10 examples of how to use the resource and its parameters.

Example Usage from GitHub

resource_dns_srv_record.tf#L1
resource "azurerm_dns_srv_record" "dns_srv_record_1" {
  name                = "_sip._tls"
  zone_name           = azurerm_dns_zone.dns_zone.name
  resource_group_name = azurerm_resource_group.resource_group.name
  ttl                 = var.default_ttl

dns_srv_record_test.tf#L15
resource "azurerm_dns_srv_record" "over1B" {
  name                = "test"
  zone_name           = azurerm_dns_zone.example.name
  resource_group_name = azurerm_resource_group.example.name
  ttl                 = 300

main.tf#L63
resource "azurerm_dns_srv_record" "sip_tls" {
  name                = "_sip._tls"
  zone_name           = var.zone_name
  resource_group_name = var.rg_name
  ttl                 = 3600

dns_srv_record_test.tf#L15
resource "azurerm_dns_srv_record" "over1B" {
  name                = "test"
  zone_name           = azurerm_dns_zone.example.name
  resource_group_name = azurerm_resource_group.example.name
  ttl                 = 300

srv_record.tf#L1
resource "azurerm_dns_srv_record" "this" {
  for_each = { for record in var.srv_recordsets :
    record.name => record
  }

  resource_group_name = lower(var.resource_group_name)
record_srv.tf#L1
resource "azurerm_dns_srv_record" "srv" {
  for_each = try(var.records.srv, {})

  name                = each.value.name
  zone_name           = var.zone_name
  resource_group_name = var.resource_group_name
record_srv.tf#L1
resource "azurerm_dns_srv_record" "srv" {
  for_each = try(var.records.srv, {})

  name                = each.value.name
  zone_name           = var.zone_name
  resource_group_name = var.resource_group_name
record_srv.tf#L1
resource "azurerm_dns_srv_record" "srv" {
  for_each = try(var.records.srv, {})

  name                = each.value.name
  zone_name           = var.zone_name
  resource_group_name = var.resource_group_name
office365.tf#L33
resource "azurerm_dns_srv_record" "pain_td00_srv" {
    name                = "_autoconfig"
  zone_name           = azurerm_dns_zone.openinfrastructure_dns.name
  resource_group_name = azurerm_resource_group.openinfrastructure_rg.name
  ttl                 = 3600
  record {
srv_record.tf#L1
resource "azurerm_dns_srv_record" "this" {
  for_each = {
    for records, record in var.dns_records : records => record
    if record.type == "SRV"
  }

Review your Terraform file for Azure best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Enables you to manage DNS SRV Records within Azure DNS.

Microsoft.Network/dnszones/SRV (Azure Resource Manager)

The dnszones/SRV in Microsoft.Network can be configured in Azure Resource Manager with the resource name Microsoft.Network/dnszones/SRV. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

sfb.json#L69
      "type": "Microsoft.Network/dnszones/SRV",
      "name": "[concat(parameters('dnsZoneName'),'/','_sipfederationtls._tcp')]",
      "apiVersion": "2016-04-01",
      "properties": {
        "TTL": "[parameters('ttl')]",
        "SRVRecords": [
sfb.json#L69
      "type": "Microsoft.Network/dnszones/SRV",
      "name": "[concat(parameters('dnsZoneName'),'/','_sipfederationtls._tcp')]",
      "apiVersion": "2016-04-01",
      "properties": {
        "TTL": "[parameters('ttl')]",
        "SRVRecords": [
sfb.json#L69
      "type": "Microsoft.Network/dnszones/SRV",
      "name": "[concat(parameters('dnsZoneName'),'/','_sipfederationtls._tcp')]",
      "apiVersion": "2016-04-01",
      "properties": {
        "TTL": "[parameters('ttl')]",
        "SRVRecords": [
sfb.json#L69
      "type": "Microsoft.Network/dnszones/SRV",
      "name": "[concat(parameters('dnsZoneName'),'/','_sipfederationtls._tcp')]",
      "apiVersion": "2016-04-01",
      "properties": {
        "TTL": "[parameters('ttl')]",
        "SRVRecords": [
sfb.json#L69
      "type": "Microsoft.Network/dnszones/SRV",
      "name": "[concat(parameters('dnsZoneName'),'/','_sipfederationtls._tcp')]",
      "apiVersion": "2016-04-01",
      "properties": {
        "TTL": "[parameters('ttl')]",
        "SRVRecords": [
sfb.json#L69
      "type": "Microsoft.Network/dnszones/SRV",
      "name": "[concat(parameters('dnsZoneName'),'/','_sipfederationtls._tcp')]",
      "apiVersion": "2016-04-01",
      "properties": {
        "TTL": "[parameters('ttl')]",
        "SRVRecords": [
sfb.json#L69
      "type": "Microsoft.Network/dnszones/SRV",
      "name": "[concat(parameters('dnsZoneName'),'/','_sipfederationtls._tcp')]",
      "apiVersion": "2016-04-01",
      "properties": {
        "TTL": "[parameters('ttl')]",
        "SRVRecords": [
sfb.json#L69
      "type": "Microsoft.Network/dnszones/SRV",
      "name": "[concat(parameters('dnsZoneName'),'/','_sipfederationtls._tcp')]",
      "apiVersion": "2016-04-01",
      "properties": {
        "TTL": "[parameters('ttl')]",
        "SRVRecords": [
sfb.json#L69
      "type": "Microsoft.Network/dnszones/SRV",
      "name": "[concat(parameters('dnsZoneName'),'/','_sipfederationtls._tcp')]",
      "apiVersion": "2016-04-01",
      "properties": {
        "TTL": "[parameters('ttl')]",
        "SRVRecords": [
sfb.json#L69
      "type": "Microsoft.Network/dnszones/SRV",
      "name": "[concat(parameters('dnsZoneName'),'/','_sipfederationtls._tcp')]",
      "apiVersion": "2016-04-01",
      "properties": {
        "TTL": "[parameters('ttl')]",
        "SRVRecords": [

Frequently asked questions

What is Azure DNS SRV Record?

Azure DNS SRV Record is a resource for DNS of Microsoft Azure. Settings can be wrote in Terraform.

Where can I find the example code for the Azure DNS SRV Record?

For Terraform, the cbchalmers/Azure-SaaS-DNS-Public-Zone-M365-Records, gilyas/infracost and Diehlabs/terraform-azurerm-o365dns source code examples are useful. See the Terraform Example section for further details.

For Azure Resource Manager, the RTmtfiallos/ABCDS-AKS-NAT-AGIC, net9876/azure-quickstart-templates and Somphodj/azure source code examples are useful. See the Azure Resource Manager Example section for further details.