canonical: https://jentic.com/apis/azure.com/instancemetadataclient

# Microsoft Azure InstanceMetadataClient

Jentic publishes the only available OpenAPI specification for InstanceMetadataClient, keeping it validated and agent-ready. The Azure Instance Metadata Service (IMDS) is a non-routable endpoint reachable from inside an Azure VM at 169.254.169.254 that returns information about the running instance and issues managed identity tokens. It exposes 4 endpoints to fetch instance metadata, an attested document, managed identity info, and an OAuth 2.0 access token for the VM's assigned identity.

## For AI agents

Read Azure VM instance metadata and obtain managed identity OAuth tokens from inside the VM via the Azure Instance Metadata Service.

## Scope

Does not handle Azure Resource Manager calls, secret storage, or cross-VM discovery - use for in-VM metadata reads and managed identity token issuance only.

## Capabilities

- Retrieve compute, network, and tag metadata for the running Azure VM
- Fetch an attested document signed by Azure to prove VM identity to relying parties
- Look up the managed identity client and tenant ids assigned to the VM
- Obtain an OAuth 2.0 access token for a managed identity scoped to a target resource
- Operate without storing credentials by relying on the VM's IMDS endpoint

## Use cases

### Credential-Free Azure SDK Auth

Workloads running on Azure VMs avoid embedded secrets by calling /identity/oauth2/token to obtain a managed identity bearer token, then passing it to other Azure APIs. The IMDS endpoint is reachable only from the VM itself, so no inbound network rules are needed. Adopting this pattern typically takes a couple of hours per workload and removes a class of secret-rotation problems.

Example prompt: Call /identity/oauth2/token with resource=https://management.azure.com/ from the VM and return the bearer token.

### VM Self-Description for Tagging and Routing

Bootstrap scripts read /instance to discover the VM's region, vmSize, resourceGroupName, and tags, then configure their behaviour accordingly - for example, registering with a region-specific service discovery system. Because IMDS is local, the call is fast and does not depend on AAD. This is the standard way to make Azure VMs self-aware without baking config into images.

Example prompt: GET /instance and return the compute.location, compute.vmSize, and the value of the tag named 'environment'.

### Attested VM Identity for Zero-Trust

Relying parties verify VM identity by fetching the /attested/document, which returns a JWT signed by Azure that includes the subscriptionId, vmId, and other compute fields. The receiving service validates the signature and checks the claims before granting access. This is the foundation for zero-trust admission to internal services that should only accept calls from sanctioned Azure VMs.

Example prompt: GET /attested/document?api-version=2019-08-15 and return the signed JWT.

### Agent-Driven IMDS Calls via Jentic

An AI agent running on (or proxying to) an Azure VM can fetch metadata and tokens through Jentic without code that hard-codes the IMDS host. The agent searches Jentic for 'get an azure managed identity token', loads the operation schema, and executes against the local IMDS. Jentic mediates the request shape and surfaces the response into the agent's context.

Example prompt: Use the Jentic MCP tool azure_imds_get_token to fetch a managed identity token for resource https://vault.azure.net and return the access_token.

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| GET | /instance | Return compute, network, and tag metadata for the running VM |
| GET | /identity/info | Return managed identity client and tenant ids for the VM |
| GET | /identity/oauth2/token | Issue a managed identity OAuth 2.0 access token for a target resource |
| GET | /attested/document | Return a signed attested document for the VM |

## Key resources

- **Instance** — Compute, storage, and network metadata for the running VM
- **Identity** — Information about the managed identities assigned to the VM and the OAuth token endpoint
- **AttestedDocument** — Signed JWT proving VM identity to relying parties

## Why Jentic

- **Setup:** Wiring the Azure Instance Metadata Service by hand means remembering the link-local 169.254.169.254 address, attaching the required Metadata header to every request, and handling the managed-identity token flow yourself. Through Jentic you install once, import InstanceMetadataClient from the API Directory, and your agent calls it over a Jentic-mediated path that supplies the Metadata header, since IMDS authorizes by the request originating inside the VM rather than by a stored credential.
- **Permission scoping:** IMDS is a read surface reached from inside the VM, so limit the agent to the operations it needs, such as reading /instance metadata or requesting a managed-identity token from /identity/oauth2/token. You choose the operations it may call, so the attested document read is not included unless you add it.
- **Credential handling:** IMDS itself needs no stored credential because it trusts the in-VM origin, and any managed-identity token it issues is held once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'get an Azure managed identity token' or 'read this VM's instance metadata', and Jentic returns the matching IMDS operation with its input schema so the agent calls the right endpoint without remembering the link-local URL or required headers.

## Related APIs

- **Azure Key Vault** — A managed identity token from IMDS is the standard credential for calling Key Vault from a VM.
- **Azure IoT Hub** — VMs that gateway to IoT Hub can authenticate with managed identity tokens issued by IMDS.
- **Azure HybridData Management** — HybridData targets cross-environment data movement rather than VM self-description.

## FAQ

### Why is there no official OpenAPI spec for InstanceMetadataClient?

Microsoft documents IMDS as a REST surface but does not publish a maintained OpenAPI 3 specification for it. Jentic generates and maintains this spec so that AI agents and developers can call InstanceMetadataClient via structured tooling. It is validated against the live API and kept up to date. Get started with Jentic One, the self-hosted execution layer.

### What authentication does the InstanceMetadataClient use?

IMDS itself is reachable only from the VM at 169.254.169.254 and requires the request header Metadata: true on every call. Through Jentic the request shape including this header is handled automatically. The /identity/oauth2/token endpoint then issues a bearer token for downstream Azure services.

### Can I get a managed identity token from this API?

Yes. GET /identity/oauth2/token with the api-version query parameter and a resource parameter (e.g. resource=https://management.azure.com/) returns an access_token, expires_in, and the client_id of the identity. Use the token as a Bearer credential for the target Azure service.

### What are the rate limits for IMDS?

IMDS is a per-VM local service and does not publish a per-second rate cap, but Microsoft recommends caching tokens until close to expiry rather than calling /identity/oauth2/token on every request. Treat repeated calls within a few seconds as wasteful, not as a hard limit.

### How do I retrieve VM metadata through Jentic?

Run pip install jentic, then search Jentic with 'get azure vm instance metadata', load the /instance operation, and execute it. Jentic returns the compute, network, and tag JSON exactly as IMDS produces it, so downstream code reads .compute.location and friends directly.

### Does IMDS work from outside the VM?

No. The endpoint 169.254.169.254 is link-local and only reachable from inside the Azure VM. For workloads outside the VM that need similar token issuance, use Azure AD app registrations or workload identity federation instead.

### Can I limit what my agent is allowed to do with the Azure Instance Metadata Service?

Yes. Because you run Jentic One yourself, your own rules decide which IMDS operations the agent may call, so you can allow only reading instance metadata from /instance while blocking the managed-identity token request at /identity/oauth2/token, or the reverse. The attested document read at /attested/document is not available to the agent unless you explicitly add it. IMDS trusts the in-VM origin rather than a stored credential, and any managed-identity token it issues is held by your own Jentic One instance and injected at execution time rather than exposed to the agent.
