Search code examples
azurereverse-dns

Reverse DNS with Static IP while using Azure Resource Manager


I am very much aware that Reverse DNS is possible on Azure Cloud Services. That's not what I'm asking about. I need to know if it's possible when using Azure Resource Manager. I've looked around a lot online, and while I've found some (2+ year) old questions about it, I can't find any answers.

Thanks!


Solution

  • Ok, while the other two answers were helpful, neither got me all the way there. But I finally figured this out. Many shouts to Michael B who has been a HUGE help!

    The domain I used to learn and play is woodswild.com. If you want to follow along with these steps, just swap out as needed. Hope this helps save someone some time. It took me WAY WAY too long to figure this out.

    One more thing: These steps assume you are NOT using a template.

    1: Open Windows Azure Powershell

    2: Inside Powershell, log in to your account with this command:

    Login-AzureRMAccount
    

    This will prompt you for a log in and password.

    3: Create a Resource Group.

    You can do this in the UI if you want, or in Powershell. This is the command if you want to do it in Powershell:

    $rgName="RG1"
    $locName="Central US"
    New-AzureRmResourceGroup -Name $rgName -Location $locName
    

    4: Create a Temporary Public IP Address:

    The process of creating a Public IP Address with fully qualified Reverse DNS lookup (ReverseFqdn) is wonky. The first thing we have to do is create a temp (throwaway) Public IP Address withOUT a ReverseFqdn. Do that with this command:

    $ipName = "tempRG1PIP"
    $locName = "Central US"
    $rgName = "RG1"
    New-AzureRmPublicIpAddress -AllocationMethod Static -ResourceGroupName $rgName -Name $ipName  -Location $locName
    

    In this example, the domain I'm playing with is "woodswild.com". After running this command, go to the UI and under the Configuration for the IP Address you just created, give the IP address a DNS label of "tempwoodswild" (or whatever you want for your domain).

    enter image description here

    5: Create a CName record

    For the domain you are setting up with Reverse DNS, log into your registrar. Go to the section where you manage your DNS records for your domain. Create a CName record with the host of "www" (or mail, if you are setting up a mail server) which points to "tempwoodswild.centralus.cloudapp.azure.com" (or to whatever DNS label you created.)

    6. Create Another (Permanent) Public IP Address

    Now that we have www.woodswild.com (or mail.woodswild.com) pointing to the temp IP address, we can create a perm one.

    $ipName = "RG1PIP"
    $locName = "Central US"
    $rgName = "RG1"
    $rvFqdn = "www.woodswild.com" (or mail...)
    $dnLabel = "woodswild"
    New-AzureRmPublicIpAddress -Name $ipName -ResourceGroupName $rgName -Location $locName -ReverseFqdn $rvFqdn -AllocationMethod Static -DomainNameLabel $dnLabel
    

    You now have a Static, Public IP Address with a ReverseFqdn!!!

    enter image description here

    7. Delete the temp IP Address

    You can do this in the Azure Portal UI. At this point, in Azure, you should have a Resource Group with only one item in it: Your Public IP Address

    enter image description here

    8. Edit the CName record, and create an A (Host) Record.

    Back in your registrar, edit the CName to be: woodswild.centralus.cloudapp.azure.com

    Also, create an A(Host) record as follows:

    Host: @
    Points To: 40.122.166.144 (which is the IP of the new, perm, Public IP Address)
    

    9. Test the ReverseIP Lookup:

    At this point, you should be able to do a reverse lookup on the IP and get the domain:

    enter image description here

    Tip: At any time, you can see the info from this IP address with this command:

    New-AzureRmPublicIpAddress -Name RG1PIP -ResourceGroupName RG1
    

    Creating a Virtual Machine with the Public IP Address

    From here, creating a virtual machine that is assigned your public (static) IP with Reverse Lookup capabilities is just a matter of associating the VM with the IP you just created.