Get-AzNetworkInterface

This cmdlet retrieves one or more network interfaces.

SYNOPSIS

Gets a network interface.

SYNTAX

Get-AzNetworkInterface
    -Name "<NetworkInterfaceName>"
    [-ResourceGroupName "<ResourceGroupName>"]
    [-Force]
    [-AsJob]
    [-DefaultProfile "<DefaultProfile>"]

Get-AzNetworkInterface
    -ResourceId "<ResourceId>"
    [-Force]
    [-AsJob]
    [-DefaultProfile "<DefaultProfile>"]

Get-AzNetworkInterface
    -NetworkInterface "<INetworkInterface>"
    [-Force]
    [-AsJob]
    [-DefaultProfile "<DefaultProfile>"]

DESCRIPTION

The Get-AzNetworkInterface cmdlet retrieves one or more network interfaces associated with a virtual machine. You can retrieve a specific network interface by providing its name and resource group name. Alternatively, you can retrieve a network interface using its resource ID or by passing a network interface object.

PARAMETERS

Name Type Description
-Name String Specifies the name of the network interface.
-ResourceGroupName String Specifies the name of the resource group for the network interface.
-ResourceId String The resource ID of the network interface.
-NetworkInterface INetworkInterface A network interface object.
-Force SwitchParameter Forces the command to run without asking for confirmation.
-AsJob SwitchParameter Run cmdlet in the background.
-DefaultProfile String The default profile for the cmdlet.

EXAMPLES

Example 1: Get a network interface by name and resource group

Get-AzNetworkInterface -Name "MyNic" -ResourceGroupName "MyResourceGroup"

Example 2: Get all network interfaces in a resource group

Get-AzNetworkInterface -ResourceGroupName "MyResourceGroup"

Example 3: Get a network interface using its Resource ID

Get-AzNetworkInterface -ResourceId "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup/providers/Microsoft.Network/networkInterfaces/MyNic"

Note

Network interfaces are fundamental components for virtual machines, enabling communication within Azure and with the internet. Use this cmdlet to inspect the properties and configurations of your network interfaces.