We are excited to announce the public preview of Instance Metadata Service in Azure’s West Central US region. Instance Metadata Service is a RESTful endpoint that allows virtual machines instances to get information regarding its compute, network and upcoming maintenance events. The endpoint is available at a well-known non-routable IP address (169.254.169.254) that can be accessed only from within the VM. The data from Instance Metadata Service can help with your cluster setup, replica placement, supportability, telemetry, or other cluster bootstrap or runtime needs.
Previews are made available to you on the condition that you agree to the terms of use. For more information, see Microsoft Azure Supplemental Terms of Use for Microsoft Azure Previews.
Service Availability
Service is available to all Azure Resource Manager created VMs currently in West Central US region. As we add more regions we will update this post and the documentation with the details.
Regions where Instance Metadata Service is available |
West Central US |
Detailed documentation
Learn more about Azure Instance Metadata Service
Retrieving instance metadata
Instance Metadata Service is available for running VMs created/managed using Azure Resource Manager. To access all data categories for an instance, use the following sample code for Linux or Windows
Linux
curl -H Metadata:true http://169.254.169.254/metadata/instance?api-version=2017-03-01
Windows
curl –H @{‘Metadata’=’true’} http://169.254.169.254/metadata/instance?api-version=2017-03-01
The default output for all instance metadata is of json format (content type Application/JSON)
Instance Metadata data categories
Following table has a list of all data categories available via Instance Metadata
Data | Description |
location |
Azure Region the VM is running |
name | Name of the VM |
offer | Offer information for the VM image, these values are present only for images deployed from Azure image gallery |
publisher | Publisher of the VM image |
sku | Specific SKU for the VM image |
version | Version of the VM Image |
osType | Linux or Windows |
platformUpdateDomain | Update domain the VM is running in. |
platformFaultDomain | Fault domain the VM is running in. |
vmId | Unique identifier for the VM, more info here |
vmSize | VM size |
ipv4/Ipaddress | Local IP address of the VM |
ipv4/publicip | Public IP address for the Instance |
subnet/address | Address for subnet |
subnet/dnsservers/ipaddress1 | Primary DNS server |
subnet/dnsservers/ipaddress2 | Secondary DNS server |
subnet/prefix | Subnet prefix , example 24 |
ipv6/ipaddress | IPv6 address for the VM |
mac | VM mac address |
scheduledevents | see scheduledevents |
FAQs
- I am getting Bad request, Required metadata header not specified. What does this mean?
Metadata Service requires header of Metadata:true to be passed in the request. Passing header will allow access
- Why am I not getting compute information for my VM?
Currently Instance Metadata Service supports Azure Resource Manager created instances only, in future we will add support for Cloud Services VMs
- I created my Virtual Machine through ARM a while back, Why am I not seeing compute metadata information?
For any VMs created after Sep 2016 you can simply add a new Tag to start seeing compute metadata. For older VMs (created before Sep 2016) you would have to add/remove extensions to the VM to refresh metadata
- Why am I getting error 500 - Internal server error?
Currently Instance Metadata Preview is available only in West US Central Region, please deploy your VMs there.
- Where do I share Additional questions/comments?
Send your comments on http://feedback.azure.com