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.

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."


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


Since 2014 it hasn't been against TOS. Spam is against TOS (2nd line of TOS). And the only reason they would say in TOS can't spam is if you COULD send email from a VM. #obviously

You can remove your ip from block lists, including Azure ones (we have successfully done this)

You can now setup a PTR record via CLI for your mail server on Azure also which actually fixes your problem.

While outgoing smtp isn't supported (and isn't against TOS as MS support HELPED ME set up mine), Microsoft even does this. It's just not supported but is allowed if you have the know how.

Otherwise we should shut the internet down because it could be used to send spam (same logic)

Either way SendGrid is a good solution as it increases your deliverability if you don't have the inhouse experience to do this yourself.

  • I used to use sendgrid to send email, but have actually had issues with mail sent via sendgrid ending up in customers spam filter. That's why I stopped using sendgrid in the first place. The only email sent is user activation links, forgot password links and some notification emails. – Pål Andreassen Feb 23 '17 at 8:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.