Inconsistent API Response for Subnet IP Address: addressPrefixes vs. addressPrefix in Get Virtual Network API

Shaked Eyal 86 Reputation points
2024-09-12T11:39:55.5433333+00:00

Hi,
We noticed the following behavior:
When using the Get Virtual Network API, sometimes the subnet IP address is returned as a list, like this:

"subnets": [ {
	"name": "AzureFirewallSubnet", 
	"id": "/subscriptions/
Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,762 questions
0 comments No comments
{count} votes

Accepted answer
  1. KapilAnanth-MSFT 49,536 Reputation points Microsoft Employee Moderator
    2024-09-16T05:32:01.4166667+00:00

    @Shaked Eyal ,

    Welcome to the Microsoft Q&A Platform. Thank you for reaching out & I hope you are doing well.

    From your verbatim, I see you noticed Virtual Networks - Get REST API is returning "subnets" as a list.

    I take it that, you are actually concerned about the "subnets.properties.addressPrefix" and "subnets.properties.addressPrefixes"

    • Can you confirm
      • If this is same results with a particular Subnet
      • or even with a particular Subnet, sometimes you are getting a list and sometimes you are not
    • The former is also an expected behavior
    • From the "Export Template" blade of the Virtual Network - you would notice that the certain VNETs would have subnets' address range as addressPrefixes while others have addressPrefix
    • This is because of the recent changes in the creation of VNET with Portal
      • Newer VNETs would use addressPrefixes
      • While older VNETs would use addressPrefix
    • This also depends on how the VNET was created via Template or CLI or Powershell

    In case you notice a particular Subnet sometimes returning addressPrefix and sometimes returning addressPrefixes, we can look into this.

    Thanks,

    Kapi


    Please don’t forget to close the thread by clicking "Accept the answer" wherever the information provided helps you, as this can be beneficial to other community members.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

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.