How to Delete Virtual Network in Azure
Last Updated :
26 Apr, 2024
We often create virtual networks in Azure to manage and maintain our virtual machines. When the virtual machines or resources are no longer needed, we manage them by deleting the virtual machines, and sometimes we may also find the virtual network is no longer needed. We may find the VNET no longer needed considering the factors including resource usage, project lifecycle, and cost optimization. In this article, let us understand deleting a Virtual Network in Azure with different approaches. Before diving into the topic, let us have an overview of the Virtual network in Azure.
Azure Virtual Network allows its customers to create, manage, monitor, and secure connectivity between Azure resources and their on-premise environments.
Creating a Virtual Network using Azure PowerShell
To execute the desired action, kindly access Windows PowerShell and proceed by selecting "Run as administrator" from the context menu upon right-clicking.


Enter the following commands to create a Virtual Network using Azure PowerShell
Step 1: Set up the Azure services in PowerShell
As the initial step, establish the Azure services within PowerShell environment by executing the following command:
Install-Module Az -Force -AllowClobber
In addition, you may need to adjust the execution policy to 'RemoteSigned' by running the following command:
Set-ExecutionPolicy RemoteSigned

Step 2: Connect to your Azure account
To connect to your Azure account, Navigate to your azure portal and search for tenant properties, under that find the tenant Id. copy the tenant Id.


To establish a connection, kindly utilize the "Connect-AzAccount" command in PowerShell, specifying your Tenant ID as follows:
Connect-AzAccount -TenantId <Copy-your-tenantid-here>
It will ask to choose your Azure account and after Authentication is completed, you can navigate back to the PowerShell.


Step 3: Create a Resource Group
Execute the following command in PowerShell to create a new resource group, ensuring to replace <your-resource-group-name>
with your desired name and <your-resource-group-location>
with the location of your resource group.
New-AzResourceGroup -ResourceGroupName <your-resource-group-name> -Location <your-resource-group-location>
Step 4: Create a Virtual Newtwork in the resource group
Establish a Virtual Network within the designated resource group by executing the following PowerShell command:
$<your-vnet-name> = New-AzVirtualNetwork -ResourceGroupName <your-resource-group-name> -Location <your-resource-group-location> -Name <yTour-vnet-name> -AddressPrefix <address-prefix-of-your-vnet>
Ensure to replace placeholders such as <your-vnet-name>
, <your-resource-group-name>
, <your-resource-group-location>
, and <address-prefix-of-your-vnet>
with appropriate values as per your configuration.
Step 5: Check whether the Virtual Network is created or not
Verify the existence of the Virtual Network by executing the following command in the PowerShell environment.
Get-AzVirtualNetwork -Name myVnet001

Deleting a Virtual network using PowerShell
There are multiple ways to create or delete a virtual network. Either we can delete the virtual network from the Azure portal directly or We can use commands to delete the virtual network using the PowerShell. Let us see how to delete a virtual network using PowerShell.
Step 1: To remove the Virtual Network, please execute the following command in PowerShell.
Remove-AzVirtualNetwork -Name <your-vnet-name> -ResourceGroupName <your-resource-group-name>
Ensure that you replace <your-vnet-name>
with the name of your Virtual Network and <your-resource-group-name>
with the name of your resource group.

Step 2: Validate the deletion status of the virtual network by executing the following command.
Get-AzVirtualNetwork -Name myVnet001
Step 3: In the absence of a virtual network bearing the specified name, the system will display no results or information pertaining to it.

Step 4: In addition, you may navigate to the Azure portal and access the "Marketplace" section, followed by selecting "Virtual Networks" to verify the absence of any virtual network bearing the specified name.

To delete the Virtual network using Azure Portal, Navigate to the Virtual Networks service in the marketplace and Delete the associated Vnets and subnets using the Delete option.
Deleting a Virtual Network using Azure Portal
Here is the detail steps to delete the virtual network using the azure portal.
Step 1: Access Azure Portal
- Open your web browser and navigate to the Azure Portal by typing in the URL or searching for "Azure Portal" in a search engine.
Step 2: Sign In
- Sign in to the Azure Portal using your Azure account credentials. If you don't have an account, you will need to create one.
Step 3: Navigate to Virtual Network Section
- Once logged in, you'll land on the Azure Portal dashboard.
- Look for the navigation menu on the left-hand side of the screen.
- Scroll down or use the search bar to find the "Virtual networks" option under the "Networking" category. Click on it to access the Virtual Network section.
Step 4: Explore Virtual Networks
- In the Virtual Network section, you will see a list of virtual networks that have been created in your Azure account. You can click on each virtual network to view its details, settings, and associated resources.

Step 5: Select Virtual Network
Identify and select the specific virtual network that you intend to delete.

Step 6: Review Connected Resources
- Before proceeding with the deletion, carefully review if there are any connected devices or resources linked to the virtual network.

Step 7: Handle Connected Resources
- If there are connected resources:
- Determine if they need to be backed up or migrated to another location.
- Disconnect or delete the associated resources from the virtual network.
Step 8: Initiate Virtual Network Deletion
- Return to the overview page of the virtual network.
Step 9: Start Deletion Process
- Look for the "Delete" option and click on it to initiate the deletion process.

Step 10: Confirm Deletion
- Confirm the deletion action when prompted by the Azure portal.


- Then you can navigate back to your virtual network and delete the Virtual network.

Conclusion
Deleting Virtual Network can be cost-effective and resource optimisation when it is not longer required but, Ensure and back-up the underlying critical resources with the virtual network.
Similar Reads
Non-linear Components
In electrical circuits, Non-linear Components are electronic devices that need an external power source to operate actively. Non-Linear Components are those that are changed with respect to the voltage and current. Elements that do not follow ohm's law are called Non-linear Components. Non-linear Co
11 min read
Class Diagram | Unified Modeling Language (UML)
A UML class diagram is a visual tool that represents the structure of a system by showing its classes, attributes, methods, and the relationships between them. It helps everyone involved in a projectâlike developers and designersâunderstand how the system is organized and how its components interact
12 min read
Spring Boot Tutorial
Spring Boot is a Java framework that makes it easier to create and run Java applications. It simplifies the configuration and setup process, allowing developers to focus more on writing code for their applications. This Spring Boot Tutorial is a comprehensive guide that covers both basic and advance
10 min read
Backpropagation in Neural Network
Back Propagation is also known as "Backward Propagation of Errors" is a method used to train neural network . Its goal is to reduce the difference between the modelâs predicted output and the actual output by adjusting the weights and biases in the network.It works iteratively to adjust weights and
9 min read
Polymorphism in Java
Polymorphism in Java is one of the core concepts in object-oriented programming (OOP) that allows objects to behave differently based on their specific class type. The word polymorphism means having many forms, and it comes from the Greek words poly (many) and morph (forms), this means one entity ca
7 min read
AVL Tree Data Structure
An AVL tree defined as a self-balancing Binary Search Tree (BST) where the difference between heights of left and right subtrees for any node cannot be more than one. The absolute difference between the heights of the left subtree and the right subtree for any node is known as the balance factor of
4 min read
Virtualization in Cloud Computing and Types
Virtualization is the technology that enables to create virtual environments from a single physical machine. In this article, you will learn what a virtual machine is, why it is important, the different types of virtualization, how it works, and the benefits and disadvantages associated with it. Vir
11 min read
What is Vacuum Circuit Breaker?
A vacuum circuit breaker is a type of breaker that utilizes a vacuum as the medium to extinguish electrical arcs. Within this circuit breaker, there is a vacuum interrupter that houses the stationary and mobile contacts in a permanently sealed enclosure. When the contacts are separated in a high vac
13 min read
3-Phase Inverter
An inverter is a fundamental electrical device designed primarily for the conversion of direct current into alternating current . This versatile device , also known as a variable frequency drive , plays a vital role in a wide range of applications , including variable frequency drives and high power
13 min read
What Is Cloud Computing ? Types, Architecture, Examples and Benefits
Nowadays, Cloud computing is adopted by every company, whether it is an MNC or a startup many are still migrating towards it because of the cost-cutting, lesser maintenance, and the increased capacity of the data with the help of servers maintained by the cloud providers. Cloud Computing means stori
15 min read