how to add a domain to virtual machine

AjayKur 21 Reputation points
2021-10-06T11:19:48.073+00:00

i am running a azure virtualmachine - linux to run a website. I want to use my custom domain to access it instead of its ip. i can see an option of adding domain in appservice but not here. Please help me if it is possible to do so

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,837 questions
0 comments No comments
{count} votes

Accepted answer
  1. Tasadduq Burney 8,361 Reputation points MVP
    2021-10-06T11:29:09.347+00:00

    Hello @AjayKur !

    Hope you are having a great day!
    Thank you for asking a Question! We are Glad to Assist you!.

    Please follow the steps mentioned below to add your Custom Domain to VM as alias.

    When you create a virtual machine in the Azure portal, a public IP resource for the virtual machine is automatically created. Your public IP address is shown in VM overview page.

    138148-essentials.png

    Shows the public IP address in the essentials section of the VM overview page.

    If you select the IP address you can see more information on it. Check to make sure your IP Assignment is set to Static. A static IP address will not change if the VM or resource reboots or shuts down.

    138173-ip-config.png

    Shows the public IP configuration so you can see if the IP address is static.

    If your IP Address is not static, you will need to create an FQDN.

    1. Select your VM in the portal.
    2. In the left menu, select Properties
    3. Under Public IP address\DNS name label, select your IP address.
    4. Under DNS name label, enter the prefix you want to use.
    5. Select Save at the top of the page.
    6. Select Overview in the left menu to return to the VM overview blade.
    7. Verify that the DNS name appears correctly.

    Open a browser and enter your IP address or FQDN and verify that it shows the web content running on your VM.

    After verifying your static IP or FQDN, go to your domain provider and navigate to DNS settings.
    Once there add an A record pointing to your Public IP Address or FQDN. For example, the procedure for the GoDaddy domain registrar / Azure Domain Service is as follows:

    1. Sign in and select the custom domain you want to use.
    2. In the Domains section, select Manage All, then select DNS | Manage Zones.
    3. For Domain Name, enter your custom domain, then select Search.
    4. From the DNS Management page, select Add, then select A in the Type list.
    5. Complete the fields of the A entry:
    6. Type: Leave A selected.
    7. Host: Enter @
    8. Points to: Enter the Public IP Address or FQDN of your VM.
    9. TTL: Leave one hour selected.
    10. Select Save.
    11. The A record entry is added to the DNS records table.

    !How to create a DNS Zone in Azure?

    1. Create a DNS zone
    2. Go to the Azure portal to create a DNS zone. Search for and select DNS zones.
    3. DNS zone
    4. Select Create DNS zone.
    5. On the Create DNS zone page, enter the required values, and then select Create.

    138099-domain-name-server.png

    1. Use the Above NameServer and update it on your Custom Domain Purchased from Azure Domain Services
    2. Go to Azure Domain
    3. Select your Domain
    4. Go to Advance Management
    5. Go to DNS and add the new Name Servers and save the changes
    6. After the Changes has been performed, add the Alias by going to your Virtual Machine's VNet > Configuration > Create Alias Record and Add your "@" and "www" record to your domain.

    After the record is created it usually takes about an hour for DNS propagate, but it can sometimes take up to 48 hours.

    Let me know if the above solution resolved your issue!

    Regards,
    Tasadduq Burney

    __

    |- Please don't forget to "Upvote" and "Accept as answer" if the reply is helpful -|

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful