One Page Zen

Web Design. Simplified.

  • Tutorials
    • Google Cloud
    • Amazon Cloud
    • Microsoft Cloud
  • Start
  • Resources

How to Transfer a Domain Name to Azure

November 12, 2020 Leron Amin 6 Comments

FacebookTweetLinkedInEmail

After you’ve installed an application such as WordPress on Microsoft Azure, the next step is to transfer your domain name to Azure so that it links to your website.

Taking the time to properly configure a domain name for your website is an easy way to prevent search engine indexing issues from occurring.

By default, Azure allows you to assign a generic domain name to your application. However, using a generic domain name is bad for your website’s SEO.

If you would rather use a custom domain name such as yourwebsite.com, then read on for instructions on how to transfer your domain name to Azure.

Before getting started with this tutorial, you should have already installed an application such as WordPress on a Microsoft Azure virtual machine.

There are 8 steps in this tutorial:

  • 1. Copy Virtual Machine IP
  • 2. Create a DNS Zone
  • 3. Add “A” Record
  • 4. Add “CNAME” Record
  • 5. Review Record Set
  • 6. Edit Domain Name Servers
  • 7. Test Settings
  • 8. Include www. Prefix (Optional)

1. Copy Virtual Machine IP

transfer domain name to azure copy virtual machine ip
Before diving into this tutorial, you will first need to copy the external IP address of the virtual machine that is running your application. From your Azure dashboard, click on the box showing the virtual machine that is running your website application.
how to install wordpress on azure copy public IP address
Next, in the overview section of the left sidebar column, copy the Public IP address of your virtual machine – this IP address will be used in the later steps.

2. Create a DNS Zone

transfer domain name to azure create dns zone
Return to your Azure dashboard, then click the New link in the left-sidebar menu to search the Azure marketplace. Type DNS zone in the search bar, then select the DNS zone option that appears.
transfer domain name to azure create dns zone
After selecting the DNS zone option, scroll to the bottom of the page and click the Create button.
transfer domain name to azure create dns zone configure dns settings
In the Create DNS Zone settings, enter your root domain in the Name field, and select the Resource Group attached to your application. Make sure the Pin to dashboard box is checked, then click the Create button.

3. Add “A” Record

transfer domain name to azure create dns zone add record set
At the top of the newly created DNS Zone page, click on the + Record set link.
transfer domain name to azure add a record
Configure a new “A” record using the Public IP address that you copied in Step 1. Make sure to leave the Name field blank. Click the Ok button to save changes.

4. Add “CNAME” Record

transfer domain name to azure add a record
Now that you’ve added an “A” record to you DNS Zone, you will have to add a “CNAME” record. To do this, click on the + Record set link at the top of the page.
transfer domain name to azure add a cname record
Configure your “CNAME” record by adding www to the Name field, and adding your domain name (without www.) to the Alias field.

5. Review Record Set

transfer domain name to azure review record set
Look over your record set, making sure both the “A” record and the “WWW” record are appearing in the table.

6. Edit Domain Name Servers

transfer domain name to azure create dns zone add record set copy nameservers
At the top of your DNS Zone page, copy the four name servers.
transfer domain name to azure change nameservers
Next, go to your domain name provider and change your name servers to match the Azure name servers on the DNS Zone page.

7. Test Settings

transfer domain name to azure change nameservers test settings
To test if your domain name is configured properly, enter your domain name into your browser’s URL bar. If your domain name is configured properly, your application’s homepage will load. If you would like your domain name to load with the WWW. prefix, read on for instructions.

8. Include www. Prefix (Optional)

By default, your domain name will show without the www. prefix.

If you would rather your domain name show up as www.example.com instead of just example.com, then read on for configuration instructions.

NOTE: The instructions below are intended for users running Bitnami’s WordPress stack on Azure. If you’re using a different Apache configuration, remember to substitute the bitnami.conf file with your server’s htaccess equivalent.

transfer domain name to azure configure www
Navigate to your Azure dashboard by clicking the Dashboard link in the left-sidebar column, then click on the box to open your virtual machine settings.
At the top of your virtual machine settings page, click on the Connect icon, then copy the SSH command. Finally, click the Cloud Shell icon at the top of the page to open the terminal.
transfer domain name to azure configure www
Enter your credentials to login to the virtual machine, then paste (CTRL + SHIFT + V) the SSH command that you copied in the last step.
transfer domain name to azure configure www
Next, copy and paste the command below to open your server’s configuration file.
sudo nano /opt/bitnami/apache2/conf/bitnami/bitnami.conf
transfer domain name to azure configure www
Now that you’ve opened your server’s configuration file, copy and paste the three lines of code below in the exact same location as shown in the image. Save changes to the file (CTRL + O) then exit (CTRL + X) to the home screen.

  RewriteEngine On
  
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
transfer domain name to azure configure www
Finally, in order for changes to take effect, you need to restart your Apache server by executing the command listed below.
sudo /opt/bitnami/ctlscript.sh restart apache

Did it work?

If you have general questions or comments about this tutorial, please feel free to leave them below.

If you benefited from this tutorial, and would like to support One Page Zen, please like our Facebook page and subscribe to our YouTube channel.

Thanks,

signature

Up Next…

transfer domain name to azure
How to Migrate WordPress Installations

Related Posts

  • How to Migrate WordPress Installations
  • How to Install WordPress on Azure
  • The Most Important Linux Commands (With Examples)
  • Increase 512MB Upload Limit for All-in-One WP Migration Plugin
  • How to Migrate WordPress to Azure (Full Guide)
FacebookTweetLinkedInEmail

Filed Under: Azure, Azure Networking, Azure WordPress Tagged With: azure, wordpress

Comments

  1. martin says

    September 12, 2018 at 2:32 am

    hi

    i have one hosting provider giving hosting and email services
    i have currently configured dnszone named servers on godaddy to point to above hosting provider
    where it is redirected to azure web app services through cname and a record.
    Thx i understand from above that dnszone can be create cname and a record on azure itself.

    My only question how can i use the email services only of current hosting provider after
    if i have switched dnzzone on to azure?

    appreciate u help

    Reply
    • Leron Amin says

      September 12, 2018 at 9:56 pm

      Hi Martin,

      You will still have DNS mail records that are specific to the email services on your current hosting provider.

      All you would need to do is to copy and paste those mail records from your email services provider and add them to your DNS Zone on Azure.

      Let me know if you have any questions,
      Joe

  2. proib says

    September 4, 2018 at 2:44 am

    Awesome!, got it but having a problem on my site previews and dashboard

    Dashboard: Two dashboard display= Network admin and my user
    Site preview: Greetings Network Administrator! The network currently allows both site and user registrations. To change or disable registration go to your Options page.

    pls how can I fix this

    proib.us

    Reply
  3. Venky says

    April 16, 2018 at 4:06 am

    Awesome tutorials

    Reply
    • Leron Amin says

      April 16, 2018 at 12:22 pm

      Thanks Venky! 🙂

  4. Leron Amin says

    November 17, 2017 at 6:33 pm

    What did you think of this tutorial?
    Share your questions and comments below!

    Reply

Leave a Reply Cancel reply

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

Want Exclusive Tutorials?

Welcome to One Page Zen!

Through this blog I hope to introduce web developers to cloud computing!

author-bio

facebook-support-group kinsta-cloud-hosting

Want Exclusive Tutorials?


Contact | Sitemap | Legal | Privacy Policy | Affiliate Disclosure
      Copyright © 2017 - 2019 One Page Zen
Share this Article

Email sent!