Hello Yang Qiao
There are a few ways to get the containerId or roleInstanceName of an Azure VM.
Using the Azure portal
- Go to the Azure portal and navigate to the VM.
- In the Overview section, under Properties, look for the Container ID or Role Instance Name.
Using the Azure CLI
- Run the following command to get the list of VMs in your subscription:
az vm list
- Look for the VM that you are interested in and note the Container ID or Role Instance Name.
Using the Azure PowerShell
- Import the Azure PowerShell module:
Import-Module Azure
- Run the following command to get the list of VMs in your subscription:
Get-AzVM
- Look for the VM that you are interested in and note the Container ID or Role Instance Name.
The containerId or roleInstanceName is a unique identifier for the VM. It can be used to identify the VM in Azure and to manage the VM.
Here are some additional resources that you may find helpful:
- Azure VM documentation: https://docs.microsoft.com/en-us/azure/virtual-machines/
- Azure CLI documentation: https://docs.microsoft.com/en-us/cli/azure/
- Azure PowerShell documentation: https://docs.microsoft.com/en-us/powershell/azure/