Network Interface

Overview

The networkInterface builder allows you to create network interfaces (NIC) so that Azure virtual machine (VM) can communicate with internet, Azure, and on-premises resources. To learn more about routeServer, reference to Azure Docs

  • NetworkInterface (Microsoft.Network/networkInterfaces)

Builder Keywords

Applies ToKeywordPurpose
networkInterfacenameName of the network interface resource
networkInterfacelink_to_subnetLink to existing subnet. If not provided, need to specify the subnet name and prefix for a new subnet
networkInterfacesubnet_nameSets the name of the vnet subnet for network interface
networkInterfacesubnet_prefixSets the prefix of the vnet subnet for network interface
networkInterfacelink_to_vnetLink to existing vnet or to vnet managed by Farmer
networkInterfaceadd_static_ipUse static ip for the network interface. If not provided, ip will be dynamically allocated
networkInterfaceaccelerated_networking_flagThe accelerated networking flag for the network interface. Default is false
networkInterfaceip_forwarding_flagThe ip forwarding flag for the network interface. Default is false

Example

#r "nuget:Farmer"
open Farmer
open Farmer.Builders
open Farmer.Builders.NetworkInterface

arm {
    location Location.EastUS

    add_resources
        [
            vnet {
                name "test-vnet"
                add_address_spaces [ "10.0.0.0/16" ]
            }
            networkInterface {
                name "my-network-interface"
                subnet_name "my-subnet"
                subnet_prefix "10.0.100.0/24"
                link_to_vnet (virtualNetworks.resourceId "test-vnet")
                add_static_ip "10.0.100.10"
                accelerated_networking_flag false
                ip_forwarding_flag false
            }
        ]
}

Example using existing vnet and subnet with dynamic ip allocation

#r "nuget:Farmer"
open Farmer
open Farmer.Builders
open Farmer.Builders.NetworkInterface

arm {
    location Location.EastUS

    add_resources
        [
            networkInterface {
                name "my-network-interface"
                link_to_subnet "test-subnet"
                link_to_vnet "test-vnet"
            }
        ]
}