1. Packages
  2. Azure Classic
  3. API Docs
  4. network
  5. getNetworkInterface

We recommend using Azure Native.

Azure v6.21.0 published on Friday, Mar 7, 2025 by Pulumi

azure.network.getNetworkInterface

Explore with Pulumi AI

We recommend using Azure Native.

Azure v6.21.0 published on Friday, Mar 7, 2025 by Pulumi

Use this data source to access information about an existing Network Interface.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const example = azure.network.getNetworkInterface({
    name: "acctest-nic",
    resourceGroupName: "networking",
});
export const networkInterfaceId = example.then(example => example.id);
Copy
import pulumi
import pulumi_azure as azure

example = azure.network.get_network_interface(name="acctest-nic",
    resource_group_name="networking")
pulumi.export("networkInterfaceId", example.id)
Copy
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/network"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := network.LookupNetworkInterface(ctx, &network.LookupNetworkInterfaceArgs{
			Name:              "acctest-nic",
			ResourceGroupName: "networking",
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("networkInterfaceId", example.Id)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var example = Azure.Network.GetNetworkInterface.Invoke(new()
    {
        Name = "acctest-nic",
        ResourceGroupName = "networking",
    });

    return new Dictionary<string, object?>
    {
        ["networkInterfaceId"] = example.Apply(getNetworkInterfaceResult => getNetworkInterfaceResult.Id),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.network.NetworkFunctions;
import com.pulumi.azure.network.inputs.GetNetworkInterfaceArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var example = NetworkFunctions.getNetworkInterface(GetNetworkInterfaceArgs.builder()
            .name("acctest-nic")
            .resourceGroupName("networking")
            .build());

        ctx.export("networkInterfaceId", example.applyValue(getNetworkInterfaceResult -> getNetworkInterfaceResult.id()));
    }
}
Copy
variables:
  example:
    fn::invoke:
      function: azure:network:getNetworkInterface
      arguments:
        name: acctest-nic
        resourceGroupName: networking
outputs:
  networkInterfaceId: ${example.id}
Copy

Using getNetworkInterface

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getNetworkInterface(args: GetNetworkInterfaceArgs, opts?: InvokeOptions): Promise<GetNetworkInterfaceResult>
function getNetworkInterfaceOutput(args: GetNetworkInterfaceOutputArgs, opts?: InvokeOptions): Output<GetNetworkInterfaceResult>
Copy
def get_network_interface(name: Optional[str] = None,
                          resource_group_name: Optional[str] = None,
                          opts: Optional[InvokeOptions] = None) -> GetNetworkInterfaceResult
def get_network_interface_output(name: Optional[pulumi.Input[str]] = None,
                          resource_group_name: Optional[pulumi.Input[str]] = None,
                          opts: Optional[InvokeOptions] = None) -> Output[GetNetworkInterfaceResult]
Copy
func LookupNetworkInterface(ctx *Context, args *LookupNetworkInterfaceArgs, opts ...InvokeOption) (*LookupNetworkInterfaceResult, error)
func LookupNetworkInterfaceOutput(ctx *Context, args *LookupNetworkInterfaceOutputArgs, opts ...InvokeOption) LookupNetworkInterfaceResultOutput
Copy

> Note: This function is named LookupNetworkInterface in the Go SDK.

public static class GetNetworkInterface 
{
    public static Task<GetNetworkInterfaceResult> InvokeAsync(GetNetworkInterfaceArgs args, InvokeOptions? opts = null)
    public static Output<GetNetworkInterfaceResult> Invoke(GetNetworkInterfaceInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetNetworkInterfaceResult> getNetworkInterface(GetNetworkInterfaceArgs args, InvokeOptions options)
public static Output<GetNetworkInterfaceResult> getNetworkInterface(GetNetworkInterfaceArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: azure:network/getNetworkInterface:getNetworkInterface
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Name This property is required. string
Specifies the name of the Network Interface.
ResourceGroupName This property is required. string
Specifies the name of the resource group the Network Interface is located in.
Name This property is required. string
Specifies the name of the Network Interface.
ResourceGroupName This property is required. string
Specifies the name of the resource group the Network Interface is located in.
name This property is required. String
Specifies the name of the Network Interface.
resourceGroupName This property is required. String
Specifies the name of the resource group the Network Interface is located in.
name This property is required. string
Specifies the name of the Network Interface.
resourceGroupName This property is required. string
Specifies the name of the resource group the Network Interface is located in.
name This property is required. str
Specifies the name of the Network Interface.
resource_group_name This property is required. str
Specifies the name of the resource group the Network Interface is located in.
name This property is required. String
Specifies the name of the Network Interface.
resourceGroupName This property is required. String
Specifies the name of the resource group the Network Interface is located in.

getNetworkInterface Result

The following output properties are available:

AcceleratedNetworkingEnabled bool
Indicates if accelerated networking is set on the specified Network Interface.
AppliedDnsServers List<string>
List of DNS servers applied to the specified Network Interface.
DnsServers List<string>
The list of DNS servers used by the specified Network Interface.
Id string
The provider-assigned unique ID for this managed resource.
InternalDnsNameLabel string
The internal DNS name label of the specified Network Interface.
IpConfigurations List<GetNetworkInterfaceIpConfiguration>
One or more ip_configuration blocks as defined below.
IpForwardingEnabled bool
Indicate if IP forwarding is set on the specified Network Interface.
Location string
The location of the specified Network Interface.
MacAddress string
The MAC address used by the specified Network Interface.
Name string
The name of the IP Configuration.
NetworkSecurityGroupId string
The ID of the network security group associated to the specified Network Interface.
PrivateIpAddress string
The Private IP Address assigned to this Network Interface.
PrivateIpAddresses List<string>
The list of private IP addresses associates to the specified Network Interface.
ResourceGroupName string
Tags Dictionary<string, string>
List the tags associated to the specified Network Interface.
VirtualMachineId string
The ID of the virtual machine that the specified Network Interface is attached to.
AcceleratedNetworkingEnabled bool
Indicates if accelerated networking is set on the specified Network Interface.
AppliedDnsServers []string
List of DNS servers applied to the specified Network Interface.
DnsServers []string
The list of DNS servers used by the specified Network Interface.
Id string
The provider-assigned unique ID for this managed resource.
InternalDnsNameLabel string
The internal DNS name label of the specified Network Interface.
IpConfigurations []GetNetworkInterfaceIpConfiguration
One or more ip_configuration blocks as defined below.
IpForwardingEnabled bool
Indicate if IP forwarding is set on the specified Network Interface.
Location string
The location of the specified Network Interface.
MacAddress string
The MAC address used by the specified Network Interface.
Name string
The name of the IP Configuration.
NetworkSecurityGroupId string
The ID of the network security group associated to the specified Network Interface.
PrivateIpAddress string
The Private IP Address assigned to this Network Interface.
PrivateIpAddresses []string
The list of private IP addresses associates to the specified Network Interface.
ResourceGroupName string
Tags map[string]string
List the tags associated to the specified Network Interface.
VirtualMachineId string
The ID of the virtual machine that the specified Network Interface is attached to.
acceleratedNetworkingEnabled Boolean
Indicates if accelerated networking is set on the specified Network Interface.
appliedDnsServers List<String>
List of DNS servers applied to the specified Network Interface.
dnsServers List<String>
The list of DNS servers used by the specified Network Interface.
id String
The provider-assigned unique ID for this managed resource.
internalDnsNameLabel String
The internal DNS name label of the specified Network Interface.
ipConfigurations List<GetNetworkInterfaceIpConfiguration>
One or more ip_configuration blocks as defined below.
ipForwardingEnabled Boolean
Indicate if IP forwarding is set on the specified Network Interface.
location String
The location of the specified Network Interface.
macAddress String
The MAC address used by the specified Network Interface.
name String
The name of the IP Configuration.
networkSecurityGroupId String
The ID of the network security group associated to the specified Network Interface.
privateIpAddress String
The Private IP Address assigned to this Network Interface.
privateIpAddresses List<String>
The list of private IP addresses associates to the specified Network Interface.
resourceGroupName String
tags Map<String,String>
List the tags associated to the specified Network Interface.
virtualMachineId String
The ID of the virtual machine that the specified Network Interface is attached to.
acceleratedNetworkingEnabled boolean
Indicates if accelerated networking is set on the specified Network Interface.
appliedDnsServers string[]
List of DNS servers applied to the specified Network Interface.
dnsServers string[]
The list of DNS servers used by the specified Network Interface.
id string
The provider-assigned unique ID for this managed resource.
internalDnsNameLabel string
The internal DNS name label of the specified Network Interface.
ipConfigurations GetNetworkInterfaceIpConfiguration[]
One or more ip_configuration blocks as defined below.
ipForwardingEnabled boolean
Indicate if IP forwarding is set on the specified Network Interface.
location string
The location of the specified Network Interface.
macAddress string
The MAC address used by the specified Network Interface.
name string
The name of the IP Configuration.
networkSecurityGroupId string
The ID of the network security group associated to the specified Network Interface.
privateIpAddress string
The Private IP Address assigned to this Network Interface.
privateIpAddresses string[]
The list of private IP addresses associates to the specified Network Interface.
resourceGroupName string
tags {[key: string]: string}
List the tags associated to the specified Network Interface.
virtualMachineId string
The ID of the virtual machine that the specified Network Interface is attached to.
accelerated_networking_enabled bool
Indicates if accelerated networking is set on the specified Network Interface.
applied_dns_servers Sequence[str]
List of DNS servers applied to the specified Network Interface.
dns_servers Sequence[str]
The list of DNS servers used by the specified Network Interface.
id str
The provider-assigned unique ID for this managed resource.
internal_dns_name_label str
The internal DNS name label of the specified Network Interface.
ip_configurations Sequence[GetNetworkInterfaceIpConfiguration]
One or more ip_configuration blocks as defined below.
ip_forwarding_enabled bool
Indicate if IP forwarding is set on the specified Network Interface.
location str
The location of the specified Network Interface.
mac_address str
The MAC address used by the specified Network Interface.
name str
The name of the IP Configuration.
network_security_group_id str
The ID of the network security group associated to the specified Network Interface.
private_ip_address str
The Private IP Address assigned to this Network Interface.
private_ip_addresses Sequence[str]
The list of private IP addresses associates to the specified Network Interface.
resource_group_name str
tags Mapping[str, str]
List the tags associated to the specified Network Interface.
virtual_machine_id str
The ID of the virtual machine that the specified Network Interface is attached to.
acceleratedNetworkingEnabled Boolean
Indicates if accelerated networking is set on the specified Network Interface.
appliedDnsServers List<String>
List of DNS servers applied to the specified Network Interface.
dnsServers List<String>
The list of DNS servers used by the specified Network Interface.
id String
The provider-assigned unique ID for this managed resource.
internalDnsNameLabel String
The internal DNS name label of the specified Network Interface.
ipConfigurations List<Property Map>
One or more ip_configuration blocks as defined below.
ipForwardingEnabled Boolean
Indicate if IP forwarding is set on the specified Network Interface.
location String
The location of the specified Network Interface.
macAddress String
The MAC address used by the specified Network Interface.
name String
The name of the IP Configuration.
networkSecurityGroupId String
The ID of the network security group associated to the specified Network Interface.
privateIpAddress String
The Private IP Address assigned to this Network Interface.
privateIpAddresses List<String>
The list of private IP addresses associates to the specified Network Interface.
resourceGroupName String
tags Map<String>
List the tags associated to the specified Network Interface.
virtualMachineId String
The ID of the virtual machine that the specified Network Interface is attached to.

Supporting Types

GetNetworkInterfaceIpConfiguration

ApplicationGatewayBackendAddressPoolsIds This property is required. List<string>
A list of Backend Address Pool IDs within a Application Gateway that this Network Interface is connected to.
ApplicationSecurityGroupIds This property is required. List<string>
GatewayLoadBalancerFrontendIpConfigurationId This property is required. string
The Frontend IP Configuration ID of a Gateway SKU Load Balancer the Network Interface is consuming.
LoadBalancerBackendAddressPoolsIds This property is required. List<string>
A list of Backend Address Pool IDs within a Load Balancer that this Network Interface is connected to.
LoadBalancerInboundNatRulesIds This property is required. List<string>
A list of Inbound NAT Rule IDs within a Load Balancer that this Network Interface is connected to.
Name This property is required. string
Specifies the name of the Network Interface.
Primary This property is required. bool
is this the Primary IP Configuration for this Network Interface?
PrivateIpAddress This property is required. string
The Private IP Address assigned to this Network Interface.
PrivateIpAddressAllocation This property is required. string
The IP Address allocation type for the Private address, such as Dynamic or Static.
PrivateIpAddressVersion This property is required. string
PublicIpAddressId This property is required. string
The ID of the Public IP Address which is connected to this Network Interface.
SubnetId This property is required. string
The ID of the Subnet which the Network Interface is connected to.
ApplicationGatewayBackendAddressPoolsIds This property is required. []string
A list of Backend Address Pool IDs within a Application Gateway that this Network Interface is connected to.
ApplicationSecurityGroupIds This property is required. []string
GatewayLoadBalancerFrontendIpConfigurationId This property is required. string
The Frontend IP Configuration ID of a Gateway SKU Load Balancer the Network Interface is consuming.
LoadBalancerBackendAddressPoolsIds This property is required. []string
A list of Backend Address Pool IDs within a Load Balancer that this Network Interface is connected to.
LoadBalancerInboundNatRulesIds This property is required. []string
A list of Inbound NAT Rule IDs within a Load Balancer that this Network Interface is connected to.
Name This property is required. string
Specifies the name of the Network Interface.
Primary This property is required. bool
is this the Primary IP Configuration for this Network Interface?
PrivateIpAddress This property is required. string
The Private IP Address assigned to this Network Interface.
PrivateIpAddressAllocation This property is required. string
The IP Address allocation type for the Private address, such as Dynamic or Static.
PrivateIpAddressVersion This property is required. string
PublicIpAddressId This property is required. string
The ID of the Public IP Address which is connected to this Network Interface.
SubnetId This property is required. string
The ID of the Subnet which the Network Interface is connected to.
applicationGatewayBackendAddressPoolsIds This property is required. List<String>
A list of Backend Address Pool IDs within a Application Gateway that this Network Interface is connected to.
applicationSecurityGroupIds This property is required. List<String>
gatewayLoadBalancerFrontendIpConfigurationId This property is required. String
The Frontend IP Configuration ID of a Gateway SKU Load Balancer the Network Interface is consuming.
loadBalancerBackendAddressPoolsIds This property is required. List<String>
A list of Backend Address Pool IDs within a Load Balancer that this Network Interface is connected to.
loadBalancerInboundNatRulesIds This property is required. List<String>
A list of Inbound NAT Rule IDs within a Load Balancer that this Network Interface is connected to.
name This property is required. String
Specifies the name of the Network Interface.
primary This property is required. Boolean
is this the Primary IP Configuration for this Network Interface?
privateIpAddress This property is required. String
The Private IP Address assigned to this Network Interface.
privateIpAddressAllocation This property is required. String
The IP Address allocation type for the Private address, such as Dynamic or Static.
privateIpAddressVersion This property is required. String
publicIpAddressId This property is required. String
The ID of the Public IP Address which is connected to this Network Interface.
subnetId This property is required. String
The ID of the Subnet which the Network Interface is connected to.
applicationGatewayBackendAddressPoolsIds This property is required. string[]
A list of Backend Address Pool IDs within a Application Gateway that this Network Interface is connected to.
applicationSecurityGroupIds This property is required. string[]
gatewayLoadBalancerFrontendIpConfigurationId This property is required. string
The Frontend IP Configuration ID of a Gateway SKU Load Balancer the Network Interface is consuming.
loadBalancerBackendAddressPoolsIds This property is required. string[]
A list of Backend Address Pool IDs within a Load Balancer that this Network Interface is connected to.
loadBalancerInboundNatRulesIds This property is required. string[]
A list of Inbound NAT Rule IDs within a Load Balancer that this Network Interface is connected to.
name This property is required. string
Specifies the name of the Network Interface.
primary This property is required. boolean
is this the Primary IP Configuration for this Network Interface?
privateIpAddress This property is required. string
The Private IP Address assigned to this Network Interface.
privateIpAddressAllocation This property is required. string
The IP Address allocation type for the Private address, such as Dynamic or Static.
privateIpAddressVersion This property is required. string
publicIpAddressId This property is required. string
The ID of the Public IP Address which is connected to this Network Interface.
subnetId This property is required. string
The ID of the Subnet which the Network Interface is connected to.
application_gateway_backend_address_pools_ids This property is required. Sequence[str]
A list of Backend Address Pool IDs within a Application Gateway that this Network Interface is connected to.
application_security_group_ids This property is required. Sequence[str]
gateway_load_balancer_frontend_ip_configuration_id This property is required. str
The Frontend IP Configuration ID of a Gateway SKU Load Balancer the Network Interface is consuming.
load_balancer_backend_address_pools_ids This property is required. Sequence[str]
A list of Backend Address Pool IDs within a Load Balancer that this Network Interface is connected to.
load_balancer_inbound_nat_rules_ids This property is required. Sequence[str]
A list of Inbound NAT Rule IDs within a Load Balancer that this Network Interface is connected to.
name This property is required. str
Specifies the name of the Network Interface.
primary This property is required. bool
is this the Primary IP Configuration for this Network Interface?
private_ip_address This property is required. str
The Private IP Address assigned to this Network Interface.
private_ip_address_allocation This property is required. str
The IP Address allocation type for the Private address, such as Dynamic or Static.
private_ip_address_version This property is required. str
public_ip_address_id This property is required. str
The ID of the Public IP Address which is connected to this Network Interface.
subnet_id This property is required. str
The ID of the Subnet which the Network Interface is connected to.
applicationGatewayBackendAddressPoolsIds This property is required. List<String>
A list of Backend Address Pool IDs within a Application Gateway that this Network Interface is connected to.
applicationSecurityGroupIds This property is required. List<String>
gatewayLoadBalancerFrontendIpConfigurationId This property is required. String
The Frontend IP Configuration ID of a Gateway SKU Load Balancer the Network Interface is consuming.
loadBalancerBackendAddressPoolsIds This property is required. List<String>
A list of Backend Address Pool IDs within a Load Balancer that this Network Interface is connected to.
loadBalancerInboundNatRulesIds This property is required. List<String>
A list of Inbound NAT Rule IDs within a Load Balancer that this Network Interface is connected to.
name This property is required. String
Specifies the name of the Network Interface.
primary This property is required. Boolean
is this the Primary IP Configuration for this Network Interface?
privateIpAddress This property is required. String
The Private IP Address assigned to this Network Interface.
privateIpAddressAllocation This property is required. String
The IP Address allocation type for the Private address, such as Dynamic or Static.
privateIpAddressVersion This property is required. String
publicIpAddressId This property is required. String
The ID of the Public IP Address which is connected to this Network Interface.
subnetId This property is required. String
The ID of the Subnet which the Network Interface is connected to.

Package Details

Repository
Azure Classic pulumi/pulumi-azure
License
Apache-2.0
Notes
This Pulumi package is based on the azurerm Terraform Provider.

We recommend using Azure Native.

Azure v6.21.0 published on Friday, Mar 7, 2025 by Pulumi