Create a network interface card
In this guide, we'll walk through the steps to create a Network Interface Card template.
This resources is used by several other resources like Virtual Machines and Virtual Machine Scale Sets.
We'll create the template file to be reused in future deployments.
info
If we create a template per resource type, we can reuse the template for all deployments of that resource type.
Any changes to the template will result in an updated version on all deployments.
Create a bicep deploy file
Create new bicep file: networkinterface.bicep.
targetScope = 'resourceGroup'
param location string
param nicName string
param subnetID string
param acceleratedNetworking bool = false
param privateIPAddress string = ''
param dnsServers array = []
var enableAcceleratedNetworking = acceleratedNetworking
var varIpConfigName = 'ipconfig'
resource resNetworkInterfaces 'Microsoft.Network/networkInterfaces@2022-07-01' = {
name: nicName
location: location
properties: {
ipConfigurations: [
{
name: varIpConfigName
properties: {
privateIPAddress: (!empty(privateIPAddress) ? privateIPAddress : null)
privateIPAddressVersion: 'IPv4'
privateIPAllocationMethod: (!empty(privateIPAddress) ? 'Static' : 'Dynamic')
subnet: {
id: subnetID
}
}
}
]
dnsSettings: {
dnsServers: dnsServers
}
enableAcceleratedNetworking: enableAcceleratedNetworking
}
}
tip
PLEASE NOTE! Do not deploy this template yet.
Version overview
This document has the following versions:
Version | Date | Overview of changes |
---|---|---|
1.1 | 2024-03021 | Add comments from test |
1.0 | 2024-03-14 | Initial version. |