Applies to: Azure Stack HCI, versions 22H2 and 21H2
This article describes how to create or add virtual network for your Azure Stack HCI cluster.
Important
This feature is currently in PREVIEW.
See the Supplemental Terms of Use for Microsoft Azure Previews for legal terms that apply to Azure features that are in beta, preview, or otherwise not yet released into general availability.
Create virtual networks for custom location
You can create or add virtual networks using Windows Admin Center or PowerShell for the custom location associated with the Azure Stack HCI cluster.
Access Azure Arc VM setup for Azure Stack HCI under cluster Settings again. On this page, project the vmswitch name that is used for network interfaces during VM provisioning. Also project the OS gallery images that are used for creating VMs through Azure Arc.
Make sure you have an external VM switch deployed on all hosts of the Azure Stack HCI cluster. Run the following command to get the name of the VM switch and provide this name to $vswitchName in the subsequent step.
Get-VmSwitch -SwitchType External
Create a virtual network on the VM switch that is deployed on all hosts of your cluster. Run the following commands:
$vlanID=<vLAN identifier for Arc VMs. A 0 value means there is no vLan ID.>
$vnetName=<user provided name of virtual network>
New-MocGroup -name "Default_Group" -location "MocLocation"
New-MocVirtualNetwork -name "$vnetName" -group "Default_Group" -tags @{'VSwitch-Name' = "$vswitchName"} -vlanID $vlanID
az azurestackhci virtualnetwork create --subscription $subscription --resource-group $resource_group --extended-location name="/subscriptions/$subscription/resourceGroups/$resource_group/providers/Microsoft.ExtendedLocation/customLocations/$customloc_name" type="CustomLocation" --location $Location --network-type "Transparent" --name $vnetName --vlan $vlanID