Sensitivity Issue with Resource ID in Azure SDK API Calls

Maayan Dugma 20 Reputation points
2024-12-23T07:28:38.6866667+00:00

I am writing to report an issue we have encountered with the Azure SDK when making API calls to retrieve resource information.

There appears to be an inconsistency in how resource names are handled in the Resource IDs, particularly regarding case sensitivity.

For example, in the SDK call "NetworkManagementClient(token, subscription_id).subnets.list", which retrieves the details of all subnets under the same virtual network, the subnet id sometimes contains a capital "P" ("Production") and other times a lowercase "p" ("production").

This discrepancy causes issues in our processes that rely on accurate and consistent resource identification. To provide further clarity, here are two examples:

in python the library azure.mgmt.network:

Incorrect subnet ID which returned by the SDK call: /subscriptions/{number}/resourceGroups/RG-Prodnet/providers/Microsoft.Network/virtualNetworks/Production

 

Correct subnet ID: /subscriptions/{number}/resourceGroups/RG-Prodnet/providers/Microsoft.Network/virtualNetworks/production
Additionally, as shown in the attached image, you can see the output of all the subnet ids returned by the sdk call of "NetworkManagementClient(token, subscription_id).virtual_networks.list_all", which retrieves the list of all virtual networks and their associated subnets.

As you can see, the subnet ID sometimes contains a capital "P" ("Production") and other times a lowercase "p" ("production")

Thanks,
Maayan

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,593 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. KapilAnanth-MSFT 48,261 Reputation points Microsoft Employee
    2024-12-23T09:19:50.2166667+00:00

    @Maayan Dugma ,

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

    Please note that Resource and resource group names are case-insensitive unless specifically noted in the valid characters column.

    If you further look at the Notes section,

    When using various APIs to retrieve the name for a resource or resource group, the returned value may have different casing than what you originally specified for the name. The returned value may even display different case values than what is listed in the valid characters table.

    Always perform a case-insensitive comparison of names.

    As suggested, you can either make the entire resource ID lower case or upper case and further pass the new value to subsequent functions/application within your code.

    Please let us know if we can be of any further assistance here.

    Thanks,

    Kapil


    Please Accept an answer if correct.

    Original posters help the community find answers faster by identifying the correct answer.


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.