Skip to content

Commit 335f3ee

Browse files
committed
updated outdated documentation for VM Console Service. the updated commands were tested and was successful
1 parent cfd12b0 commit 335f3ee

File tree

1 file changed

+27
-18
lines changed

1 file changed

+27
-18
lines changed

articles/operator-nexus/howto-use-vm-console-service.md

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ author: sshiba
55
ms.author: sidneyshiba
66
ms.service: azure-operator-nexus
77
ms.topic: how-to
8-
ms.date: 10/25/2024
8+
ms.date: 07/22/2025
99
ms.custom: template-how-to, devx-track-azurecli
1010
---
1111

@@ -47,16 +47,18 @@ To help set up the environment for access to Virtual Machines, define these envi
4747
> The CM_EXTENDED_LOCATION value can be found with the command `az networkcloud virtualmachine show --name <virtual machine name> --resource-group <virtual machine's resource group> --query "consoleExtendedLocation" | jq -r '.consoleExtendedLocation.name'`.
4848
4949
```bash
50-
# CM_HOSTED_RESOURCES_RESOURCE_GROUP: Cluster Manager resource group name
51-
export CM_HOSTED_RESOURCES_RESOURCE_GROUP="my-contoso-console-rg"
50+
# CLUSTER_MANAGER_RESOURCE_GROUP: Cluster Manager resource group name
51+
export CLUSTER_MANAGER_RESOURCE_GROUP="my-contoso-console-rg"
5252
5353
# VIRTUAL_MACHINE_NAME: Virtual Machine name you want to access through VM Console service
5454
export VIRTUAL_MACHINE_NAME="my-undercloud-vm"
55+
# VIRTUAL_MACHINE_RG: Resource group name where the Virtual Machine is located
56+
export VIRTUAL_MACHINE_RG="my-contoso-console-rg"
5557
# CM_EXTENDED_LOCATION: Cluster Manager Extended Location, can be retrieved but you will need access rights to execute certain Azure CLI commands
56-
export CM_EXTENDED_LOCATION=$(az networkcloud virtualmachine show --name ${VIRTUAL_MACHINE_NAME} --resource-group ${VIRTUAL_MACHINE_RG} --query "consoleExtendedLocation" | jq -r '.consoleExtendedLocation.name')
58+
export CM_EXTENDED_LOCATION=$(az networkcloud virtualmachine show --name ${VIRTUAL_MACHINE_NAME} --resource-group ${VIRTUAL_MACHINE_RG} --query "consoleExtendedLocation.name" -o tsv)
5759
5860
# CONSOLE_PUBLIC_KEY: Public Key matching Private Key to be used when establish `ssh` session, e.g., `ssh -i $HOME/.ssh/id-rsa`
59-
export CONSOLE_PUBLIC_KEY="xxxx-xxxx-xxxxxx-xxxx"
61+
export CONSOLE_PUBLIC_KEY="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD... user@hostname"
6062
# CONSOLE_EXPIRATION_TIME: Expiration date and time (RFC3339 format) for any `ssh` session with a virtual machine.
6163
export CONSOLE_EXPIRATION_TIME="2023-06-01T01:27:03.008Z"
6264
@@ -74,6 +76,13 @@ To help set up the environment for access to Virtual Machines, define these envi
7476
export PRIVATE_ENDPOINT_SUBNET="my-work-env-ple-subnet"
7577
```
7678
79+
> [!IMPORTANT]
80+
> When setting the `CONSOLE_PUBLIC_KEY` environment variable, make sure to properly quote the SSH public key value since it contains spaces. For example:
81+
> ```bash
82+
> export CONSOLE_PUBLIC_KEY="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQ... user@hostname"
83+
> ```
84+
> The SSH public key should be the complete key string including the key type (ssh-rsa, ssh-ed25519, etc.), the key data, and optionally the comment.
85+
7786
## Creating Console Resource
7887
7988
The Console resource provides the information about the Nexus VM. It provides the VM name, public SSH key, expiration date for the SSH session, and so on.
@@ -82,10 +91,10 @@ This section provides step-by-step guide to help you to create a Console resourc
8291
8392
:::image type="content" source="media/vm-console-resource.png" alt-text="Diagram of VM Console Resource." lightbox="media/vm-console-resource.png":::
8493
85-
1. To create a ***Console*** resource in the Cluster Manager, you'll need to collect some information, for example, resource group (CM_HOSTED_RESOURCES_RESOURCE_GROUP) and custom location (CM_EXTENDED_LOCATION). You have to provide the resource group but you can retrieve the custom location if you have access rights to execute the following commands:
94+
1. To create a ***Console*** resource in the Cluster Manager, you'll need to collect some information, for example, resource group (CLUSTER_MANAGER_RESOURCE_GROUP) and custom location (CM_EXTENDED_LOCATION). You have to provide the resource group but you can retrieve the custom location if you have access rights to execute the following commands:
8695
8796
```bash
88-
export cluster_manager_resource_id=$(az resource list -g ${CM_HOSTED_RESOURCES_RESOURCE_GROUP} --query "[?type=='Microsoft.NetworkCloud/clusterManagers'].id" --output tsv)
97+
export cluster_manager_resource_id=$(az resource list -g ${CLUSTER_MANAGER_RESOURCE_GROUP} --query "[?type=='Microsoft.NetworkCloud/clusterManagers'].id" --output tsv)
8998
export CM_EXTENDED_LOCATION=$(az resource show --ids $cluster_manager_resource_id --query "properties.managerExtendedLocation.name" | tr -d '"')
9099
```
91100
@@ -94,10 +103,10 @@ This section provides step-by-step guide to help you to create a Console resourc
94103
```bash
95104
az networkcloud virtualmachine console create \
96105
--virtual-machine-name "${VIRTUAL_MACHINE_NAME}" \
97-
--resource-group "${CM_HOSTED_RESOURCES_RESOURCE_GROUP}" \
106+
--resource-group "${CLUSTER_MANAGER_RESOURCE_GROUP}" \
98107
--extended-location name="${CM_EXTENDED_LOCATION}" type="CustomLocation" \
99108
--enabled True \
100-
--key-data "${CONSOLE_PUBLIC_KEY}" \
109+
--ssh-public-key key-data="${CONSOLE_PUBLIC_KEY}" \
101110
[--expiration "${CONSOLE_EXPIRATION_TIME}"]
102111
```
103112
@@ -111,17 +120,17 @@ This section provides step-by-step guide to help you to create a Console resourc
111120
```bash
112121
export pls_resourceid=$(az networkcloud virtualmachine console show \
113122
--virtual-machine-name "${VIRTUAL_MACHINE_NAME}" \
114-
--resource-group "${CM_HOSTED_RESOURCES_RESOURCE_GROUP}" \
115-
--query "privateLinkServiceId")
123+
--resource-group "${CLUSTER_MANAGER_RESOURCE_GROUP}" \
124+
--query "privateLinkServiceId" -o tsv)
116125
```
117126
118127
1. Also, retrieve the **VM Access ID**. You must use this unique identifier as `user` of the `ssh` session.
119128
120129
```bash
121130
virtual_machine_access_id=$(az networkcloud virtualmachine console show \
122131
--virtual-machine-name "${VIRTUAL_MACHINE_NAME}" \
123-
--resource-group "${CM_HOSTED_RESOURCES_RESOURCE_GROUP}" \
124-
--query "virtualMachineAccessId")
132+
--resource-group "${CLUSTER_MANAGER_RESOURCE_GROUP}" \
133+
--query "virtualMachineAccessId" -o tsv)
125134
```
126135
127136
> [!NOTE]
@@ -175,7 +184,7 @@ The VM Console service is a `ssh` server that "relays" the session to a Nexus VM
175184
> The VM Console service listens to port `2222`, therefore you **must** specify this port number in the `ssh` command.
176185
>
177186
> ```bash
178-
> SSH [-i path-to-private-SSH-key] -p 2222 $virtual_machine_access_id@$sshmux_ple_ip
187+
> ssh [-i path-to-private-SSH-key] -p 2222 $virtual_machine_access_id@$sshmux_ple_ip
179188
> ```
180189
181190
:::image type="content" source="media/vm-console-ssh-session.png" alt-text="Diagram of VM Console SSH Session." lightbox="media/vm-console-ssh-session.png":::
@@ -194,7 +203,7 @@ az networkcloud virtualmachine console update \
194203
--virtual-machine-name "${VIRTUAL_MACHINE_NAME}" \
195204
--resource-group "${VM_RESOURCE_GROUP}" \
196205
[--enabled True | False] \
197-
[--key-data "${CONSOLE_PUBLIC_KEY}"] \
206+
[--ssh-public-key key-data="${CONSOLE_PUBLIC_KEY}"] \
198207
[--expiration "${CONSOLE_EXPIRATION_TIME}"]
199208
```
200209
@@ -223,6 +232,6 @@ To clean up your VM Console environment setup, you need to delete the Console re
223232
224233
```bash
225234
az network private-endpoint delete \
226-
--name ${PRIVATE_ENDPOINT_NAME}-ple \
227-
--resource-group ${PRIVATE_ENDPOINT_NAME}-rg
228-
```
235+
--name "${PRIVATE_ENDPOINT_NAME}" \
236+
--resource-group "${PRIVATE_ENDPOINT_RG}"
237+
```

0 commit comments

Comments
 (0)