Public IP not available via metadata

rsmitty 11 Reputation points
2020-01-29T20:39:44.603+00:00

Hello, I think I've encountered a bug or issue with the metadata service in Azure. I'm trying to curl the metadata endpoint to fetch my public IP I associated with a linux VM at boot time. This behavior works fine with a "basic" SKU public IP. However, if I try this with a "standard" SKU IP, the public IP is never listed. Here is the endpoint I've been testing against:
http://169.254.169.254/metadata/instance/network/interface?api-version=2019-06-01

Unsure if this is a legit bug or if there's a difference in behavior between the two types of IPs that I should be expecting.

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,172 questions
{count} votes

4 answers

Sort by: Most helpful
  1. jakaruna-MSFT 596 Reputation points Microsoft Employee
    2020-01-30T04:21:59.53+00:00

    Hi,
    Standard sku public ips are not shown in metadata

    Reference: https://learn.microsoft.com/en-us/azure/virtual-network/virtual-network-ip-addresses-overview-arm#standard

    Actual not from the documnet.

    Note

    Only Public IP addresses with basic SKU are available when using instance metadata service IMDS. Standard SKU is not supported.

    You can submit a request here if you need this feature. Dev teams may take this into their backlog

    0 comments No comments

  2. Corey Hammerton 0 Reputation points
    2024-02-22T19:03:32.17+00:00

    We had the same problem in our organization. Architects from Microsoft directed us to https://learn.microsoft.com/en-us/azure/load-balancer/howto-load-balancer-imds?tabs=linux. Standard SKU Public IP addresses are available to Instance Metadata Service under the loadbalancer metadata.

    0 comments No comments

  3. Corey Hammerton 0 Reputation points
    2024-02-22T19:05:59.7833333+00:00

    We had the same problem too. After talking with Microsoft Architects they directed us to https://learn.microsoft.com/en-us/azure/load-balancer/howto-load-balancer-imds?tabs=linux. We can get Standard SKU Public IPs from the IMDS using the loadbalancer metadata.

    0 comments No comments

  4. Alex Gregory 1 Reputation point
    2024-03-14T16:31:51.3+00:00

    What you want is:

    Invoke-RestMethod -Headers @{"Metadata"="true"} -Method GET -Uri "http://169.254.169.254:80/metadata/loadbalancer?api-version=2020-10-01" | ConvertTo-Json -Depth 64 | jq -r '.loadbalancer.publicIpAddresses[0].frontendIpAddress'