Note
ამ გვერდზე წვდომა ავტორიზაციას მოითხოვს. შეგიძლიათ სცადოთ შესვლა ან დირექტორიების შეცვლა.
ამ გვერდზე წვდომა ავტორიზაციას მოითხოვს. შეგიძლიათ სცადოთ დირექტორიების შეცვლა.
You can create an alias record to reference an Azure resource. An example is an alias record that references an Azure public IP resource.
In this tutorial, you learn how to:
- Create a virtual network and a subnet.
- Create a web server virtual machine with a public IP.
- Create an alias record that points to the public IP.
- Test the alias record.
If you don’t have an Azure subscription, create a free account before you begin.
Prerequisites
- An Azure account with an active subscription.
- A domain name hosted in Azure DNS. If you don't have an Azure DNS zone, you can create a DNS zone, then delegate your domain to Azure DNS.
Note
In this tutorial, contoso.com is used as an example domain name. Replace contoso.com with your own domain name.
Sign in to Azure
Sign in to the Azure portal.
Create the network infrastructure
Create a virtual network and a subnet to place your web server in.
In the Azure portal, enter virtual network in the search box at the top of the portal, and then select Virtual networks from the search results.
In Virtual networks, select + Create.
In Create virtual network, enter or select the following information in the Basics tab:
Setting Value Project Details Subscription Select your Azure subscription. Resource Group Select Create new.
In Name, enter PIPResourceGroup.
Select OK.Instance details Name Enter myPIPVNet. Region Select your region. Select the IP Addresses tab or select the Next: IP Addresses button at the bottom of the page.
In the IP Addresses tab, enter the following information:
Setting Value IPv4 address space Enter 10.10.0.0/16. Select + Add subnet, and enter this information in the Add subnet:
Setting Value Subnet name Enter WebSubnet. Subnet address range Enter 10.10.0.0/24. Select Add.
Select the Review + create tab or select the Review + create button.
Select Create.
Create a web server virtual machine
Create a Linux virtual machine and install NGINX web server on it.
Create the virtual machine
Create an Ubuntu virtual machine.
In the Azure portal, enter virtual machine in the search box at the top of the portal, and then select Virtual machines from the search results.
In Virtual machines, select + Create and then select Azure virtual machine.
In Create a virtual machine, enter or select the following information in the Basics tab:
Setting Value Project Details Subscription Select your Azure subscription. Resource Group Select PIPResourceGroup. Instance details Virtual machine name Enter web-01. Region Select (US) East US. Availability options Select No infrastructure redundancy required. Security type Select Standard. Image Select Ubuntu Server 24.04 LTS - x64 Gen2. Size Select your VM size. Administrator account Authentication type Select SSH public key. Username Enter a username. SSH public key source Select Generate new key pair. Key pair name Enter a name for the key pair. Inbound port rules Public inbound ports Select None. Select the Networking tab, or select Next: Disks, then Next: Networking.
In the Networking tab, enter or select the following information:
Setting Value Network interface Virtual network Select myPIPVNet. Subnet Select WebSubnet. Public IP Take the default Standard SKU public IP. NIC network security group Select Basic. Public inbound ports Select Allow selected ports. Select inbound ports Select HTTP (80) and HTTPS (443). Select Review + create.
Review the settings, and then select Create.
This deployment may take a few minutes to complete.
Note
The web-01 virtual machine has an attached NIC with a Standard SKU dynamic public IP that changes every time the virtual machine is restarted.
Note
The network security group rules block inbound SSH access from the internet. To run commands on the virtual machine, use the Run command feature in the Azure portal or deploy Azure Bastion. For more information about Azure Bastion, see Quickstart: Deploy Azure Bastion with default settings.
Install NGINX web server
Install NGINX web server on web-01 using the Run command feature in the Azure portal.
In the search box at the top of the portal, enter virtual machine. Select Virtual machines in the search results.
Select the web-01 virtual machine.
In the Operations section of the left menu, select Run command.
Select RunShellScript.
In the Run Command Script pane, enter the following command:
sudo apt-get update && sudo apt-get install -y nginxSelect Run.
Wait for the command to complete. The output displays the installation progress and finishes when NGINX is installed.
Create an alias record
Create an alias record that points to the public IP address.
In the Azure portal, enter contoso.com in the search box at the top of the portal, and then select contoso.com DNS zone from the search results.
In the Overview page, select the + Record set button.
In the Add record set, enter web01 in the Name.
Select A for the Type.
Select Yes for the Alias record set, and then select the Azure Resource for the Alias type.
Select the web-01-ip public IP address for the Azure resource.
Select OK.
Test the alias record
- In the Azure portal, enter virtual machine in the search box at the top of the portal, and then select Virtual machines from the search results.
- Select the web-01 virtual machine. Note the public IP address in the Overview page.
- From a web browser, browse to
web01.contoso.com, which is the fully qualified domain name of the web-01 virtual machine. You now see the NGINX default web page. - Close the web browser.
- Stop the web-01 virtual machine, and then restart it.
- After the virtual machine restarts, note the new public IP address for the virtual machine.
- From a web browser, browse again to
web01.contoso.com.
This procedure succeeds because you used an alias record to point to the public IP resource instead of a standard A record that points to the public IP address, not the resource.
Clean up resources
When no longer needed, you can delete all resources created in this tutorial by following these steps:
- On the Azure portal menu, select Resource groups.
- Select the PIPResourceGroup resource group.
- On the Overview page, select Delete resource group.
- Enter PIPResourceGroup and select Delete.
- On the Azure portal menu, select All resources.
- Select contoso.com DNS zone.
- On the Overview page, select the web01 record created in this tutorial.
- Select Delete and then Yes.
Next steps
In this tutorial, you learned how to create an alias record to refer to an Azure public IP address resource. To learn how to create an alias record to support an apex domain name with Traffic Manager, continue with the next tutorial: