Menu
e-lo
  • Home
    • Tech
    • Inspiration and about
  • Database
    • T-SQL
    • SQL Server quick
    • SQL server docs
    • MySql quick sheet
    • Postgre
    • InfluxDB
  • Programming
    • Automating the boring stuff
    • Python 101
    • Python Docs
    • Python Logging
    • cSharp Overview
    • Powershell Latest
    • Powershell 4 lang ref
    • MS Azure PS ref
    • MS Azure CLI ref
  • Azure
    • AZ-104-MS Azure Administrator 101 quick ref
    • AZ-104 Lab
    • MS Windows virtual machines in Azure
    • MS ARM Docs
    • MS ARM Tutorial
    • MS Deployment scripts (intern/extern)
    • ARM Quickstart
    • MS ARM templates 4h
  • Az Adm
    • AD 101
    • Governance and Compliance 102
    • Administration 103
    • Virtual Networking 104
    • Storage 107 (With table (NoSQL and more))
    • Virtual Machines 108
    • Azure Virtual Machines 101
    • Monitor VM (and market)
  • Linux
    • Top CMD’s
    • Useful CMD Linux
    • ss64 Linux
    • Ubuntu
    • 30 things Ubuntu 18.04
  • Zen
    • Not thinking about anything is Zen
e-lo

ARM Template 101 MS

Posted on December 3, 2020December 30, 2020 by espenk

https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/template-syntax

Template Advantages

  • Improves the consistency, the structure, format in the template is the same regardless of tool
  • Help express deployments that are complex
  • Reduces manual errors
  • Are code, IAC, infrastructure as code, version and evolution over time
  • Reuse and link-able, small templates and combine then

Template Schema

JSON, data stored as obj in text, key=value, each key is a str where the value can be:

  • Str
  • Number
  • Bool exp
  • List of val
  • Obj (other key-val pair)
{
    "$schema": "",​
    "contentVersion": "",​
    "parameters": {},​
    "variables": {},​
    "functions": [],​
    "resources": [],​
    "outputs": {}​
}
NameRequiredDesc
schemaJepplocation of sch. that describes version of lang.
contentVersionJeppcan provide any value, i. e 1.0.0.0, next 1.0.0.1 (major/min)
parameters*NAval’s provided when deploy is done or executed to customize
variablesNAval’s used as JSON pieces to simplify exp
functionsNAUDF that are available in temp
resourcesJeppr types for deploy/update in a rg
outputsNareturn values

*parameters limit 256

Template Parameters

QuickStart Templates

https://azure.microsoft.com/en-us/resources/templates/

More 1

Functional testing

Formatting does help but it is still a single block of text that doesn’t have an actual testing framework, so testing really comes down to performing a deployment and seeing what it creates. If used as part of a wider suite of tests, then the test process should be:

Deploy to a test environment, possibly a dev/test subscription in Azure
Deploy code and application tests
Execute tests
Report results

If all the tests return ‘success’ then the template is, by definition, valid.

Basic testing

PowerShell function

Test-AzureRmResourceGroupDeployment

it will take your template, parse it and check that it is syntactically correct as well as validating that you meet requirements such as not hitting quote limits before you deploy.

Defining dependencies

Deploy resources in a specific order, dependsOn section, reference function (use an account key from a storage account which may not be known at build time)

Azure Resource Manager (ARM) Templates

More 2

Tips to take your Azure Resource Manager (ARM) template game to the next level
  • ARM templates for deploy, updating and deleting (JSON-ish)
  • Functions for dynamic temp and UDF, User Defined Functions (best for chaining built-in functions ):

https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/template-functions-resource?tabs=json

  • Nested templates, you can create a library of modules that do specific tasks, and then call these from your top-level template. This is good for reuse since often we create the same again and again.
  • Deploy:
  • Resource groups, creates your resources in a specific resource group.
  • – New-AzResourceGroupDeployment
  • Subscriptions, for creating resource groups
  • – New-AzSubscriptionDeployment
  • Management groups, deploy resources that apply to multiple subscriptions (RBAC or custom)
  • – New-AzManagementGroupDeployment
  • Deploy mode
  • Default incremental:
  • – Create any r that does not exist in the rg
  • – Update any r with new configuration if new (if required props support this)
  • – Ignore any r that is not part of the template
  • Complete:
  • – Rg will have exactly the same as the template (best for mirror of template and where no manual change is to be done!!!!)
  • Test template before deploy

More 3, IAC, Infrastructure as code

https://docs.microsoft.com/en-us/dotnet/architecture/cloud-native/infrastructure-as-code

RSS Azure

  • Azure Cost Management and Billing updates – January 2021 January 26, 2021

RSS Python

  • PEP 651: Robust Stack Overflow Handling January 18, 2021

Cloud

ARM (8) azure (23) cmd (1) Django (4) Docker (1) e-lo (2) Flask (2) Github (9) Grafana (2) Information (1) Information Retrieval (11) JAVA (1) kivy (2) Kotlin (4) linux (11) mobile (2) Natural Language Prossesing (NLP) (2) Net.Core (1) Networking and Security (2) OPC (2) PEP8 (1) Philosophy (3) Python (41) Python Networking and Security (2) Reason (2) RMQ (2) Solr (11) Sql (10) VSC (1) Warframe (2) WMVARE (4) Zabbix (7)

Recent Posts

  • 1 TODO ARM Lab 105 MS (Deployment create a pipeline)
  • 2 TODO MS ARM Template 4h
  • TODO Cryptography with Python – Caesar Cipher
  • 3 TODO Udemy AZ-104 Microsoft Azure Administrator Exam Certification (Scott Duffy)
  • ARM Lab 104 MS (Deployment and more)

Archives

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
©2021 e-lo | Powered by WordPress & Superb Themes