AWS/Azure/OpenShift/Kubernetes

How to Add or Remove Network Interface from a VM in Azure

Webp.net-resizeimage-3-2

A network interface enables an Azure Virtual Machine to communicate with the internet, Azure, and on-premises resources. When creating a virtual machine using the Azure portal, the portal creates one network interface with default settings for you. Also, Network Interface Card (NIC) is assigned with IP address and associated with NSG rules, which is used for the communication between virtual machines or internal network or internet. The VM needs at least one NIC, NIC connects VM to the VNet. One VM can have multiple NIC’s as well. kindly refer to some of my contents: How to configure and install ansible on Azure VM, how to use Azure key vault secrets in Azure pipelines and understanding the overview concept of Azure cloud shell.


In this article, you will learn how to add or remove network interface card in Azure VM by following best practices.

  • Create an Azure VM.
  • Add a network interface card to an existing VM
  • Remove a network interface card from a VM in Azure
  • Sign in to Azure

    First, sign in to the Azure portal following this link https://portal.azure.com and using your Microsoft login credentials.

    Webp.net-resizeimage-3

    Create a VM

    From your Azure dashboard, at the top, perform the following below:

    1. Type virtual machines in the search.
    2. Under Services, select Virtual machines.
    3. In the Virtual machines page, select Create then Virtual machine.
    4. In the Basics tab, under Project details, make sure the correct subscription is selected and then choose to Create new resource group. Type myResourceGroup for the name.
    Webp.net-resizeimage-4

    Click on create

    Webp.net-resizeimage-5
    Webp.net-resizeimage-6

    Under Instance details, type newVM1 for the Virtual machine name and choose East US for your Region. Choose Windows Server 2019 Datacenter for the Image and Standard_DS1_v2 for the Size. Leave the other defaults.

    Webp.net-resizeimage-7

    Then under Administrator account, type in a username, such as myusername and set a password which must be at least 12 characters long in order to meet the requirement.

    Webp.net-resizeimage-8

    Under Inbound port rules, choose Allow selected ports and then select RDP (3389) and HTTP (80) from the drop-down.

    Webp.net-resizeimage-9

    Then leave the remaining as defaults Lastly, select the Review + create button at the bottom of the page.

    Webp.net-resizeimage-10

    After validation runs, select the Create button at the bottom of the page.

    Webp.net-resizeimage-11

    After deployment is complete, select Go to the resource.

    Webp.net-resizeimage-12

    Add a network interface card to an existing VM

    1. Sign in to the Azure portal with your credentials.
    2. In the search box at the top of the portal, type the name of the VM you just created or select any VM name to which you want to add the Network Interface Card, or browse for the VM by selecting All services, and then Virtual machines. After you’ve found the VM, select it. The VM must support the number of network interfaces you want to add. 
    Webp.net-resizeimage-14

    Then Select Overview, under SETTINGS. Select Stop, and then wait until the Status of the VM changes to Stopped (deallocated).

    Webp.net-resizeimage-13

    Select Networking, under SETTINGS at the left pane

    Webp.net-resizeimage-15

    Select Attach network interface. From the list of network interfaces that aren’t currently attached to another VM, select the one you’d like to attach.

    Webp.net-resizeimage-16
    Webp.net-resizeimage-19

    If you don’t have an existing network interface, you must first create one. To do so, select Create network interface.

    Webp.net-resizeimage-17

    Click on create and attach network interface as shown below

    Webp.net-resizeimage-18
    1. Select OK and Create.
    2. Select Overview, under SETTINGS, and then Start to start the virtual machine.

    Remove a network interface card from a VM

    1. Sign in to the Azure portal with your credentials.
    2. In the search box at the top of the portal, search for the name of the VM you want to remove (detach) the Network Interface from, or browse for the VM by selecting All services, and then Virtual machines. After you’ve found the VM, select it.
    3. Once the VM is open select Overview at the left hand side, under SETTINGS, and then Stop. Wait until the Status of the VM changes to Stopped (deallocated).
    Webp.net-resizeimage-21

    Then select Networking, under SETTINGS.

    Webp.net-resizeimage-22

    Select Detach network interface. From the list of network interfaces currently attached to the virtual machine, select the network interface you’d like to detach. If only one network interface is listed, you cannot detach it, because a virtual machine must always have at least one network interface attached to it.

    Webp.net-resizeimage-23

    Click on “Detach network interface” as shown below and click on OK.

    Webp.net-resizeimage-24

    Summary:

    We have seen the step by steps on how to add or remove Network Interface from VM in Azure, knowing how to add a network interface card to an existing VM in Azure, how to create a network interface card, also how to remove or detached a network interface card from a VM in Azure. I hope you find this article useful.

    Subscribe
    Notify of
    guest
    0 Comments
    Inline Feedbacks
    View all comments
    0
    Would love your thoughts, please comment.x
    ()
    x