Fetching Instance Metadata from IMDS URL through App Service in VNet

Joshi, Ritika 0 Reputation points
2025-03-03T08:57:38.8566667+00:00

Is it possible to fetch instance metadata from the IMDS URL through an Azure App Service that is hosted on a VNet rather than a VM?

I attempted to retrieve instance metadata using the Kudu console of the App Service, but encountered the following error:

curl: (28) Failed to connect to 169.254.169.254 port 80 after 21050 ms: Could not connect to server.

The App Service is hosted on a subnet within the VNet, and a managed identity is enabled.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,930 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Laxman Reddy Revuri 5,395 Reputation points Microsoft External Staff Moderator
    2025-03-03T09:40:31.25+00:00

    Hi @Joshi, Ritika
    The Instance Metadata Service, or IMDS, works for Azure virtual machines and virtual machine scale sets. However, IMDS is not available from Azure App Services directly or even when App Services are sitting on a VNet. The error you encountered (curl: (28) Failed to connect to 169.254.169.254 port 80) occurs because the App Service cannot connect to the IMDS endpoint.
    references:
    https://learn.microsoft.com/en-us/azure/load-balancer/instance-metadata-service-load-balancer#retrieve-load-balancer-information-by-using-azure-instance-metadata-service
    https://learn.microsoft.com/en-us/azure/virtual-machines/instance-metadata-service?tabs=windows#azure-instance-metadata-service
    Please accept as "Yes" if the answer provided is useful, so that you can help others in the community looking for remediation for similar issues.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.