Skip to content

Azure DNS

There are two possible scenarios when it comes to DNS:

  • Your DNS zone is hosted externally (e.g. CloudFlare, Route53, or any hosting/DNS provider)
  • Your DNS zone is hosted on Azure DNS

In case of the latter, you can specify your DNS zone in some places to allow for automatic DNS record creation.

You should create or import your DNS zone in your Pulumi stack, for example:

# Create a DNS zone
dns_zone = azure.dns.Zone(
    f"zone-myapp-{stack}",
    resource_group_name=rg.name,
    location="global",
    zone_name="yourapplication.com",
    zone_type=azure.dns.ZoneType.PUBLIC,
)

pgAdmin

Specifying the pgadmin_dns_zone parameter will automatically create a DNS record pgadmin in Azure DNS and point it to the pgAdmin service.

CDN

Specifying the zone parameter on the HostDefinition will automatically create a DNS record in Azure DNS and point it to the CDN service:

cdn_host=HostDefinition(host="cdn", zone=dns_zone)

Webapp specific

Specifying the zone parameter on the HostDefinition will automatically create the necessary DNS records in Azure DNS:

django.add_django_website(
    name="prod",
    # -- left out the other parameters for brevity --
        website_hosts=[
        HostDefinition(identifier="root", host="@", zone=dns_zone),
        HostDefinition(identifier="www", host="www", zone=dns_zone),
    ],
    comms_domains=[HostDefinition(identifier="prod", host="@", zone=dns_zone)],
)