Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
- Deploy an Azure Nexus virtual machine using Bicep
This quick-start guide is designed to help you get started with using Nexus virtual machines to host virtual network functions (VNFs). By following the steps outlined in this guide, you're able to quickly and easily create a customized Nexus virtual machine that meets your specific needs and requirements. Whether you're a beginner or an expert in Nexus networking, this guide is here to help. You learn everything you need to know to create and customize Nexus virtual machines for hosting virtual network functions.
Before you begin
If you don't have an Azure account, create a free account before you begin.
Use the Bash environment in Azure Cloud Shell. For more information, see Get started with Azure Cloud Shell.
If you prefer to run CLI reference commands locally, install the Azure CLI. If you're running on Windows or macOS, consider running Azure CLI in a Docker container. For more information, see How to run the Azure CLI in a Docker container.
If you're using a local installation, sign in to the Azure CLI by using the az login command. To finish the authentication process, follow the steps displayed in your terminal. For other sign-in options, see Authenticate to Azure using Azure CLI.
When you're prompted, install the Azure CLI extension on first use. For more information about extensions, see Use and manage extensions with the Azure CLI.
Run az version to find the version and dependent libraries that are installed. To upgrade to the latest version, run az upgrade.
Install the latest version of the necessary Azure CLI extensions.
If you have multiple Azure subscriptions, select the appropriate subscription ID in which the resources should be billed using the
az accountcommand.Before proceeding with virtual machine creation, ensure that the container image to be used is created according to the instructions.
Create a resource group using the
az group createcommand. An Azure resource group is a logical group in which Azure resources are deployed and managed. When you create a resource group, you're prompted to specify a location. This location is the storage location of your resource group metadata and where your resources run in Azure if you don't specify another region during resource creation. The following example creates a resource group named myResourceGroup in the eastus location.az group create --name myResourceGroup --location eastusThe following output example resembles successful creation of the resource group:
{ "id": "/subscriptions/<guid>/resourceGroups/myResourceGroup", "location": "eastus", "managedBy": null, "name": "myResourceGroup", "properties": { "provisioningState": "Succeeded" }, "tags": null }To deploy a Bicep file or ARM template, you need write access on the resources you're deploying and access to all operations on the Microsoft.Resources/deployments resource type. For example, to deploy a cluster, you need Microsoft.NetworkCloud/virtualMachines/write and Microsoft.Resources/deployments/* permissions. For a list of roles and permissions, see Azure built-in roles.
You need the
custom locationresource ID of your Azure Operator Nexus cluster.You need to create various networks according to your specific workload requirements, and it's essential to have the appropriate IP addresses available for your workloads. To ensure a smooth implementation, it's advisable to consult the relevant support teams for assistance.
- Complete the prerequisites for deploying a Nexus virtual machine.
Review the template
Before deploying the virtual machine template, let's review the content to understand its structure.
@description('The name of Nexus virtual machine')
param vmName string
@description('The Azure region where the VM is to be deployed')
param location string = resourceGroup().location
@description('The custom location of the Nexus instance')
param extendedLocation string
@description('The metadata tags to be associated with the cluster resource')
param tags object = {}
@description('The name of the administrator to which the ssh public keys will be added into the authorized keys.')
@minLength(1)
@maxLength(32)
param adminUsername string = 'azureuser'
@description('Selects the boot method for the virtual machine.')
@allowed([
'UEFI'
'BIOS'
])
param bootMethod string = 'UEFI'
@description('The Cloud Services Network attachment ARM ID to attach to virtual machine.')
param cloudServicesNetworkId string
@description('Number of CPU cores for the virtual machine. Choose a value between 2 and 46.')
param cpuCores int = 2
@description('The memory size of the virtual machine in GiB (max 224 GiB)')
param memorySizeGB int = 4
@description('The list of network attachments to the virtual machine.')
param networkAttachments array
// {
// attachedNetworkId: "string"
// defaultGateway: "True"/"False"
// ipAllocationMethod: "Dynamic"/"Static","Disabled"
// ipv4Address: "string"
// ipv6Address: "string"
// networkAttachmentName: "string"
// }
@description('The Base64 encoded cloud-init network data.')
param networkData string = ''
@description('The placement hints for the virtual machine.')
param placementHints array = []
// {
// hintType: "Affinity/AntiAffinity"
// resourceId: string
// schedulingExecution: "Hard/Soft"
// scope: "Rack/Machine"
// }
@description('The list of SSH public keys for the virtual machine.')
param sshPublicKeys array
// {
// keyData: 'string'
// }
@description('StorageProfile represents information about a disk.')
param storageProfile object = {
osDisk: {
createOption: 'Ephemeral'
deleteOption: 'Delete'
diskSizeGB: 64
}
}
@description('The Base64 encoded cloud-init user data.')
param userData string = ''
@description('The type of the device model to use.')
@allowed([
'T1'
'T2'
])
param vmDeviceModel string = 'T2'
@description('The virtual machine image that is currently provisioned to the OS disk, using the full URL and tag notation used to pull the image.')
param vmImage string
@description('Credentials used to login to the image repository.')
param vmImageRepositoryCredentials object = {}
// password: "string"
// registryUrl: "string"
// username: "string"
resource vm 'Microsoft.NetworkCloud/virtualMachines@2025-09-01' = {
name: vmName
location: location
extendedLocation: {
type: 'CustomLocation'
name: extendedLocation
}
tags: tags
properties: {
adminUsername: (empty(adminUsername) ? null : adminUsername)
bootMethod: (empty(bootMethod) ? null : bootMethod)
cloudServicesNetworkAttachment: {
attachedNetworkId: cloudServicesNetworkId
ipAllocationMethod: 'Dynamic'
}
cpuCores: cpuCores
memorySizeGB: memorySizeGB
networkData: (empty(networkData) ? null : networkData)
networkAttachments: (empty(networkAttachments) ? null : networkAttachments)
placementHints: (empty(placementHints) ? null : placementHints)
sshPublicKeys: (empty(sshPublicKeys) ? null : sshPublicKeys)
storageProfile: (empty(storageProfile) ? null : storageProfile)
userData: (empty(userData) ? null : userData)
vmDeviceModel: (empty(vmDeviceModel) ? null : vmDeviceModel)
vmImage: (empty(vmImage) ? null : vmImage)
vmImageRepositoryCredentials: (empty(vmImageRepositoryCredentials) ? null : vmImageRepositoryCredentials)
}
}
Warning
User data isn't encrypted, and any process on the VM can query this data. You shouldn't store confidential information in user data. For more information, see Azure data security and encryption best practices.
Review and save the template file named virtual-machine-bicep-file.bicep, then proceed to the next section and deploy the template.
Virtual machines with managed identities
Create the virtual machine with either a system-assigned or a user-assigned managed identity.
To add a managed identity to the VM, the API version must be 2025-07-01-preview or later.
The apiVersion can be populated with 2025-07-01-preview, 2025-09-01 or any future version of the API.
Important
If you don't specify a managed identity when creating the VM, you can't enable managed identity support by updating the VM after provisioning.
Make sure to update the resource version for the virtual machine resource in the virtual-machine-bicep-file.bicep file.
Add the identity section with type set to SystemAssigned to the Bicep file:
resource vm 'Microsoft.NetworkCloud/virtualMachines@2025-09-01' = {
name: vmName
...
properties: {
...
identity: {
type: "SystemAssigned"
}
}
}
For User-assigned managed identity, the resource must be created before it can be assigned to the virtual machine.
Update the Bicep file with the identity section with type set to UserAssigned, and include the userAssignedIdentities property with the resource ID of the user-assigned managed identity.
resource vm 'Microsoft.NetworkCloud/virtualMachines@2025-09-01' = {
name: vmName
...
properties: {
...
identity: {
type: "UserAssigned",
userAssignedIdentities: {
"/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identity-name}": {}
}
}
}
}
Deploy the template
- Create a file named
virtual-machine-parameters.jsonand add the required parameters in JSON format. You can use the following example as a starting point. Replace the values with your own.
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"vmName": {
"value": "myNexusVirtualMachine"
},
"location": {
"value": "eastus"
},
"extendedLocation": {
"value": "/subscriptions/<subscription>/resourcegroups/<cluster-managed-resource-group>/providers/microsoft.extendedlocation/customlocations/<custom-location-name>"
},
"cloudServicesNetworkId": {
"value": "/subscriptions/<subscription>/resourceGroups/<network-resource-group>/providers/Microsoft.NetworkCloud/cloudServicesNetworks/<csn-name>"
},
"networkAttachments": {
"value": [
{
"attachedNetworkId": "/subscriptions/<subscription>/resourceGroups/<network-resource-group>/providers/Microsoft.NetworkCloud/l3Networks/<l3network-name>",
"ipAllocationMethod": "Dynamic",
"defaultGateway": "True",
"networkAttachmentName": "mgmt0"
}
]
},
"sshPublicKeys": {
"value": [
{
"keyData": "ssh-rsa AAAAB3...."
}
]
},
"vmImage": {
"value": "<Image ACR URL>"
},
"vmImageRepositoryCredentials": {
"value": {
"password": "********************",
"registryUrl": "<ACR registry URL>",
"username": "<ACR user name>"
}
}
}
}
- Deploy the template.
az deployment group create \
--resource-group myResourceGroup
--template-file virtual-machine-bicep-file.bicep
--parameters @virtual-machine-parameters.json
Review deployed resources
az deployment group show --resource-group myResourceGroup --name <deployment-name>
After the deployment finishes, you can view the resources using the CLI or the Azure portal.
To view the details of the myNexusVirtualMachine cluster in the myResourceGroup resource group, execute the following
az networkcloud virtualmachine show --name myNexusVirtualMachine --resource-group myResourceGroup
Clean up resources
When no longer needed, delete the resource group. The resource group and all the resources in the resource group are deleted.
Use the az group delete command to remove the resource group, virtual machine, and all related resources except the Operator Nexus network resources.
az group delete --name myResourceGroup --yes --no-wait
Next steps
The Nexus virtual machine is successfully created! You can now use the virtual machine to host virtual network functions (VNFs).