-
-
Save kaxil/4ca16c429546c23e12da38edf79e7691 to your computer and use it in GitHub Desktop.
Azure Instance Metadata service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get all metadata | |
curl -H Metadata:true "http://169.254.169.254/metadata/instance?api-version=2017-04-02" | |
# Get all network metadata | |
curl -H Metadata:true "http://169.254.169.254/metadata/instance/network?api-version=2017-04-02" | |
# Get public ip only | |
curl -H Metadata:true "http://169.254.169.254/metadata/instance/network/interface/0/ipv4/ipAddress/0/publicIpAddress?api-version=2017-04-02&format=text" | |
#unique VM id | |
curl -H Metadata:true "http://169.254.169.254/metadata/instance/compute/vmId?api-version=2017-04-02&format=text" | |
Invoke-RestMethod -Headers @{"Metadata"="true"} -URI http://169.254.169.254/metadata/instance?api-version=2017-04-02 -Method get | |
Invoke-RestMethod -Headers @{"Metadata"="true"} -URI http://169.254.169.254/metadata/instance/network?api-version=2017-04-02 -Method get |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment