How I setup reverse DNS on Azure

Lassi Uosukainen
1 min readDec 26, 2017

While working on a web application that sends emails through a self-hosted exim mail server, I encountered the following error message. My setup is a Windows Server VM on Azure already running with everything else working.

Mailbox unavailable. The server response was: Suspect sender from [82.18.239.142] (Host has no PTR)

A bit of googling showed me that a PTR record stands for reverse DNS. For some reason most mail servers don’t allow hosts without a reverse DNS setup to send emails.

I tried to find an option to set the reverse DNS on the Azure Portal, however could not find anything related to it. According to some sources Azure Powershell is the only way to set reverse DNS on an Azure VM.

Some of the guides were for how to create a new IP address with reverse DNS, however I already had an IP where I wanted to add it. Finally I found the following snippet, which let me add a reverse DNS address for my existing IP address.

$pip = Get-AzureRmPublicIpAddress -Name “EstiemVm-ip” -ResourceGroupName “estiemapp”$pip.DnsSettings = New-Object -TypeName “Microsoft.Azure.Commands.Network.Models.PSPublicIpAddressDnsSettings”$pip.DnsSettings.DomainNameLabel = “estiem”$pip.DnsSettings.ReverseFqdn = “www.estiem.org."Set-AzureRmPublicIpAddress -PublicIpAddress $pip

Running this on my Azure powershell added the reverse DNS and now my application is able to send mails again.

--

--