Nov 122019
 

Most of the configuration that we do n azure portal can also be generated in the form of ARMN templates. Azure Resource Manager (ARM) templates dictate how the resources will be provisioned on azure.

In this blog I will follow a very basic guide in creating a ARM template. This guide consist of 6 different steps that I will follow.

 

are Azure Resource Managere template This command is to validate the arm template

az group deployment validate –resource-group videolunch –template-file .\template.json –parameters .\parameters.json

these steps are used to make an arm template

step1: use git

step2: validate and then commit

setp3: reduce the number of parameters. Remove it from the parameters json and add the variables thr instead

step4: use unique string

step5:user vaiables. Use variables instead of constants

step6: use tshirt size or smart options. Use readble words

creating a template

template manager in azure portal

using VS create a  cloud managers and then ARM template

it contains

list of parameters, variables, resources, outputs

 

Template format

In its simplest structure, a template has the following elements:

JSONCopy

{ “$schema”:”https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#”, “contentVersion”:””, “apiProfile”:””, “parameters”: {  }, “variables”: {  }, “functions”: [  ], “resources”: [  ], “outputs”: {  }}

Element name Required Description
$schema Yes Location of the JSON schema file that describes the version of the template language.

For resource group deployments, use: https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#

For subscription deployments, use: https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#

contentVersion Yes Version of the template (such as 1.0.0.0). You can provide any value for this element. Use this value to document significant changes in your template. When deploying resources using the template, this value can be used to make sure that the right template is being used.
apiProfile No An API version that serves as a collection of API versions for resource types. Use this value to avoid having to specify API versions for each resource in the template. When you specify an API profile version and don’t specify an API version for the resource type, Resource Manager uses the API version for that resource type that is defined in the profile.

The API profile property is especially helpful when deploying a template to different environments, such as Azure Stack and global Azure. Use the API profile version to make sure your template automatically uses versions that are supported in both environments. For a list of the current API profile versions and the resources API versions defined in the profile, see API Profile.

For more information, see Track versions using API profiles.

parameters No Values that are provided when deployment is executed to customize resource deployment.
variables No Values that are used as JSON fragments in the template to simplify template language expressions.
functions No User-defined functions that are available within the template.
resources Yes Resource types that are deployed or updated in a resource group or subscription.
outputs No Values that are returned after deployment.

Each element has properties you can set. This article describes the sections of the template in greater detail.

 Posted by at 10:19 pm

Sorry, the comment form is closed at this time.