Use the Azure metadata Service to query the Public IP Address of VM

Login

Blog History

curl -s -H Metadata:true http://169.254.169.254/metadata/instance?api-version=2021-02-01 | jq -r '.network.interface | .[] | .ipv4.ipAddress | .[] | .publicIpAddress'
#output
13.70.193.102

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.