上QQ阅读APP看书,第一时间看更新
Designing ARM templates
ARM templates are one of the foundational pillars for the successful deployment of solutions on Azure. Authoring the right set of ARM templates—that are modular, reusable, and generic—is the first major task for ARM templates. The other aspect is the management and governance of these ARM templates. It is absolutely crucial to design the ARM template in a way that it can evolve over a period of time as well as be managed effectively.
The process for designing an ARM template is as follows:
- Identification of resources: This is the first step when designing ARM templates for a solution; it involves the identification of resources and their count. There are many resources that provide similar features; however, there are differences between them. It is advised to read the fine print of those resources before selecting them for the solution.
- Resource location: After resource identification, the location of these resources should be ascertained. Resources should be determined based on organizational policies and objectives. This also depends on sovereign rules and statutory regulations. The location is also determined based on the availability and pricing of resources in that region. There are also architectural requirements in terms of high availability, disaster-recovery, and performance to choose multiple locations for these resource locations.
- Identification of the resource provider and its version: Resources are made available in Azure by resource providers. Resource providers are containers that provide security and namespaces to resource types. Each resource provider provides an API layer through which clients interact with it. This API undergoes changes based on changes in the resource types it contains. If there are breaking changes in resources, the resource provider version is incremented to reflect the breaking changes. Also, the addition of new features will change the version number of these resource providers. These version numbers are based on the date on which they are released. While designing ARM templates, it is necessary to determine the appropriate resource-provider version number based on your requirements.
- Sequencing: Now that the Api version location and resources are identified, the sequence in which these resources should be provisioning needs to be determined. This is a necessary activity because a few resources might be dependent on other resources before they can be provisioned. This dependency could be because a resource might need data from other resources, or they could be a child resource of those resources.
- Identification of parameters and variables: Now that the sequencing of resources is determined, it is important to make the template generic, modular, and reusable. It is also important that templates are maintainable and easy to change. Parameters for resource configuration and the execution of templates should be ascertained such that templates can be reused across environments and solutions. Variables should be determined based on the number of times a value is used multiple times within the template.
- Identification of output from the template: The template output is important because it provides the return value and feedback about the execution of the template and its resources. This output also helps with testing the ARM templates.
- Identification of the deployment process: ARM templates can be deployed using Azure portal, Azure PowerShell, Azure CLI, REST API, and SDKs. It is important to identify the tools used for the deployment of ARM templates. Azure PowerShell and Azure CLI are preferred means for deploying ARM templates. Furthermore, an orchestrator tool, such as Azure DevOps should be used to automate the deployment process.
The preceding process is shown here: