Quickstart: Publish Ubuntu Virtual Machine (VM) as Virtual Network Function (VNF)
This quickstart describes how to use the az aosm
Azure CLI extension to create and publish a basic Network Function Definition. Its purpose it to demonstrate the workflow of the Publisher Azure Operator Service Manager (AOSM) resources. The basic concepts presented here are meant to prepare users to build more exciting services.
Prerequisites
An Azure account with an active subscription is required. If you don't have an Azure subscription, follow the instructions here Start free to create an account before you begin.
The Contributor role over this subscription in order to create a Resource Group, or an existing Resource Group where you have the Contributor role.
It's also assumed that you followed the prerequisites in Quickstart: Complete the prerequisites to deploy a Virtualized Network Function in Azure Operator Service Manager
Create input file
Execute the following command to generate the input configuration file for the Network Function Definition (NFD).
az aosm nfd generate-config --definition-type vnf
Once you execute this command, an input.json file generates.
Note
Edit the input.json file, replacing it with the values shown in the sample. Save the file as input-vnf-nfd.json.
Here's sample input-vnf-nfd.json file:
{
"publisher_name": "ubuntu-publisher",
"publisher_resource_group_name": "ubuntu-publisher-rg",
"nf_name": "ubuntu-vm",
"version": "1.0.0",
"acr_artifact_store_name": "ubuntu-acr",
"location": "uksouth",
"blob_artifact_store_name": "ubuntu-blob-store",
"image_name_parameter": "imageName",
"arm_template": {
"file_path": "ubuntu-template.json",
"version": "1.0.0"
},
"vhd": {
"file_path": "livecd.ubuntu-cpc.azure.vhd",
"version": "1-0-0",
"image_disk_size_GB": 30,
"image_hyper_v_generation": "V1",
"image_api_version": "2023-03-01"
}
}
Variable | Description |
---|---|
publisher_name | Name of the Publisher resource you want your definition published to. Created if it doesn't exist. |
publisher_resource_group_name | Resource group for the Publisher resource. Created if it doesn't exist. |
acr_artifact_store_name | Name of the ACR Artifact Store resource. Created if it doesn't exist. |
location | Azure location to use when creating resources. |
nf_name | Name of NF definition. |
version | Version of the NF definition in A.B.C format. |
blob_artifact_store_name | Name of the storage account Artifact Store resource. Created if it doesn't exist. |
image_name_parameter | The parameter name in the VM ARM template that specifies the name of the image to use for the VM. |
arm_template | artifact_name: Name of the artifact. |
file_path: Optional. File path of the artifact you wish to upload from your local disk. Delete if not required. Relative paths are relative to the configuration file. On Windows escape any backslash with another backslash. | |
version: Version of the artifact. For ARM templates version must be in format A.B.C. | |
vhd | artifact_name: Name of the artifact. |
file_path: Optional. File path of the artifact you wish to upload from your local disk. Delete if not required. Relative paths are relative to the configuration file. On Windows escape any backslash with another backslash. | |
blob_sas_url: Optional. SAS URL of the blob artifact you wish to copy to your Artifact Store. Delete if not required. | |
version: Version of the artifact. Version of the artifact. For VHDs version must be in format A-B-C. | |
"image_disk_size_GB: Optional. Specifies the size of empty data disks in gigabytes. This value cannot be larger than 1023 GB. Delete if not required. | |
image_hyper_v_generation: Optional. Specifies the HyperVGenerationType of the VirtualMachine created from the image. Valid values are V1 and V2. V1 is the default if not specified. Delete if not required. | |
image_api_version: Optional. The ARM API version used to create the Microsoft.Compute/images resource. Delete if not required. |
Note
When utilizing the file_path option, it's essential to have a reliable internet connection with sufficient bandwidth, as the upload duration may vary depending on the file size.
Important
Each variable described in the previous table must be unique. For instance, the resource group name cannot already exist, and publisher and artifact store names must be unique in the region.
Build the Network Function Definition (NFD)
To construct the Network Function Definition (NFD), initiate the build process.
az aosm nfd build -f input-vnf-nfd.json --definition-type vnf
Once the build is complete, examine the generated files to better understand the Network Function Definition (NFD) structure.
These files are created in a subdirectory called nfd-bicep-ubuntu-template:
File | Description |
---|---|
configMappings | Directory containing files that map the deployment parameters for the Network Function Definition Version (NFDV) to the parameters required for the Virtual Machine (VM) ARM template. |
schemas | Directory containing files that define the deployment parameters required to create a Network Function (NF) from this Network Function Definition Version (NFDV). |
vnfartifactmanifests.bicep | Bicep template for creating the artifact manifests. |
Vnfdefinition.bicep | Bicep template for creating the Network Function Definition Version (NFDV) itself. |
Note
If errors were made, the only option to correct is to re-run the command with the proper selections.
Publish the Network Function Definition and upload artifacts
Execute the following command to publish the Network Function Definition (NFD) and upload the associated artifacts:
az aosm nfd publish -f input-vnf-nfd.json --definition-type vnf
When the command completes, inspect the resources within your Publisher Resource Group to observe the created components and artifacts.
These resources are created:
Resource Name | Resource Type |
---|---|
ubuntu-vm-nfdg | Network Function Definition. |
1.0.0 | Network Function Definition Version. |
ubuntu-publisher | Publisher. |
ubuntu-vm-acr-manifest-1-0-0 | Publisher Artifact Manifest. |
ubuntu-vm-sa-manifest-1-0-0 | Publisher Artifact Manifest. |
ubuntu-acr | Publisher Artifact Store. |
ubuntu-blob-store | Publisher Artifact Store. |
Note
The creation of the artifact stores takes about 10 minutes. If the resource already exists, the process is considerably faster.
Next steps
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for