For system, network and cloud administrators

How to retrieve all network interfaces ID of your Azure virtual machine using Azure CLI

In order to get all the IDs of your Azure virtual machine network interfaces, you can use:

az vm show --resource-group YourResourceGroup --name YourVMName --query "networkProfile.networkInterfaces[].id"

How to retrieve network details from your Azure virtual machine using Azure CLI

In order to view the network details of your Azure virtual machine, you can use:

az vm show --resource-group YourResourceGroup --name YourVMName --query networkProfile

How to retrieve the size assigned to an Azure virtual machine using Azure CLI

If you need to know the size assigned to an Azure virtual machine, you can use:

az vm show --resource-group YourResourceGroup --name YourVMName --query hardwareProfile.vmSize


How to retrieve OS details from your Azure virtual machine using Azure CLI

In order to view what public SSH key your Azure virtual machine is using or some other OS details like the admin username of your machine, you can use:

az vm show --resource-group YourResourceGroup --name YourVMName --query "osProfile"

How to retrieve the admin username of your Azure virtual machine using Azure CLI

If you need to know what’s the admin username of a particular Azure virtual machine, use:

az vm show --resource-group YourResourceGroup --name YourVMName --query "osProfile.adminUsername"