Announcing General Availability of Instance Metadata Service in Global Azure Regions

4月 11, 2017 に投稿済み

Senior Program Manager, Azure Compute

We are excited to announce General Availability of Instance Metadata Service in all Global Azure regions and Public preview in German/Government and China cloud. 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.

Service Availability

Service is available to all Azure Resource Manager created VMs in all Global Azure regions. The service is also now available in preview in Government/China/German Azure Clouds.

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-04-02

Windows

curl –H @{‘Metadata’=’true’} http://169.254.169.254/metadata/instance?api-version=2017-04-02

The default output for all instance metadata is of json format (content type Application/JSON)

Azure Instance Metadata Service

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/privateIpAddress Local IP address of the VM
ipv4/publicIpAddress Public IP address for the Instance
subnet/address Address for subnet
subnet/prefix Subnet prefix , example 24
ipv6/ipaddress IPv6 address for the VM
macAddress VM mac address
scheduledevents see scheduledevents (In Preview)

 

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 (Classic) 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?

     Please retry your request based on exponential back off system. If the issue persists contact Azure support.