For system, network and cloud administrators
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"
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"