flossiraptor / imds4azure
Query Azure Instance Meta-Data Services.
dev-main
2025-04-17 13:27 UTC
Requires
This package is auto-updated.
Last update: 2025-04-17 13:27:58 UTC
README
The Microsoft Azure IMDS (Instance Meta-Data Service) can be queried to fetch metadata information about the running environment and Azure configuration.
Installation
We recommend using composer to install the IMDS for Azure library.
composer require flossiraptor/imds4azure
Quickstart
use Flossiraptor\Imds4Azure\IMDS; $imds = new IMDS(); // Get all the instance metadata. $instanceMetadata = $imds->instance()->get(); // Get the public IP address of the VM. $ipAddress = $imds->instance()->get('network.interface.0.ipv4.ipAddress.0.publicIpAddress'); // Get the public IP address of the load-balancer. $lbAddress = $imds->loadbalancer()->get('loadbalancer.publicIpAddresses.0.frontendIpAddress'); // Get an access token for the "Management" resource. $token = (string) $imds->identity()->getToken('https://management.azure.com/');
Categories
Detailed descriptions and links can be found at https://learn.microsoft.com/en-us/azure/virtual-machines/instance-metadata-service
Supported
/metadata/identity
/metadata/instance
/metadata/loadbalancer
Not supported
/metadata/attested
/metadata/scheduledevents
/metadata/versions
Legal
Microsoft, Azure are trademarks of the Microsoft group of companies.