Search code examples
azureazure-rm-template

Arm template 800 resource limitation


From Arm template website - https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/best-practices The limit of arm template size is 4mb and the number of resources is 800.

I'm developing a service where I handle ARM template deployment for customers, however, I'm finding out that the arm templates are getting bigger and bigger and are going past the 800 resource limit and more than 4mb size.

What is the recommended path moving forward that will ensure idempotency and in the event of a disaster, ensure recovery in a timely manner?

I would not want to write my own service that would implement basically what arm is doing as I feel that would be a waste.

I heard about Linked templates but wanted to know if this was the rccommended approach and what other limitations I should be aware of.

EDIT: I am focusing on a specific problem. Would like to understand how to circumvent the 800 resource limitation from arm template, and whether linked template would have associated limitations. Thanks Rimaz and Jeremy for the explanation!


Solution

  • Definitely go with Linked templates (see : https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/linked-templates?tabs=azure-powershell#linked-template). With 800 resources you need to make sure your ARM templates are modular, and easily understandable to you and your devs. So create a master template that will in turn deploy the other templates linked to it.

    enter image description here

    You can use Azure Template Specs to easily manage/refer your linked templates when running the template deployment in your pipeline (instead of hosting them on a storage account or a public repo) https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/quickstart-create-template-specs?tabs=azure-powershell

    Also check this helpful video from John Savil that shows how you can use template specs to make it easy for you to deploy linked templates in your pipelines https://www.youtube.com/watch?v=8MmWTjxT68o