First, I’ll start with a tangent – I greatly dislike the new editor in WordPress.

So I recently decided to move a cPanel based web server to Azure.

More specifically, the host I had used for a number of years was slowly getting worse. Support, performance, everything slowly getting worse.

Just to upgrade to server with more memory was a huge pain in the arse.

I finally decided to setup a MS Azure account and spin up a Linux VM.

It really is not difficult to do this AND to setup cPanel.

There are some goofy settings you have to fiddle through.

Really, I don’t understand why there isn’t an image of a Linux VM pre-configured with cPanel.

Well, there isn’t, and at time I felt as though I was reinventing the wheel.

With everything setup and running fine, about a month into the process I started having email issues.

Specifically, an SMTP plugin I was using on multiple websites to use an external SMTP to send email stopped working.

It kept giving connection credential errors.

I spent a day talking with the email company who assured me it wasn’t them.

The cPanel folks said it was because I hadn’t setup a reverse DNS or rDNS.

Hmm, ok.

I looked online how to do this and came across many possibilities…none worked.

I contacted support and after multiple tries nothing.

Then, after a day of waiting I got the answer (and it worked).

Apparently this is not something you can do via the graphical interface in Azure, you must use powershell.

The first time you start powershell it will tell you to connect a storage container, so you’ll probably need another one. Apparently there is little cost.

Then you input 4 lines of code, one at a time.

You’ll need to gather a bit of info first.

You’ll need the:
Subscription ID
Resource Group Name
DNS name of the server
Computer Name

All of this can be found Overview screen of the server.

Once ready, open powershell and enter the first line:
Select-AzureRmSubscription -subscriptionid REPLACE-THIS-WITH-YOUR-SUBSCRIPTION-CODE

hit enter. If you get red text you’ve got an error, otherwise you’ll just see the blinking cursor

$pip = Get-AzureRmPublicIpAddress -Name “SERVERNAME-IP” -ResourceGroupName “ENTER-NAME”
Bother of your entries here are in all caps and yes, you add the “-IP” to your server name

hit enter

$pip.DnsSettings.ReverseFqdn = “put.your.dns.name.here”

hit enter


Set-AzureRmPublicIpAddress -PublicIpAddress $pip

hit enter

If you did this all correctly, you’ll get a bunch of info on the screen confirming what was done and should be good to go.

rDNS is now setup on your Azure VM.



0 thoughts on “How to setup reverse DNS on Azure VM

Want to join the discussion?
Feel free to contribute!

Leave a Reply

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