How to Transfer a Domain Name to Azure

November 16, 2017Leron AminComments Open

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 7 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

Optional configurations:

  • Include WWW. Prefix

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.

Optional Configurations

How to Include WWW. Prefix

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
Now that you’ve transferred a domain name to Azure, learn how to migrate your WordPress website installation to Azure.

Leave a Reply

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

Made with by

© 2020 One Page Zen Systems, LLC  
Legal  |  Privacy Policy  |  Affiliate Disclosure  |  Contact  

Join our Mailing List!

Exclusive early access to the latest tutorials

Monthly update with a list of upcoming tutorials

Special access to members-only events and webinars