Reverse DNS and Microsoft Azure

At the time of writing you can’t currently use reverse DNS with a PIP that you may have configured with your VM. Azure reverse DNS is attached to the cloud service your VM is in.
Instructions on how to install and add a subscription to Azure PowerShell can be found here. 🙂

Microsoft have recently announced that users of Microsoft Azure can finally use reverse DNS with their cloud services. This means people are now able to do a whole host of new things with their virtual machines that were difficult at best to do properly beforehand. An example of this is now you can host your own email server(s) with Azure and you don’t need to use SMTP relay servers in order to send email that doesn’t get sent to Junk before the user even gets a chance to look at it (and to be honest, even with the use of an SMTP relay server your emails still had a high chance of being sent to Junk because a lot of businesses mark emails sent with the major providers of SMTP relay like MailJet or SendGrid as spam anyway).

In this blog post I’ll lay out how to: set up reverse DNS with a new cloud service, set up reverse DNS on an existing cloud service, and how to remove reverse DNS after setting it up.

Adding reverse DNS to an existing cloud service

1) Firstly you’ll need to open an Azure PowerShell console window.

Screenshot (53)

2) Type in the following command, swapping out  the bits inside the quotation marks with the corresponding values for your cloud service.

Note: You need to make sure that you leave the quotation marks AND it’s vital that you keep a full stop/period at the end of the FQDN (e.g. “revdnsdemo.cloudapp.net.“). Also note that you can use any FQDN that’s got an A Record pointing to the IP of a virtual machine inside your cloud service or you can use the DNS name Azure provides you with (servicename.cloudapp.net).
Set-AzureService –ServiceName “yourservice” –Description “your description” –ReverseDnsFqdn “your.fqdn.

Screenshot (52)

3) If the command is completed successfully then try the command below to verify whether or not it’s worked.

[System.Net.Dns]::GetHostEntry("VIPIPaddressofVM")

Screenshot (59)

Creating a new cloud service with reverse DNS

1) Run the following command (remember that you need to make sure you leave a full stop/period at the end of your FQDN).

New-AzureService –ServiceName “servicename” –Location “region” –Description “description” –ReverseDnsFqdn “your.fqdn.”

Screenshot (57)

2) That’s it. If the console says “Succeeded” then you can deploy a VM into the cloud service and try reverse DNS out using the command below.

[System.Net.Dns]::GetHostEntry("VIPIPaddressofVM")

Removing reverse DNS

1) Run the following command (notice that there’s nothing between the quotation marks after -ReverseDnsFqdn).

Set-AzureService –ServiceName “servicename” –Description “description” –ReverseDnsFqdn “”

 Screenshot (62)

2) That’s it. Relaunch PowerShell (make sure you close all the open console windows) and run the following command and you should see the error in the screenshot below.

[System.Net.Dns]::GetHostEntry("VIPaddressofVM")

Screenshot (61)

Posted in Azure, How To and tagged , , , , , , .

2 Comments

  1. Jon
    I followed your pip tutorial, thanks. My issue is configuring the Network Adaption on the server. What do I put as the default gateway.
    Cheers
    Ian Bennetts

    • Hi Ian,

      So sorry I haven’t replied sooner (I’m sure you managed to fix your problem but I’ll reply anyway in case you haven’t). It would be best to leave all Network Adapter settings as their defaults, I’ve found messing with the slightest thing results in the VM being inaccessible. If you wanted to give the VM a dedicated local IP/your own DNS it would be best to do so through the Azure Portal.

      Sorry once again.

Leave a Reply

Your email address will not be published. Required fields are marked *