Azure Resource Manager Templates Quick Start Guide
eBook - ePub

Azure Resource Manager Templates Quick Start Guide

Create, deploy, and manage Azure resources with ARM templates using best practices

Ritesh Modi

Share book
  1. 234 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Azure Resource Manager Templates Quick Start Guide

Create, deploy, and manage Azure resources with ARM templates using best practices

Ritesh Modi

Book details
Book preview
Table of contents
Citations

About This Book

Compose and decompose ARM templates and use advanced concepts like looping, conditions, dependencies, PowerShell and Desired State Configuration.

Key Features

  • Design, implement, and unit test ARM templates
  • Develop and deploy ARM templates following security best practices

Book Description

Azure Resource Manager (ARM) templates are declarations of Azure resources in the JSON format to provision and maintain them using infrastructure as code. This book gives practical solutions and examples for provisioning and managing various Azure services using ARM templates.

The book starts with an understanding of infrastructure as code, a refresher on JSON, and then moves on to explain the fundamental concepts of ARM templates. Important concepts like iteration, conditional evaluation, security, usage of expressions, and functions will be covered in detail.

You will use linked and nested templates to create modular ARM templates. You will see how to create multiple instances of the same resources, how to nest and link templates, and how to establish dependencies between them.

You will also learn about implementing design patterns, secure template design, the unit testing of ARM templates, and adopting best practices.

By the end of this book, you will understand the entire life cycle of ARM templates and their testing, and be able to author them for complex deployments.

What you will learn

  • Understand the foundations of ARM templates including nested and linked templates
  • Design, create, and unit test ARM templates using best practices
  • Learn about conditional deployments, looping, Custom Script Extensions using PowerShell, Bash, and DSC
  • Implement design patterns related to ARM templates
  • Run post-deployment PowerShell and Desired State Configuration scripts
  • Create solutions and deploy them on Azure using ARM templates

Who this book is for

This books is for developers, DevOps engineers, and architects who have experience in Azure.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Azure Resource Manager Templates Quick Start Guide an online PDF/ePUB?
Yes, you can access Azure Resource Manager Templates Quick Start Guide by Ritesh Modi in PDF and/or ePUB format, as well as other popular books in Ciencia de la computación & Computación en la nube. We have over one million books available in our catalogue for you to explore.

Information

Year
2019
ISBN
9781789612271

Section 1: ARM Template Foundational Skills

In this section, the reader will learn the basics of ARM templates. This will include understanding important ARM template constructs and how to deploy them. Authoring complex templates using advanced features, including linked templates and nested templates, will also be part of this chapter. ARM templates have some unique features, such as functions and expressions, which will also be detailed in a comprehensive manner.
This section contains the following chapters:
  • Chapter 1, Infrastructure as Code and Configuration Management
  • Chapter 2, Azure Resource Manager Templates
  • Chapter 3, Understanding Core Elements of ARM Templates
  • Chapter 4, Advance Template Features

Infrastructure as Code and Configuration Management

Welcome, readers, to the world of Azure Cloud, Azure Resource Manager (ARM), and ARM templates. Azure Cloud is growing in leaps and bounds and has good acceptability within enterprises. Azure Cloud provides a very performance-centric, scalable, and reliable Azure Resource Manager platform for management and governance of our deployments. To create resources on Azure, ARM templates are preferred over other mechanisms because of their inherent advantages. These advantages are mentioned throughout this book.
ARM templates have become an essential skill for any serious development on Azure, and writing reusable effective ARM template is sought after by many organizations. The Azure DevOps paradigm, to a large extent, also depends on ARM templates for its automation requirements.
In this first chapter, we will cover the following topics:
  • Configuration management
  • Infrastructure as code
  • Understanding ARM templates
  • Designing ARM template
  • A primer on JSON
  • Introducing Azure Resource Manager

What is configuration management?

Every deployment comprises two stacks of resources:
  • Environment or infrastructure resources
  • Application deployment
Infrastructure resources refer to hardware, software, and platform resources that make an environment suitable for application deployment. For example: infrastructure resources might contain hardware resources, such as networks, load balancers, network interface cards, physical server, virtual machines, network connectivity, an operating system, as well as platform resources, such as container runtime, and framework deployments, such as .NET core. Each of these infrastructure resources should be configured in a way that ensures the application will work according to its design.
After infrastructure resource-provisioning, the application is deployed on top of them. These are related to resources such as application binaries, application dependencies, and package installations.
The configuration of these resources is needed across environments—from higher-level environments, such as the production environment, to lower-level environments, such as the dev and test environments. There can be multiple environments for a solution. The configuration for each of these environments is different. The configuration for a production environment for a solution is different than the configuration of a development environment for the same solution. The configuration differences could be in terms of number of virtual machines, the size of virtual machines, the DNS names, the IP address range, and more. The application configuration for each of these environments is also different. For example: the connection string to database, integration endpoints to other systems, and other configurations are different across these environments.
Active management of both the infrastructure- and application-level configuration information as well as data is known as configuration management in software life cycle management parlance.
There are many tools that can help manage configurations across environments. Some of these are open source while others are propriety.
Each cloud provider also has its own configuration-management tools.
Azure provides ARM templates for provisioning and configuring the infrastructure resources. Other cloud vendors provide their own native ways to configure the environments.
Tools such as Desired State Configuration, Chef, Puppet, and Ansible are suitable for application configuration.
ARM templates enable a concept known as Infrastructure as Code; let's understand it in the next section.

Infrastructure as Code

Infrastructure as Code is one of the important facets of configuration-management systems. Generally, an environment is provisioned using manual efforts, such as using a self-service portal or wizard that provides step-by-step directions to configure a resource. It might go a step further and the environment can be provisioned using scripts, such as PowerShell and Bash. These scripts can then execute either manually or automatically using an orchestrator tool.
There are some serious limitations in using any of the previously mentioned approaches:
  • Lack of repeatability, consistency, and predictability during provisioning and updating environments. The configuration values for scripts are either entered manually by copying from documents and Excel sheets.
  • Lack of diagnostic information and it's difficult to figure out the exact error location.
  • Human error while providing configuration values.
  • Lack of confidence in deployments.
  • Lack of efficiency and speed.
These limitations demand using a more systematic and automated approach for the creation of environments and the deployment of applications.
Infrastructure as Code can help remove these limitations. At a high level, Infrastructure as Code refers to the process of defining environments using code and then using it to create environments. However, Infrastructure as Code is much more than this. Infrastructure as Code mandates that infrastructure definitions after it's converted into code should follow the same application life cycle management principles that typically is followed for applications, they are as follows:
  • They should be versioned and stored in a version-controlled repository. Developers should be able to author infrastructure-related code and push them into the repository.
  • The repository helps with collaborating among developers about code related to infrastructure.
  • There should be a process established to verify and validate the changes done to infrastructure code to ensure that only well-tested code is deployed to higher-level environments.
  • After verification, the code should be stored in a place that can be used by all the environments for creation and updates.
  • Configuration information for each environment should be stored alongside the actual infrastructure code. These configurations can then be applied to each environment as applicable.
  • After the infrastructure code is deployed to pre-production and production environments, appropriate operational validation should be conducted to ensure that the environment is behaving as intended and meeting expectations.
  • There should be active monitoring of the environment and any deviation from the known desired configuration should be reported back.
The following screenshot is depicting the process followed for Infrastructure as Code:

What are ARM templates?

ARM templates are JSON files and they enable Infrastructure as Code for Azure Cloud Platform. ARM templates help to provision and configure resources in a predictable, consistent, and repeatable manner.
ARM templates help in the following ways:
  • Specifying resources and their configurations in a declarative manner. There is no scripting involved in provisioning resources.
  • Providing intent and what should be provisioned by defining the resources rather than how to deploy the resources.
  • Offers idempotent deployments by ensuring that the end state of the deployment is always consistent and predictable. This means that even during incremental deployments, the end state will remain consistent. It also means that templates deployed over and over will not change the end result, and environments will be equivalent when used to create multiple environments.
  • Orchestrates the provisioning and configuration process by declaring dependencies between resources.
  • Parameterizes the deployment process by enabling reusability, modular, and generic development.
  • Cross-subscription, cross-region, and multiple resource group deployment and configuration of resources.
  • Enables DevOps in the continuous integration and the continuous deployment of resources and the environment.

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...

Table of contents