Azure – Reverse DNS (PTR) for Azure VM

azuredomain-name-system

I'm running an Azure VM (Classic) that hosts an email server. Some domains are not allowing my sent emails due to missing reverse dns/prt record.

I tried to follow this guide: https://azure.microsoft.com/en-us/blog/announcing-reverse-dns-for-azure-cloud-services/

I have a custom domain (say mail.mydomain.com) mapped to the IP and I tried to add a reverse DNS with:

Set-AzureService –ServiceName "mycloudservice" –Description "Reverse
DNS for mailserver" –ReverseDns Fqdn "mail.mydomain.com."

But I get the following error:

Set-AzureService : BadRequest: The reverse DNS FQDN
telemetry.yara.com. must resolve to one of: a). the DNS name of thi s
Hosted Service (xxxx.cloudapp.net), b). the DNS name of a different
Hosted Service in this subscription (a4684608-5
4c0-4c96-b42f-daf646401c58), c). a Reserved IP belonging to this
subscription, or d). the IP of a deployment or of a VM in this
subscription.

Note that this VM also has an instance IP (long story short: we need to ping the IP) and the domain is mapped to the instance IP and not the virtual public ip. Can that be the cause of why I can't add the PTR?

Any ideas on how to add the PTR while still having the domain point to the instance ip?

  • Instance IP address
    An instance IP address is a public IP address that can be used to access virtual machines in Azure. Unlike a VIP, each virtual machine in a domain name can have its own instance IP address. Additional charges may apply when using public IP addresses.

Best Answer

Hosting a mail server on a VM in Azure is not supported and is against the TOS. The Azure IP ranges are in fact added to to the public block lists, which may explain the issue you are having.

"Sending outbound e-mail to external domains (such as outlook.com, gmail.com, etc) directly from an e-mail server hosted in Azure compute services is not supported due to the elastic nature of public cloud service IPs and the potential for abuse. As such, the Azure compute IP address blocks are added to public block lists (such as the Spamhaus PBL). There are no exceptions to this policy."

https://blogs.msdn.microsoft.com/mast/2016/04/04/sending-e-mail-from-azure-compute-resource-to-external-domains/

The solution to sending email from Azure is to use an SMTP relay like Sendgrid or Exchange online, which is supported.

Related Topic