Max Length of Azure Resource ID and Whether Resource ID is URI or URN?

Rajesh Swarnkar 911 Reputation points
2023-03-15T07:17:38.3866667+00:00

Hello Microsoft Experts:

I have few meta-questions about the Azure Resource ID:

  • I am aware that ResourceIDs in Azure have specific format: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} as per the docs However, there is NO document that speaks about its max length. What is Maximum length of Resource ID?
  • Also as per this SO Post, we know not whether ResourceID is URN or URI?

Can you please quote the answers to above questions with doc links?

Azure Cloud Services
Azure Cloud Services
An Azure platform as a service offer that is used to deploy web and cloud applications.
775 questions
{count} votes

Accepted answer
  1. Andreas Baumgarten 123.6K Reputation points MVP Volunteer Moderator
    2023-03-15T08:12:09.0933333+00:00

    Hi @Rajesh Swarnkar ,

    there is no dedicated information about the max length of an Azure ResourceID I am aware of.

    But with some math it's possible to calculate the max length:

    Subscription ID is always 36

    ResourceGroupName: max length 90 (valid resource group name)

    ResourceProviderName: max length 64 (longest ResourceProviderName is 45 but assuming 64 as max length (Resource providers))

    ResourceType: max length around 256 (no official information found)

    ResourceName: max length 512 (Naming rules and restrictions for Azure resources)

    Special Characters (/): 8

    In summary the max length would be "966".

    Please be aware this is no official information and contains assumptions!

    The Resource ID is an URI in my opinion, because a URN will start with urn:. (Uniform Resource Identifier)


    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards Andreas Baumgarten


1 additional answer

Sort by: Most helpful
  1. Prrudram-MSFT 28,281 Reputation points Microsoft Employee Moderator
    2023-03-15T08:30:12.88+00:00

    Hi @Rajesh Swarnkar

    Thank you for reaching out to the Microsoft Q&A platform.

    Regarding the maximum length of Azure Resource ID, I couldn't find any official documentation mentioning the maximum length. However, based on my understanding and observations, the maximum length of a Resource ID is 260 characters, which is the maximum file path length in Windows. It's worth noting that this limit may vary depending on the specific Azure service or resource.

    As for whether the Resource ID is a URN or a URI, the answer is that it's neither. According to the official Azure documentation, Resource IDs are formatted as follows: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. This format is specific to Azure and is not a standard URI or URN format.

    The post you referenced provides some good additional information, but it's worth noting that it's not an official Microsoft source. In general, the Azure documentation should be considered the most reliable and up-to-date source of information on Azure Resource IDs.

    Please don’t forget to Accept Answer and Yes for "was this answer helpful" wherever the information provided helps you, this can be beneficial to other community members.

    1 person found this answer helpful.
    0 comments No comments

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.