The command to get just an IP address of a VM is too complicated
I'm playing with the new CLI and wanted to figure out what is the right command to get the public IP address of one of my VMs, so that I can connect to it from bash using ssh `az whatever`.
As far as I can tell, the command to do that is:
ssh `az vm list-ip-addresses -n vm-name --query [0].virtualMachine.network.publicIpAddresses[0].ipAddress -o tsv`
Is there a simpler way to do this? If not, I think that's way too complicated for something like this.
@svick, you can use 'az vm show -d'
More specifically I've had success with '(az vm show --name
Getting below error when querying for ip address of the server (az vm show --name server01 | ConvertFrom-Json).publicIps -bash: syntax error near unexpected token `.publicIps'
For vms => az vm list-ip-addresses --output table
For vm by name => az vm list-ip-addresses --output table -n
To view in JSON format remove ' --output table' from the above commands.
get only local vm ip address https://rapidsol.blogspot.com/2019/11/command-for-vm-ip-address-only.html
ifconfig eth0 or ifconfig ens33
You have to type above of interface name to get single ip address.
az vm show -d --name myVM --resource-group myRG --query publicIps