Skip to content

Instantly share code, notes, and snippets.

@rsponholtz
Last active April 20, 2020 21:57
Show Gist options
  • Save rsponholtz/624f25ca9e919748e048ee2102629c69 to your computer and use it in GitHub Desktop.
Save rsponholtz/624f25ca9e919748e048ee2102629c69 to your computer and use it in GitHub Desktop.
azure metadata api examples
#get network info for VM
curl -H Metadata:true "http://169.254.169.254/metadata/instance/network?api-version=2017-08-01"
#get the subnet mask
curl -H Metadata:true "http://169.254.169.254/metadata/instance/network/interface/0/ipv4/subnet/0/prefix?api-version=2017-08-01&format=text"
#
curl -H Metadata:true "http://169.254.169.254/metadata/instance?api-version=2019-06-01"
#wget -cq http://jsonip.com/ -O - | jq '.'
#all metadata for instance, pretty printed
curl -H Metadata:true "http://169.254.169.254/metadata/instance?api-version=2019-06-01" | python -m json.tool
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment