Skip to content

Commit ec84835

Browse files
authored
Merge pull request #251745 from rashirg/ps-virtualmachine
[NetworkCloud]Powershell example update for Nexus Virtual Machine GA API version 2023-07-01
2 parents 8dd8b5b + 7054cee commit ec84835

9 files changed

+361
-24
lines changed

articles/operator-nexus/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
items:
4040
- name: Use the Azure CLI
4141
href: quickstarts-tenant-workload-deployment.md
42+
- name: Use Azure PowerShell
43+
href: quickstarts-tenant-workload-deployment-ps.md
4244
- name: How-To Guides
4345
items:
4446
- name: Operator Nexus Instance Deployment and Upgrade
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
author: rashrig
3+
ms.author: rajeshwarig
4+
ms.date: 09/19/2023
5+
ms.topic: include
6+
ms.service: azure-operator-nexus
7+
---
8+
9+
When no longer needed, delete the resource group. The resource group and all the resources in the resource group are deleted.
10+
11+
### [Azure CLI](#tab/azure-cli)
12+
13+
Use the [az group delete][az-group-delete] command to remove the resource group, virtual machine, and all related resources except the Operator Nexus network resources.
14+
15+
```azurecli-interactive
16+
az group delete --name myResourceGroup --yes --no-wait
17+
```
18+
19+
---
20+
21+
<!-- LINKS - internal -->
22+
[az-group-delete]: /cli/azure/group#az_group_delete
Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
11
---
2-
author: dramasamy
3-
ms.author: dramasamy
4-
ms.date: 07/09/2023
2+
author: rashirg
3+
ms.author: rajeshwarig
4+
ms.date: 09/19/2023
55
ms.topic: include
66
ms.service: azure-operator-nexus
77
---
88

99
When no longer needed, delete the resource group. The resource group and all the resources in the resource group are deleted.
1010

11-
### [Azure CLI](#tab/azure-cli)
12-
13-
Use the [az group delete][az-group-delete] command to remove the resource group, virtual machine, and all related resources except the Operator Nexus network resources.
14-
15-
```azurecli-interactive
16-
az group delete --name myResourceGroup --yes --no-wait
17-
```
18-
1911
### [Azure PowerShell](#tab/azure-powershell)
2012

2113
Use the [Remove-AzResourceGroup][remove-azresourcegroup] cmdlet to remove the resource group, virtual machine, and all related resources except the Operator Nexus network resources.
@@ -27,4 +19,3 @@ Remove-AzResourceGroup -Name myResourceGroup
2719

2820
<!-- LINKS - internal -->
2921
[remove-azresourcegroup]: /powershell/module/az.resources/remove-azresourcegroup
30-
[az-group-delete]: /cli/azure/group#az_group_delete
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
author: rashirg
3+
ms.author: rajeshwarig
4+
ms.date: 09/19/2023
5+
ms.topic: include
6+
ms.service: azure-operator-nexus
7+
ms.custom: devx-track-azurepowershell
8+
---
9+
10+
[!INCLUDE [quickstarts-free-trial-note](../../../../includes/quickstarts-free-trial-note.md)]
11+
12+
* Use the PowerShell environment in [Azure Cloud Shell](../../../cloud-shell/overview.md). For more information, see [Quickstart for PowerShell in Azure Cloud Shell.](../../../cloud-shell/quickstart.md)
13+
14+
[:::image type="icon" source="~/articles/reusable-content/azure-cli/media/hdi-launch-cloud-shell.png" alt-text="Launch Azure Cloud Shell" :::](https://shell.azure.com)
15+
16+
* If you are running PowerShell locally, install the Az PowerShell module and connect to your Azure account using the [Connect-AzAccount](/powershell/module/az.accounts/Connect-AzAccount) cmdlet. For more information about installing the Az PowerShell module, see [Install Azure PowerShell][install-azure-powershell].
17+
18+
* If you have multiple Azure subscriptions, select the appropriate subscription ID in which the resources should be billed using the
19+
[Set-AzContext](/powershell/module/az.accounts/set-azcontext) cmdlet.
20+
21+
* Before proceeding with virtual machine creation, ensure that the container image to be used is created according to the [instructions](../../howto-virtual-machine-image.md).
22+
23+
* Create a resource group using the [New-AzResourceGroup][new-azresourcegroup] cmdlet. An [Azure resource group][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.
24+
25+
```azurepowershell-interactive
26+
New-AzResourceGroup -Name myResourceGroup -Location eastus
27+
```
28+
29+
The following output example resembles successful creation of the resource group:
30+
31+
```plaintext
32+
ResourceGroupName : myResourceGroup
33+
Location : eastus
34+
ProvisioningState : Succeeded
35+
Tags :
36+
ResourceId : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup
37+
```
38+
39+
* You need the `custom location` resource ID of your Azure Operator Nexus cluster.
40+
* You need to create [various networks](../../quickstarts-tenant-workload-prerequisites.md#create-networks-for-tenant-workloads) 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.
41+
42+
43+
<!-- LINKS - internal -->
44+
[install-azure-powershell]: /powershell/azure/install-az-ps
45+
[new-azresourcegroup]: /powershell/module/az.resources/new-azresourcegroup
46+
[kubernetes-concepts]: ../../../aks/concepts-clusters-workloads.md
47+
[azure-resource-group]: ../../../azure-resource-manager/management/overview.md

articles/operator-nexus/includes/virtual-machine/quickstart-review-deployment-cli.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
---
2-
author: dramasamy
3-
ms.author: dramasamy
4-
ms.date: 07/09/2023
2+
author: rashirg
3+
ms.author: rajeshwarig
4+
ms.date: 09/19/2023
55
ms.topic: include
66
ms.service: azure-operator-nexus
77
---
88

99
After the deployment finishes, you can view the resources using the CLI or the Azure portal.
1010

11-
To view the details of the ```myNexusVirtualMachine``` cluster in the ```myResourceGroup``` resource group, execute the following Azure CLI command:
11+
To view the details of the ```myNexusVirtualMachine``` cluster in the ```myResourceGroup``` resource group, execute the following
1212

13-
```azurecli
13+
### [Azure CLI](#tab/azure-cli)
14+
15+
```azurecli-interactive
1416
az networkcloud virtualmachine show \
1517
--name myNexusVirtualMachine \
1618
--resource-group myResourceGroup
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
author: rashirg
3+
ms.author: rajeshwarig
4+
ms.date: 09/15/2023
5+
ms.topic: include
6+
ms.service: azure-operator-nexus
7+
---
8+
9+
After the deployment finishes, you can view the resources using PowerShell or the Azure portal.
10+
11+
To view the details of the ```myNexusVirtualMachine``` cluster in the ```myResourceGroup``` resource group, execute the following
12+
13+
### [Azure PowerShell](#tab/azure-powershell)
14+
15+
```azurepowershell-interactive
16+
Get-AzNetworkCloudVirtualMachine -Name myNexusVirtualMachine `
17+
-ResourceGroupName myResourceGroup -SubscriptionId mySubscription
18+
```
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
---
2+
title: Create an Azure Operator Nexus virtual machine by using Azure PowerShell
3+
description: Learn how to create an Azure Operator Nexus virtual machine (VM) for virtual network function (VNF) workloads using PowerShell
4+
author: rashirg
5+
ms.author: rajeshwarig
6+
ms.service: azure-operator-nexus
7+
ms.topic: how-to
8+
ms.date: 09/20/2023
9+
ms.custom: template-how-to-pattern, devx-track-azurepowershell
10+
---
11+
12+
# Quickstart: Create an Azure Operator Nexus virtual machine by using Azure PowerShell
13+
14+
* Deploy an Azure Nexus virtual machine using Azure PowerShell
15+
16+
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.
17+
18+
## Before you begin
19+
20+
[!INCLUDE [virtual-machine-prereq](./includes/virtual-machine/quickstart-prereq-ps.md)]
21+
* Complete the [prerequisites](./quickstarts-tenant-workload-prerequisites.md) for deploying a Nexus virtual machine.
22+
23+
## Create a Nexus virtual machine
24+
25+
The following example creates a virtual machine named *myNexusVirtualMachine* in resource group *myResourceGroup* in the *eastus* location.
26+
27+
Before you run the commands, you need to set several variables to define the configuration for your virtual machine. Here are the variables you need to set, along with some default values you can use for certain variables:
28+
29+
| Variable | Description |
30+
| -------------------------- | ------------------------------------------------------------------------------------------------------|
31+
| LOCATION | The Azure region where you want to create your virtual machine. |
32+
| RESOURCE_GROUP | The name of the Azure resource group where you want to create the virtual machine. |
33+
| SUBSCRIPTION | The ID of your Azure subscription. |
34+
| CUSTOM_LOCATION | This argument specifies a custom location of the Nexus instance. |
35+
| CSN_ARM_ID | CSN ID is the unique identifier for the cloud services network you want to use. |
36+
| L3_NETWORK_ID | L3 Network ID is the unique identifier for the network interface to be used by the virtual machine. |
37+
| NETWORK_INTERFACE_NAME | The name of the L3 network interface for the virtual machine. |
38+
| ADMIN_USERNAME | The username for the virtual machine administrator. |
39+
| SSH_PUBLIC_KEY | The SSH public key that is used for secure communication with the virtual machine. |
40+
| CPU_CORES | The number of CPU cores for the virtual machine (even number, max 44 vCPUs) |
41+
| MEMORY_SIZE | The amount of memory (in GB, max 224 GB) for the virtual machine. |
42+
| VM_DISK_SIZE | The size (in GB) of the virtual machine disk. |
43+
| VM_IMAGE | The URL of the virtual machine image. |
44+
| ACR_URL | The URL of the Azure Container Registry. |
45+
| ACR_USERNAME | The username for the Azure Container Registry. |
46+
| ACR_PASSWORD | The password for the Azure Container Registry. |
47+
| VMDEVICEMODEL | The VMDeviceModel defaults to T2, available options T2(Modern) and T1(Transitional). |
48+
| USERDATA | The base64 encoded string of cloud-init userdata. |
49+
| BOOTMETHOD | The Method used to boot the virutalmachine UEFI or BIOS. |
50+
| OS_DISK_CREATE_OPTION | The OS disk create specifies ephemeral disk option. |
51+
| OS_DISK_DELETE_OPTION | The OS disk delete specifies delete disk option. |
52+
| IP_AllOCATION_METHOD | The IpAllocationMethod valid for L3Networks specify Dynamic or Static or Disabled. |
53+
| NETWORKATTACHMENTNAME | The name of the Network to attach for workload. |
54+
| NETWORKDATA | The base64 encoded string of cloud-init network data. |
55+
56+
Once you've defined these variables, you can run the Azure PowerShell command to create the virtual machine. Add the ```-Debug``` flag at the end to provide more detailed output for troubleshooting purposes.
57+
58+
To define these variables, use the following set commands and replace the example values with your preferred values. You can also use the default values for some of the variables, as shown in the following example:
59+
60+
```azurepowershell-interactive
61+
# Azure parameters
62+
$RESOURCE_GROUP="myResourceGroup"
63+
$SUBSCRIPTION="<Azure subscription ID>"
64+
$CUSTOM_LOCATION="/subscriptions/<subscription_id>/resourceGroups/<managed_resource_group>/providers/microsoft.extendedlocation/customlocations/<custom-location-name>"
65+
$CUSTOM_LOCATION_TYPE="CustomLocation"
66+
$LOCATION="<ClusterAzureRegion>"
67+
68+
# VM parameters
69+
$VM_NAME="myNexusVirtualMachine"
70+
$BOOT_METHOD="UEFI"
71+
$OS_DISK_CREATE_OPTION="Ephemeral"
72+
$OS_DISK_DELETE_OPTION="Delete"
73+
$NETWORKDATA="bmV0d29ya0RhdGVTYW1wbGU="
74+
$VMDEVICEMODEL="T2"
75+
$USERDATA=""
76+
77+
# VM credentials
78+
$ADMIN_USERNAME="admin"
79+
$SSH_PUBLIC_KEY = @{
80+
KeyData = "$(cat ~/.ssh/id_rsa.pub)"
81+
}
82+
83+
# Network parameters
84+
$CSN_ARM_ID="/subscriptions/<subscription_id>/resourceGroups/<resource_group>/providers/Microsoft.NetworkCloud/cloudServicesNetworks/<csn-name>"
85+
$L3_NETWORK_ID="/subscriptions/<subscription_id>/resourceGroups/<resource_group>/providers/Microsoft.NetworkCloud/l3Networks/<l3Network-name>"
86+
$IP_AllOCATION_METHOD="Dynamic"
87+
$CSN_ATTACHMENT_DEFAULTGATEWAY="False"
88+
$CSN_ATTACHMENT_NAME="<l3Network-name>"
89+
$ISOLATE_EMULATOR_THREAD="True"
90+
$VIRTIOINTERFACE="Modern"
91+
$NETWORKATTACHMENTNAME="mgmt0"
92+
93+
# VM Size parameters
94+
$CPU_CORES=4
95+
$MEMORY_SIZE=12
96+
$VM_DISK_SIZE="64"
97+
98+
# Virtual Machine Image parameters
99+
$VM_IMAGE="<VM image, example: myacr.azurecr.io/ubuntu:20.04>"
100+
$ACR_URL="<Azure container registry URL, example: myacr.azurecr.io>"
101+
$ACR_USERNAME="<Azure container registry username>"
102+
103+
$NETWORKATTACHMENT = New-AzNetworkCloudNetworkAttachmentObject `
104+
-AttachedNetworkId $L3_NETWORK_ID `
105+
-IpAllocationMethod $IP_AllOCATION_METHOD `
106+
-DefaultGateway "True" `
107+
-Name $NETWORKATTACHMENTNAME
108+
109+
$SECUREPASSWORD = ConvertTo-SecureString "<YourPassword>" -asplaintext -force
110+
```
111+
112+
> [!IMPORTANT]
113+
> It is essential that you replace the placeholders for CUSTOM_LOCATION, CSN_ARM_ID, L3_NETWORK_ID and ACR parameters with your actual values before running these commands.
114+
115+
After defining these variables, you can create the virtual machine by executing the following Azure PowerShell command.
116+
117+
```azurepowershell-interactive
118+
New-AzNetworkCloudVirtualMachine -Name $VM_NAME `
119+
-ResourceGroupName $RESOURCE_GROUP `
120+
-AdminUsername $ADMIN_USERNAME `
121+
-CloudServiceNetworkAttachmentAttachedNetworkId $CSN_ARM_ID `
122+
-CloudServiceNetworkAttachmentIPAllocationMethod $IP_AllOCATION_METHOD `
123+
-CpuCore $CPU_CORES `
124+
-ExtendedLocationName $CUSTOM_LOCATION `
125+
-ExtendedLocationType $CUSTOM_LOCATION_TYPE `
126+
-Location $LOCATION `
127+
-SubscriptionId $SUBSCRIPTION `
128+
-MemorySizeGb $MEMORY_SIZE `
129+
-OSDiskSizeGb $VM_DISK_SIZE `
130+
-VMImage $VM_IMAGE `
131+
-BootMethod $BOOT_METHOD `
132+
-CloudServiceNetworkAttachmentDefaultGateway $CSN_ATTACHMENT_DEFAULTGATEWAY `
133+
-CloudServiceNetworkAttachmentName $CSN_ATTACHMENT_NAME `
134+
-IsolateEmulatorThread $ISOLATE_EMULATOR_THREAD `
135+
-NetworkAttachment $NETWORKATTACHMENT `
136+
-NetworkData $NETWORKDATA `
137+
-OSDiskCreateOption $OS_DISK_CREATE_OPTION `
138+
-OSDiskDeleteOption $OS_DISK_DELETE_OPTION `
139+
-SshPublicKey $SSH_PUBLIC_KEY `
140+
-UserData $USERDATA `
141+
-VMDeviceModel $VMDEVICEMODEL `
142+
-VMImageRepositoryCredentialsUsername $ACR_USERNAME `
143+
-VMImageRepositoryCredentialsPassword $SECUREPASSWORD `
144+
-VMImageRepositoryCredentialsRegistryUrl $ACR_URL
145+
```
146+
147+
After a few minutes, the command completes and returns information about the virtual machine. You've created the virtual machine. You're now ready to use them.
148+
149+
> [!NOTE]
150+
> If each server has two CPU chipsets and each CPU chip has 28 cores, then with hyperthreading enabled (default), the CPU chip supports 56 vCPUs. With 8 vCPUs in each chip reserved for infrastructure (OS and agents), the remaining 48 are available for tenant workloads.
151+
152+
## Review deployed resources
153+
154+
[!INCLUDE [quickstart-review-deployment-poweshell](./includes/virtual-machine/quickstart-review-deployment-ps.md)]
155+
156+
## Clean up resources
157+
158+
[!INCLUDE [quickstart-cleanup](./includes/virtual-machine/quickstart-cleanup-ps.md)]
159+
160+
## Next steps
161+
162+
You've successfully created a Nexus virtual machine. You can now use the virtual machine to host virtual network functions (VNFs).

articles/operator-nexus/quickstarts-tenant-workload-deployment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ After a few minutes, the command completes and returns information about the vir
114114

115115
## Clean up resources
116116

117-
[!INCLUDE [quickstart-cleanup](./includes/virtual-machine/quickstart-cleanup.md)]
117+
[!INCLUDE [quickstart-cleanup](./includes/virtual-machine/quickstart-cleanup-cli.md)]
118118

119119
## Next steps
120120

0 commit comments

Comments
 (0)