This is some annoying design that frustrates me every single time I use old CLI command azure vm list: IP of the VM is not listed. https://github.com/Azure/azure-xplat-cli/issues/2818
Every other compete CLIs and Portals show the VM IP anytime list of VMs is presented to the user.
Now in the new cli, neither az vm list nor az vm show shows the public IP address of the VM. The old CLI showed it in azure vm show.
@ahmetalpbalkan We have a command for this: az vm list-ip-addresses. The reason it doesn't show up in VM list or show (or even show with --expand instanceView) is simply because the compute service does not return that info. The gymnastics to retrieve the ip-address are slow and costly from a network perspective, which is why we don't do it as part of the generic show/list command.
@tjprescott got it! Thanks. Do you think this list-ip-addresses is discoverable enough? I guess it does the job for me, but I think these cmds listing VM(s) should show the IP addr, too. Perhaps you can make a query to the NRP (in parallel to fasten up) to get that and populate it in the VM response?
@ahmetalpbalkan we can work to make it more discoverable (for instance, putting a reference in the --help text). We might also be able to expose a --show-ip-addresses flag which would let the user "opt in" to the slower response in exchange for this info. @yugangw-msft is this something that could work?
I mean ideally it just should be there. It's there on the portal...
If I'm trying to view a VM I'm probably not trying to view its size, name, id, osDisk, osProfile, networkInterface IDs, right? I'm probably trying to connect to it.
If this doesn't work out, I'd prefer something short like az vm ip I think.
We have debated on this for several times. I have always wanted to display the ip-address in vm show. The main augment was it might slow things down.
But for vm show it only involves 2 extra rest calls which are to get nic and then the public-ip. The extra cost won't be that significant, as it mostly gets amortized in command loading, parsing and output.
So my opinion is still
vm showvm list, if we get more user feedback, do like Travis suggested. The nic number per each subscription could reach to 10000, so I feel much comfortable with opt-in.I think a more long-term healthier solution would be getting CRP APIs to expand the IP addresses of the instance if there are concerns around slowing the client-side down. If you are worried about client-side perf, you need to get the backend fixed.
Agreed. That is what we had hoped for.
It is all about the trade-off to made under the context that there is no timeline yet for when the server end will get fixed, and at the same time people's daily lives will have to continue.
I would add FQDN to the PIP request for show|list. At least show. Or add it to list-ip-addresses. I miss that feature from xplat and can't find a way to get it at the VM level now.
I have submitted a PR, the change will look like:
az vm show -g yugangw -n yugangw-9 -d -otable
Name ResourceGroup PowerState PublicIps Fqdns Location
--------- --------------- ------------ -------------- ---------------------------------- ----------
yugangw-9 yugangw VM running 104.42.231.246 yugangw9.westus.cloudapp.azure.com westus
Following command returning an empty line
az vm list-ip-addresses -g UbuntuCleanTest -n MyUbuntuVM
Shouldn't it return the ip address of MyUbuntuVM VM from UbuntuCleanTest resource group?
@jahongirman it should return that, provided the IP address has been resolved at the time you invoked the command.