Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.

Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.

Best practices for designing Azure Resource Manager templates https://azure.microsoft.com/en-us/documentation/articles/best-practices-resource-manager-design-templates/ Also, see Appendix for additional slides on this topic

A JSON template file is a text file that contains descriptions of the resources, configurations code and extensions. JSON templates can be run multiple times without changing the outcome beyond initial deployment. A consequence of this is that templates can be used to upgrade your already existing deployments, for example, you can scale out an application with additional Virtual machines. You modify the template to include the specifications for the additional virtual machines. When you deploy the template, Azure Resource Manager will recognize the resources that have previously been deployed and create only the resources that have been added.

For those of you that aren’t developers I’ll provide a some details about JSON…. A JSON file is constructed of key/value pairs. For example, in the image above, "ContentVersion" is the key and "1.0.0.0" is the value. A key is always a string enclosed in quotation marks. A value can be a string, securestring, number, boolean expression, array, or object. A JSON object is enclosed in curly braces, "{ }". In a key/value pair the key is always followed by a colon. Key/pairs are separated by commas.

A JSON template may also contain functions and expressions. Expression are enclosed in square brackets, "[ ]', and can appear anywhere in a JSON string. Functions calls have the format functionName(arg1,arg2,arg3). Properties are referenced using the dot and index operators.

A JSON template is divided into sections: <CLICK> The $schema (a required element that provides the location of the file that describes the version of the template language) along with a required element that provides the version of the template

The schema reference is used by intelligent JSON clients to determine the schema that is applicable to the JSON file and to provide additional functionality such as autocomplete and intellisense.

<CLICK> Parameters (optional elements that define values that are passed in when the template is executed)

The value for the Parameters key is an array of parameter objects that representing the dynamic input for the JSON template. Each of the parameter objects has a name that is used to pass values in at runtime and is referenced within the JSON itself in other sections. For example, "NewStorageAccount" is the name of the parameter that is supplied as an input and used to provide the name of the storage account resource specified in the JSON file.

<CLICK> Variables (optional elements that define the values that are used when template is executed)

<CLICK> Resources (a required element that defines the resources that are deployed or updated in a resource group); and

This slide doesn’t show it, but you can also have an optional Outputs section that defines values that are returned after a deployment