Does Azure container instance support Instance metadata /medata/instance

NS 40 Reputation points
2023-10-03T10:50:01.6233333+00:00

When I try to access the Instance Metadata endpoint by execing into the container instance, I get the following error

SandboxHost-638313869729567099:/# curl -v -s -H Metadata:true --noproxy "*" "http://169.254.169.254/metadata/instance?api-version=2021-02-01"
* processing: http://169.254.169.254/metadata/instance?api-version=2021-02-01
*   Trying 169.254.169.254:80...
* connect to 169.254.169.254 port 80 failed: Operation timed out
* Failed to connect to 169.254.169.254 port 80 after 130820 ms: Couldn't connect to server
* Closing connection

Does ACI container support access to /metadata/instance ?

Azure Container Instances
Azure Container Instances
An Azure service that provides customers with a serverless container experience.
654 questions
0 comments No comments
{count} votes

Accepted answer
  1. TP 79,076 Reputation points
    2023-10-04T07:14:39.4933333+00:00

    Hi Neha,

    Based on my tests Azure Container Instances only supports getting tokens via the IMDS metadata/identity/oauth2/token endpoint. In other words, Instance isn't supported.

    The other endpoint categories return 404 error if Identity is enabled for the container, if Identity is not enabled for the container then connections to IMDS will fail as in your example.

    If you would like to confirm my results, navigate to your container instance -- Identity blade in the portal, turn on system-assigned managed identity, Save, wait a minute, then repeat test in your container.

    Please click Accept Answer if the above was useful.

    Thanks.

    -TP

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. vipullag-MSFT 25,121 Reputation points
    2023-10-04T06:03:33.9533333+00:00

    Hello Neha

    Welcome to Microsoft Q&A Platform, thanks for posting your query here.

    Yes, ACI container instances support access to the Instance Metadata Service (IMDS) endpoint at http://169.254.169.254/metadata/instance. The error you are seeing suggests that the container instance is unable to connect to the IMDS endpoint. This could be due to a network configuration issue or a firewall rule blocking access to the endpoint.

    To troubleshoot this issue, you can try the following steps:

    • Check the network configuration of the container instance to ensure that it has a network interface and is connected to a network that allows outbound traffic.
    • Check if there are any firewall rules that are blocking access to the IMDS endpoint. You can try temporarily disabling the firewall to see if that resolves the issue.
    • Try accessing the IMDS endpoint from a different container instance or a virtual machine in the same network to see if the issue is specific to the container instance.

    If you are still unable to access the IMDS endpoint, then i would suggest to open a Azure support for further assistance on this.

    Hope this helps.