question

AjayKur-7869 avatar image
0 Votes"
AjayKur-7869 asked Taz-3478 edited

how to add a domain to virtual machine

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-webapps
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Taz-3478 avatar image
1 Vote"
Taz-3478 answered Taz-3478 edited

Hello @AjayKur-7869!

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









essentials.png (28.4 KiB)
ip-config.png (49.2 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.