Virtual Network
Ankit Ranjan (DevOps Engineer)
Actively Seeking Full-time Azure DevOps/Azure Cloud Engineer Opportunities | Certified Terraform Associate | IAM-Azure DevOps Engineer | Ebug India
Create a virtual network using the Azure portal
This quickstart guides you through creating a virtual network using the Azure portal. You'll then set up two virtual machines (VMs) within the network, deploy Azure Bastion for secure internet-based VM access, and enable private communication between the VMs.
Prerequisites: - An active Azure subscription. If you don't have one, you can create a free account.
Sign in to Azure: - Use your Azure account to access the Azure portal.
Create a Virtual Network and Azure Bastion Host
Follow these steps to set up a virtual network with a resource subnet, an Azure Bastion subnet, and a Bastion host:
1. In the Azure portal, search for and select Virtual networks.
2. On the Virtual Networks page, click + Create.
3. In the Basics tab of the Create Virtual Network page, enter or select the required details.
4. Click Next to proceed to the Security tab.
5. In the Azure Bastion section, enable Azure Bastion by selecting Enable Azure Bastion.
6. Enter or select the necessary information for Azure Bastion
7. click Next to the IP Addresses tab.
8. choose the default subnet in the address space box under Subnets.
9. In the Edit subnet window, provide the required information and click Save.
10. Select Review + Create at the bottom of the page. Once the validation is successful, click Create.
Create Virtual Machines
Follow these steps to create two virtual machines, named vm-1 and vm-2, within the virtual network:
1. In the Azure portal, search for and select Virtual machines.
2. On the Virtual Machines page, click + Create, then select Azure virtual machine.
3. In the Basics tab of the Create a Virtual Machine page, enter or select the necessary details.
4. Move to the Networking tab and provide the required information.
5. Leave the remaining settings as defaults, and click Review + Create.
6. Review the settings, and select Create.
领英推荐
7. Once the first virtual machine is deployed, repeat these steps to create a second virtual machine with the same settings.
Connect to a Virtual Machine
Follow these steps to connect to vm-1:
1. In the Azure portal, search for and select Virtual machines.
2. On the Virtual Machines page, choose vm-1.
3. In the Overview section of vm-1, click Connect.
4. On the Connect to Virtual Machine page, go to the Bastion tab.
5. Select Use Bastion.
6. Enter the username and password you set when creating the VM, then click Connect.
Create a virtual network using PowerShell
Use New-AzVirtualNetwork to create a virtual network.
Create a Virtual Network Using the Azure CLI
Use the az network vnet create command to create a virtual network.
Delete a Virtual Network
You can only delete a virtual network if no resources are connected to it. If there are resources linked to any subnet within the virtual network, you must first remove those resources. The steps for deleting a resource depend on its type. To learn how to delete resources connected to subnets, refer to the documentation for each specific resource type you wish to remove. Here’s how to delete a virtual network:
Delete a Virtual Network Using the Azure Portal
1. In the search box at the top of the portal, type Virtual Networks and select it from the search results.
2. From the list of virtual networks, choose the one you want to delete.
3. Verify that there are no connected devices by selecting Connected devices under Settings. If any devices are connected, you must delete them before proceeding with the virtual network deletion. If there are no connected devices, go to the Overview tab.
4. Click Delete.
5. To confirm the deletion of the virtual network, select Yes.
Delete a virtual network using PowerShell
Use Remove-AzVirtualNetwork to delete a virtual network
Delete a virtual network using the Azure CLI
Use az network vnet delete to delete a virtual network.