\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{Ilham (ilperdan0)} \pdfinfo{ /Title (structure-and-syntax-of-arm-templates.pdf) /Creator (Cheatography) /Author (Ilham (ilperdan0)) /Subject (Structure and Syntax of ARM Templates Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{A36434} \definecolor{LightBackground}{HTML}{F9F5F2} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{Structure and Syntax of ARM Templates Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{Ilham (ilperdan0)} via \textcolor{DarkBackground}{\uline{cheatography.com/126607/cs/26286/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}Ilham (ilperdan0) \\ \uline{cheatography.com/ilperdan0} \\ \uline{\seqsplit{www}.packetnotes.com} \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 25th January, 2021.\\ Updated 25th January, 2021.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{2} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Template format}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\{ \newline "\$schema": \seqsplit{"https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json\#"}, \newline "contentVersion": "", \newline "apiProfile": "", \newline "parameters": \{ \}, \newline "variables": \{ \}, \newline "functions": {[} {]}, \newline "resources": {[} {]}, \newline "outputs": \{ \} \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{A template's elements, in its simplest structure. Each element has properties we can set.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{1.824 cm} x{1.368 cm} x{4.408 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Template Format Elements}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{Element name}} & {\bf{Required}} & {\bf{Description}} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \$schema & Yes & - Location of the JavaScript Object Notation (JSON) schema file that describes the version of the template language. \{\{nl\}\} - The version number depends on the scope of the deployment and the JSON editor. \tn % Row Count 11 (+ 9) % Row 2 \SetRowColor{LightBackground} \seqsplit{contentVersion} & Yes & Version of the template (such as 1.0.0.0). Can be any value. Used to document significant changes in the template. This value can be used to make sure that the right template is being used. \tn % Row Count 20 (+ 9) % Row 3 \SetRowColor{white} \seqsplit{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. \tn % Row Count 28 (+ 8) % Row 4 \SetRowColor{LightBackground} \seqsplit{parameters} & No & Values that are provided when deployment is executed to customize resource deployment. \tn % Row Count 32 (+ 4) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{1.824 cm} x{1.368 cm} x{4.408 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Template Format Elements (cont)}} \tn % Row 5 \SetRowColor{LightBackground} \seqsplit{variables} & No & Values that are used as JSON fragments in the template to simplify template language expressions. \tn % Row Count 5 (+ 5) % Row 6 \SetRowColor{white} \seqsplit{functions} & No & User-defined functions that are available within the template. \tn % Row Count 8 (+ 3) % Row 7 \SetRowColor{LightBackground} \seqsplit{resources} & Yes & Resource types that are deployed or updated in a resource group or subscription. \tn % Row Count 12 (+ 4) % Row 8 \SetRowColor{white} outputs & No & Values that are returned after deployment. \tn % Row Count 14 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Parameters}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{"parameters": \{ \newline "\textless{}parameter-name\textgreater{}" : \{ \newline "type" : "\textless{}type-of-parameter-value\textgreater{}", \newline "defaultValue": "\textless{}default-value-of-parameter\textgreater{}", \newline "allowedValues": {[} "\textless{}array-of-allowed-values\textgreater{}" {]}, \newline "minValue": \textless{}minimum-value-for-int\textgreater{}, \newline "maxValue": \textless{}maximum-value-for-int\textgreater{}, \newline "minLength": \textless{}minimum-length-for-string-or-array\textgreater{}, \newline "maxLength": \textless{}maximum-length-for-string-or-array-parameters\textgreater{}, \newline "metadata": \{ \newline "description": "\textless{}description-of-the parameter\textgreater{}" \newline \} \newline \} \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Specify which values one can input when deploying the resources. It is limited to 256 parameters in a template. Use objects that contain multiple properties to reduce the number of parameters.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{1.824 cm} x{1.368 cm} x{4.408 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Parameter Elements}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{Element name}} & {\bf{Required}} & {\bf{Description}} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \seqsplit{parameter-name} & Yes & Name of the parameter. Must be a valid JavaScript identifier. \tn % Row Count 5 (+ 3) % Row 2 \SetRowColor{LightBackground} type & Yes & Type of the parameter value. The allowed types and values are string, securestring, int, bool, object, secureObject, and array. \tn % Row Count 11 (+ 6) % Row 3 \SetRowColor{white} \seqsplit{defaultValue} & No & Default value for the parameter, if no value is provided for the parameter. \tn % Row Count 15 (+ 4) % Row 4 \SetRowColor{LightBackground} \seqsplit{allowedValues} & No & Array of allowed values for the parameter to make sure that the right value is provided. \tn % Row Count 19 (+ 4) % Row 5 \SetRowColor{white} minValue & No & The minimum value for int type parameters, this value is inclusive. \tn % Row Count 22 (+ 3) % Row 6 \SetRowColor{LightBackground} maxValue & No & The maximum value for int type parameters, this value is inclusive. \tn % Row Count 25 (+ 3) % Row 7 \SetRowColor{white} \seqsplit{minLength} & No & The minimum length for string, secure string, and array type parameters, this value is inclusive. \tn % Row Count 30 (+ 5) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{1.824 cm} x{1.368 cm} x{4.408 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Parameter Elements (cont)}} \tn % Row 8 \SetRowColor{LightBackground} \seqsplit{maxLength} & No & The maximum length for string, secure string, and array type parameters, this value is inclusive. \tn % Row Count 5 (+ 5) % Row 9 \SetRowColor{white} \seqsplit{description} & No & Description of the parameter that is displayed to users through the portal. For more information \tn % Row Count 10 (+ 5) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Define Parameters Example}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{"parameters": \{ \newline "storageSKU": \{ \newline "type": "string", \newline "allowedValues": {[} \newline "Standard\_LRS", \newline "Standard\_ZRS", \newline "Standard\_GRS", \newline "Standard\_RAGRS", \newline "Premium\_LRS" \newline {]}, \newline "defaultValue": "Standard\_LRS", \newline "metadata": \{ \newline "description": "The type of replication to use for the storage account." \newline \} \newline \} \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{The above example shows a simple parameter definition. It defines a parameter named {\bf{{\emph{storageSKU}}}}. The parameter is a string value, and only accepts values that are valid for its intended use. The parameter uses a default value when no value is provided during deployment.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Resources}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{"resources": {[} \newline \{ \newline "condition": "\textless{}true-to-deploy-this-resource\textgreater{}", \newline "type": "\textless{}resource-provider-namespace/resource-type-name\textgreater{}", \newline "apiVersion": "\textless{}api-version-of-resource\textgreater{}", \newline "name": "\textless{}name-of-the-resource\textgreater{}", \newline "comments": "\textless{}your-reference-notes\textgreater{}", \newline "location": "\textless{}location-of-resource\textgreater{}", \newline "dependsOn": {[} \newline "\textless{}array-of-related-resource-names\textgreater{}" \newline {]}, \newline "tags": \{ \newline "\textless{}tag-name1\textgreater{}": "\textless{}tag-value1\textgreater{}", \newline "\textless{}tag-name2\textgreater{}": "\textless{}tag-value2\textgreater{}" \newline \}, \newline "sku": \{ \newline "name": "\textless{}sku-name\textgreater{}", \newline "tier": "\textless{}sku-tier\textgreater{}", \newline "size": "\textless{}sku-size\textgreater{}", \newline "family": "\textless{}sku-family\textgreater{}", \newline "capacity": \textless{}sku-capacity\textgreater{} \newline \}, \newline "kind": "\textless{}type-of-resource\textgreater{}", \newline "copy": \{ \newline "name": "\textless{}name-of-copy-loop\textgreater{}", \newline "count": \textless{}number-of-iterations\textgreater{}, \newline "mode": "\textless{}serial-or-parallel\textgreater{}", \newline "batchSize": \textless{}number-to-deploy-serially\textgreater{} \newline \}, \newline "plan": \{ \newline "name": "\textless{}plan-name\textgreater{}", \newline "promotionCode": "\textless{}plan-promotion-code\textgreater{}", \newline "publisher": "\textless{}plan-publisher\textgreater{}", \newline "product": "\textless{}plan-product\textgreater{}", \newline "version": "\textless{}plan-version\textgreater{}" \newline \}, \newline "properties": \{ \newline "\textless{}settings-for-the-resource\textgreater{}", \newline "copy": {[} \newline \{ \newline "name": , \newline "count": , \newline "input": \{\} \newline \} \newline {]} \newline \}, \newline "resources": {[} \newline "\textless{}array-of-child-resources\textgreater{}" \newline {]} \newline \} \newline {]}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{To define the resources that are deployed or updated.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{1.824 cm} x{1.368 cm} x{4.408 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Resources Elements Format}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{Element name}} & {\bf{Required}} & {\bf{Description}} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \seqsplit{condition} & No & Boolean value that indicates whether the resource will be provisioned during this deployment. When true, the resource is created during deployment. When false, the resource is skipped for this deployment. \tn % Row Count 11 (+ 9) % Row 2 \SetRowColor{LightBackground} type & Yes & Type of the resource. This value is a combination of the namespace of the resource provider and the resource type (such as {\bf{Microsoft.Storage/storageAccounts}}). \tn % Row Count 19 (+ 8) % Row 3 \SetRowColor{white} \seqsplit{apiVersion} & Yes & Version of the REST API to use for creating the resource. When creating a new template, set this value to the latest version of the resource you're deploying. \tn % Row Count 26 (+ 7) % Row 4 \SetRowColor{LightBackground} name & Yes & Name of the resource. The name must follow URI component restrictions defined in RFC3986. \tn % Row Count 30 (+ 4) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{1.824 cm} x{1.368 cm} x{4.408 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Resources Elements Format (cont)}} \tn % Row 5 \SetRowColor{LightBackground} comments & No & Your notes for documenting the resources in your template. \tn % Row Count 3 (+ 3) % Row 6 \SetRowColor{white} location & Varies & Supported geo-locations of the provided resource. You can select any of the available locations, but typically it makes sense to pick one that is close to your users. \tn % Row Count 11 (+ 8) % Row 7 \SetRowColor{LightBackground} \seqsplit{dependsOn} & No & Resources that must be deployed before this resource is deployed. Resource Manager evaluates the dependencies between resources and deploys them in the correct order. \tn % Row Count 19 (+ 8) % Row 8 \SetRowColor{white} tags & No & Tags that are associated with the resource. Apply tags to logically organize resources across your subscription. \tn % Row Count 24 (+ 5) % Row 9 \SetRowColor{LightBackground} sku & No & Some resources allow values that define the SKU to deploy. For example, you can specify the type of redundancy for a storage account. \tn % Row Count 30 (+ 6) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{1.824 cm} x{1.368 cm} x{4.408 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Resources Elements Format (cont)}} \tn % Row 10 \SetRowColor{LightBackground} kind & No & Some resources allow a value that defines the type of resource you deploy. \tn % Row Count 4 (+ 4) % Row 11 \SetRowColor{white} copy & No & If more than one instance is needed, the number of resources to create. The default mode is parallel. Specify serial mode when you don't want all or the resources to deploy at the same time. \tn % Row Count 13 (+ 9) % Row 12 \SetRowColor{LightBackground} plan & No & Some resources allow values that define the plan to deploy. For example, you can specify the marketplace image for a virtual machine. \tn % Row Count 19 (+ 6) % Row 13 \SetRowColor{white} \seqsplit{properties} & No & Resource-specific configuration settings. The values for the properties are the same as the values you provide in the request body for the REST API operation (PUT method) to create the resource. You can also specify a copy array to create several instances of a property. \tn % Row Count 31 (+ 12) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{1.824 cm} x{1.368 cm} x{4.408 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Resources Elements Format (cont)}} \tn % Row 14 \SetRowColor{LightBackground} \seqsplit{resources} & No & Child resources that depend on the resource being defined. Only provide resource types that are permitted by the schema of the parent resource. Dependency on the parent resource isn't implied. You must explicitly define that dependency. \tn % Row Count 11 (+ 11) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Comments}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\{ \newline "type": \seqsplit{"Microsoft.Compute/virtualMachines"}, \newline "apiVersion": "2018-10-01", \newline "name": "{[}variables('vmName'){]}", // to customize name, change it in variables \newline "location": "{[}parameters('location'){]}", //defaults to resource group location \newline "dependsOn": {[} /{\emph{ storage account and network interface must be deployed first }}/ \newline "{[}resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName')){]}", \newline "{[}resourceId('Microsoft.Network/networkInterfaces/', variables('nicName')){]}" \newline {]},} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{For inline comments, you can use either // or /{\emph{ ... }}/ but this syntax doesn't work with all tools. If you add this style of comment, be sure the tools you use support inline JSON comments.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Metadata}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\{ \newline "\$schema": \seqsplit{"https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json\#"}, \newline "contentVersion": "1.0.0.0", \newline "metadata": \{ \newline "comments": "This template was developed for demonstration purposes.", \newline "author": "Example Name" \newline \}, \newline \newline {\bf{For parameters, add a metadata object with a description property.}} \newline \newline "parameters": \{ \newline "adminUsername": \{ \newline "type": "string", \newline "metadata": \{ \newline "description": "User name for the Virtual Machine." \newline \} \newline \}, \newline \newline {\bf{The following example shows both a comments element and a metadata object for Resources}} \newline \newline "resources": {[} \newline \{ \newline "type": \seqsplit{"Microsoft.Storage/storageAccounts"}, \newline "apiVersion": "2018-07-01", \newline "name": "{[}concat('storage', \seqsplit{uniqueString(resourceGroup()}.id)){]}", \newline "comments": "Storage account used to store VM disks", \newline "location": "{[}parameters('location'){]}", \newline "metadata": \{ \newline "comments": "These tags are needed for policy compliance." \newline \}, \newline "tags": \{ \newline "Dept": "{[}parameters('deptName'){]}", \newline "Environment": "{[}parameters('environment'){]}" \newline \}, \newline "sku": \{ \newline "name": "Standard\_LRS" \newline \}, \newline "kind": "Storage", \newline "properties": \{\} \newline \} \newline {]} \newline \newline {\bf{For outputs, add a metadata object to the output value.}} \newline \newline "outputs": \{ \newline "hostname": \{ \newline "type": "string", \newline "value": "{[}reference(variables('publicIPAddressName')).dnsSettings.fqdn{]}", \newline "metadata": \{ \newline "comments": "Return the fully qualified domain name" \newline \} \newline \},} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{You can add a metadata object almost anywhere in your template. Resource Manager ignores the object, but your JSON editor may warn you that the property isn't valid. In the object, define the properties you need. \newline You can't add a metadata object to user-defined functions.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Data Types}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\{ \newline "\$schema": \seqsplit{"https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json\#"}, \newline "contentVersion": "1.0.0.0", \newline "parameters": \{ \newline "stringParameter": \{ \newline "type": "string", \newline "defaultValue": "option 1" \newline \}, \newline "intParameter": \{ \newline "type": "int", \newline "defaultValue": 1 \newline \}, \newline "boolParameter": \{ \newline "type": "bool", \newline "defaultValue": true \newline \}, \newline "objectParameter": \{ \newline "type": "object", \newline "defaultValue": \{ \newline "one": "a", \newline "two": "b" \newline \} \newline \}, \newline "arrayParameter": \{ \newline "type": "array", \newline "defaultValue": {[} 1, 2, 3 {]} \newline \} \newline \}, \newline "resources": {[}{]}, \newline "outputs": \{\} \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Data Types Explanation}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Data Types within an ARM template: \newline % Row Count 1 (+ 1) - string \newline % Row Count 2 (+ 1) - securestring \newline % Row Count 3 (+ 1) - int \newline % Row Count 4 (+ 1) - bool \newline % Row Count 5 (+ 1) - object \newline % Row Count 6 (+ 1) - secureObject \newline % Row Count 7 (+ 1) - array \newline % Row Count 8 (+ 1) {\bf{Secure string}} uses the same format as {\bf{string}}, and {\bf{secure object}} uses the same format as {\bf{object}}. \newline % Row Count 11 (+ 3) A parameter type as a secure string or secure object, the value of the parameter isn't saved to the deployment history and isn't logged. \newline % Row Count 14 (+ 3) Use {\bf{secure strings}} for passwords and secrets. \newline % Row Count 15 (+ 1) If you set that secure value to a property that isn't expecting a secure value, the value isn't protected. \newline % Row Count 18 (+ 3) For example, if you set a secure string to a tag, that value is stored as plain text. \newline % Row Count 20 (+ 2) For integers passed as inline parameters, the range of values may be limited by the SDK or command-line tool used. \newline % Row Count 23 (+ 3) To avoid this limitation, specify large integer values in a parameter file. \newline % Row Count 25 (+ 2) Resource types apply their own limits for integer properties. \newline % Row Count 27 (+ 2) For {\bf{boolean}} and {\bf{integer}} values in the template, start and end string values with double quotation marks ("string value"). \newline % Row Count 30 (+ 3) } \tn \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Data Types Explanation (cont)}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Objects}} start with a left brace (\{) and end with a right brace (\}). \newline % Row Count 2 (+ 2) {\bf{Arrays}} start with a left bracket ({[}) and end with a right bracket ({]}).% Row Count 4 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Variables}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{"variables": \{ \newline "\textless{}variable-name\textgreater{}": "\textless{}variable-value\textgreater{}", \newline "\textless{}variable-name\textgreater{}": \{ \newline \textless{}variable-complex-type-value\textgreater{} \newline \}, \newline "\textless{}variable-object-name\textgreater{}": \{ \newline "copy": {[} \newline \{ \newline "name": "\textless{}name-of-array-property\textgreater{}", \newline "count": \textless{}number-of-iterations\textgreater{}, \newline "input": \textless{}object-or-value-to-repeat\textgreater{} \newline \} \newline {]} \newline \}, \newline "copy": {[} \newline \{ \newline "name": "\textless{}variable-array-name\textgreater{}", \newline "count": \textless{}number-of-iterations\textgreater{}, \newline "input": \textless{}object-or-value-to-repeat\textgreater{} \newline \} \newline {]} \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{In the variables section, you construct values that can be used throughout the template. It's not necessary to define variables, but they often simplify the template by reducing complex expressions. The format of each variable matches one of the data types.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Variables Example}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Define variable}} \newline % Row Count 1 (+ 1) `"variables": \{` \newline % Row Count 2 (+ 1) ` "storageName": "{[}concat(toLower(parameters('storageNamePrefix')),` \seqsplit{`uniqueString(resourceGroup()}.id)){]}"` \newline % Row Count 5 (+ 3) `\},` \newline % Row Count 6 (+ 1) {\bf{Use variable}} \newline % Row Count 7 (+ 1) `"resources": {[}` \newline % Row Count 8 (+ 1) ` \{` \newline % Row Count 9 (+ 1) ` "type": \seqsplit{"Microsoft.Storage/storageAccounts"},` \newline % Row Count 11 (+ 2) ` "name": "{[}variables('storageName'){]}",` \newline % Row Count 12 (+ 1) ` ...` \newline % Row Count 13 (+ 1) ` \}` \newline % Row Count 14 (+ 1) `{]}`% Row Count 15 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Functions}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{To define complicated expressions that you don't want to repeat throughout your template. You create the user-defined functions from expressions and functions that are supported in templates. \newline % Row Count 4 (+ 4) Function restrictions: \newline % Row Count 5 (+ 1) - The function can't access variables. \newline % Row Count 6 (+ 1) - The function can only use parameters that are defined in the function. When you use the parameters function within a - user-defined function, you're restricted to the parameters for that function. \newline % Row Count 10 (+ 4) - The function can't call other user-defined functions. \newline % Row Count 12 (+ 2) - The function can't use the reference function. \newline % Row Count 13 (+ 1) - Parameters for the function can't have default values.% Row Count 15 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Functions Format}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{"functions": {[} \newline \{ \newline "namespace": "\textless{}namespace-for-functions\textgreater{}", \newline "members": \{ \newline "\textless{}function-name\textgreater{}": \{ \newline "parameters": {[} \newline \{ \newline "name": "\textless{}parameter-name\textgreater{}", \newline "type": "\textless{}type-of-parameter-value\textgreater{}" \newline \} \newline {]}, \newline "output": \{ \newline "type": "\textless{}type-of-output-value\textgreater{}", \newline "value": "\textless{}function-return-value\textgreater{}" \newline \} \newline \} \newline \} \newline \} \newline {]},} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{1.824 cm} x{1.368 cm} x{4.408 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Functions Format Elements}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{Element name}} & {\bf{Required}} & {\bf{Description}} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \seqsplit{namespace} & Yes & Namespace for the custom functions. Use to avoid naming conflicts with template functions. \tn % Row Count 6 (+ 4) % Row 2 \SetRowColor{LightBackground} \seqsplit{function-name} & Yes & Name of the custom function. When calling the function, combine the function name with the namespace. For example, to call a function named `uniqueName` in the namespace contoso, use `"{[}contoso.uniqueName(){]}"`. \tn % Row Count 16 (+ 10) % Row 3 \SetRowColor{white} \seqsplit{parameter-name} & No & Name of the parameter to be used within the custom function. \tn % Row Count 19 (+ 3) % Row 4 \SetRowColor{LightBackground} \seqsplit{parameter-value} & No & Type of the parameter value. The allowed types and values are {\bf{string}}, {\bf{securestring}}, {\bf{int}}, {\bf{bool}}, {\bf{object}}, {\bf{secureObject}}, and {\bf{array}}. \tn % Row Count 26 (+ 7) % Row 5 \SetRowColor{white} \seqsplit{output-type} & Yes & Type of the output value. Output values support the same types as function input parameters. \tn % Row Count 30 (+ 4) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{1.824 cm} x{1.368 cm} x{4.408 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Functions Format Elements (cont)}} \tn % Row 6 \SetRowColor{LightBackground} \seqsplit{output-value} & Yes & Template language expression that is evaluated and returned from the function. \tn % Row Count 4 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Outputs}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{"outputs": \{ \newline "\textless{}output-name\textgreater{}": \{ \newline "condition": "\textless{}boolean-value-whether-to-output-value\textgreater{}", \newline "type": "\textless{}type-of-output-value\textgreater{}", \newline "value": "\textless{}output-value-expression\textgreater{}", \newline "copy": \{ \newline "count": \textless{}number-of-iterations\textgreater{}, \newline "input": \textless{}values-for-the-variable\textgreater{} \newline \} \newline \} \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{To specify values that are returned from deployment. Typically, it returns values from resources that were deployed.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{1.824 cm} x{1.368 cm} x{4.408 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Outputs Element Format}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{Element name}} & {\bf{Required}} & {\bf{Description}} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \seqsplit{output-name} & Yes & Name of the output value. Must be a valid JavaScript identifier. \tn % Row Count 5 (+ 3) % Row 2 \SetRowColor{LightBackground} \seqsplit{condition} & No & Boolean value that indicates whether this output value is returned. \{\{nl\}\} When {\bf{true}}, the value is included in the output for the deployment. \{\{nl\}\} When {\bf{false}}, the output value is skipped for this deployment. \{\{nl\}\} When not specified, the default value is {\bf{true}}. \tn % Row Count 17 (+ 12) % Row 3 \SetRowColor{white} type & Yes & Type of the output value. Output values support the same types as template input parameters. If you specify securestring for the output type, the value isn't displayed in the deployment history and can't be retrieved from another template. To use a secret value in more than one template, store the secret in a Key Vault and reference the secret in the parameter file. \tn % Row Count 33 (+ 16) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{1.824 cm} x{1.368 cm} x{4.408 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Outputs Element Format (cont)}} \tn % Row 4 \SetRowColor{LightBackground} value & No & Template language expression that is evaluated and returned as output value. Specify either value or copy. \tn % Row Count 5 (+ 5) % Row 5 \SetRowColor{white} copy & No & Used to return more than one value for an output. Specify value or copy. \tn % Row Count 9 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Outputs in ARM templates}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Define output values}} \newline \newline The example shows how to return the resource ID for a public IP address: \newline \newline "outputs": \{ \newline "resourceID": \{ \newline "type": "string", \newline "value": "{[}resourceId('Microsoft.Network/publicIPAddresses', parameters('publicIPAddresses\_name')){]}" \newline \} \newline \} \newline \newline {\bf{Get output values}} \newline {\bf{PowerShell}} \newline \newline (Get-AzResourceGroupDeployment ` \newline -ResourceGroupName \textless{}resource-group-name\textgreater{} ` \newline -Name \textless{}deployment-name\textgreater{}).Outputs.resourceID.value \newline \newline {\bf{Azure CLI}} \newline \newline az deployment group show \textbackslash{} \newline -g \textless{}resource-group-name\textgreater{} \textbackslash{} \newline -n \textless{}deployment-name\textgreater{} \textbackslash{} \newline -{}-query \seqsplit{properties.outputs.resourceID.value}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Multi-line strings}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\{ \newline "type": \seqsplit{"Microsoft.Compute/virtualMachines"}, \newline "apiVersion": "2018-10-01", \newline "name": "{[}variables('vmName'){]}", // to customize name, change it in variables \newline "location": "{[} \newline parameters('location') \newline {]}", //defaults to resource group location \newline /{\emph{ \newline storage account and network interface \newline must be deployed first \newline }}/ \newline "dependsOn": {[} \newline "{[}resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName')){]}", \newline "{[}resourceId('Microsoft.Network/networkInterfaces/', variables('nicName')){]}" \newline {]},} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{You can break a string into multiple lines. For example, see the location property and one of the comments in the following JSON example.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}