SlideShare uma empresa Scribd logo
1 de 43
INFRASTRUCTURE
AS CODE
With ARM templates
Senior Cloud Advocate at Microsoft
Chris Noring
@chris_noring
Why & What
DevOps, Dev and Ops are on the same team, same processes
How we iterate has changed, Iteration = Code change + Deployment
Frequent & Accurate deploys, Need to deploy and redeploy often & accurately = we
need our infrastructure to be code, so we know exactly what is deployed
Benefit, Infra that is code can be stored in a Repo and versioned
Anyone can deploy everything, Any team member can now deploy code &
infrastructure
@chris_noring
IaaS on Azure
ARM, Azure
Resoure Manager
templates, first
class citizen
Terraform, open
format that can be
used cross cloud, a
subset is supported
on Azure
@chris_noring
Why ARM
Declarative
syntax
Repeatable
results
Orchestration Module files
Create any
Azure
resource
Extensibility Testing
Preview
changes
Built-in
validation
Tracked
deployments
Policy as
Code
Deployment
blueprints
CI/CD
integration
Exportable
code
Authoring
tools
@chris_noring
An ARM template is JSON
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-
01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"storageName": {
"type": "string",
"minLength": 3,
"maxLength": 24
},
"storageSKU": {
"type": "string",
"defaultValue": "Standard_LRS",
"allowedValues": [
"Standard_LRS",
"Standard_GRS",
"Standard_RAGRS",
"Standard_ZRS",
"Premium_LRS",
"Premium_ZRS",
"Standard_GZRS",
"Standard_RAGZRS"
]
}
},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2019-04-01",
"tags": {
"displayName": "[utils.Company(parameters('storageName'))]"
},
"name": "[parameters('storageName')]",
"location": "eastus",
"sku": {
"name": "[parameters('storageSKU')]"
},
"kind": "StorageV2",
"properties": {
"supportsHttpsTrafficOnly": true
}
}
],
"functions": [
{
"namespace": "utils",
"members": {
"Company": {
"parameters": [
{
"name": "in",
"type": "string"
}
],
@chris_noring
Send help!!
Authoring tools
@chris_noring
Anatomy of an ARM template
• Parameters
• Variables
• User-defined functions
• Resources
• Outputs
@chris_noring
Deployment
• We deploy ARM template files using (choose one)
• Powershell
• Azure CLI
@chris_noring
ARM – my first template
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": []
}
@chris_noring
Deploy the template
templateFile="azuredeploy.json"
az deployment group create 
--name blanktemplate 
--resource-group <resource group> 
--template-file $templateFile
Translated to a REST call like so:
PUT
https://management.azure.com/subscriptions/{subscription
Id}/resourceGroups/{resourceGroupName}/providers/Micr
osoft.Storage/storageAccounts/mystorageaccount?api-
version=2016-01-01
REQUEST BODY
{
"location": "westus",
"sku": {
"name": "Standard_LRS"
},
"kind": "Storage",
"properties": {}
}
This is not a match to the command
Above ( as it creates a storage account)
@chris_noring
What happens on the portal side?
• portal.azure.com , go to the resource group
@chris_noring
Deployment detail
@chris_noring
ARM – deploy a resource
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"name": "storageaccount1",
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2019-06-01",
"tags": {
"displayName": "storageaccount1"
},
"location": "eastus",
"kind": "StorageV2",
"sku": {
"name": "Premium_LRS",
"tier": "Premium"
}}]
}
@chris_noring
DEMO – add resource
@chris_noring
Deploy the template
templateFile="azure-storage-deploy.json"
az deployment group create 
--name addstorage 
--resource-group <my resource group> 
--template-file $templateFile
@chris_noring
ARM input parameters
"parameters": {
"storageName": {
"type": "string",
"defaultValue": "change-me",
"metadata": {
"description": "name for the storage account, should be called something like companyprefix-
region-storage"
}
}
}
@chris_noring
ARM, input parameters, usage
{
"name": "[parameters('storageName')]",
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2019-06-01",
"tags": {
"displayName": "[parameters('storageName')]"
},
"location": "eastus",
"kind": "StorageV2",
"sku": {
"name": "Premium_LRS",
"tier": "Premium"
}
}
@chris_noring
DEMO – add parameter
@chris_noring
Deploy template
az deployment group create 
--name addnameparameter 
--resource-group <resource group name> 
--template-file azure-parameter.json 
--parameters storageName=storageuniquename
@chris_noring
ARM parameters, allowed values
"storageSKU": {
"type": "string",
"defaultValue": "Standard_LRS",
"allowedValues": [
"Standard_LRS",
"Standard_GRS",
"Standard_RAGRS",
"Standard_ZRS",
"Premium_LRS",
"Premium_ZRS",
"Standard_GZRS",
"Standard_RAGZRS"
]
}
@chris_noring
ARM template functions
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]"
}
https://docs.microsoft.com/en-us/azure/azure-resource-
manager/templates/template-functions
@chris_noring
DEMO – add template function
@chris_noring
ARM variables
"variables": {
"uniqueStorageName":
"[concat(parameters('storagePrefix'),
uniqueString(resourceGroup().id))]”
}
concat parameters
uniqueString
resourceGroup - concat(), this takes `parameters(storagePrefix)`, this is referring to
the input parameter `storagePrefix`.
- uniqueString() Note how the `uniqueString()` method takes
`resourceGroup().id` as input. `uniqueString()` creates a 13 character
hash value.v
"resources": [
{
"name": "[variables('uniqueStorageName')]" @chris_noring
DEMO – variables
@chris_noring
ARM variables - deploying
az deployment group create 
--name addnamevariable 
--resource-group myResourceGroup 
--template-file $templateFile 
--parameters storagePrefix=store
storageSKU=Standard_LRS
@chris_noring
ARM outputs
"outputs": {
"storageEndpoint": {
"type": "object",
"value": "[reference(variables('uniqueStorageName')).primaryEndpoints]"
}
}
reference()
primaryEndpoints
@chris_noring
DEMO – outputs
@chris_noring
ARM User defined function
"functions": [
{
"namespace": "utils",
"members": {
"Company": {
"parameters": [
{
"name": "in",
"type": "string"
}],
"output": {
"type": "string",
"value": "[concat('My Company-', parameters('in'))]"
}
}
}
}]
@chris_noring
DEMO – user defined function
@chris_noring
ARM Template viewer extension
It’s able to take a JSON file and show what we are about to deploy visually
@chris_noring
ARM template viewer @chris_noring
http://armviz.io/
Where do I start
• Author templates using VS Code, extensions and snippets
• Existing infra, Get the ARM templates of existing infra
• Strategy, how do I want to deploy: Think about deployment
strategy for example
• Master template and linked templates
• Deploy by “product”
• Whatever strategy suits you company
@chris_noring
Exported template
JSON template that we can copy
@chris_noring
Learn more
• Introduction https://docs.microsoft.com/en-us/azure/azure-resource-
manager/templates/
• Tutorial, https://docs.microsoft.com/en-us/azure/azure-resource-
manager/templates/template-tutorial-create-first-template?tabs=azure-cli
• Template functions, https://docs.microsoft.com/en-us/azure/azure-
resource-manager/templates/template-functions
• Linked templates, https://docs.microsoft.com/en-us/azure/azure-resource-
manager/templates/linked-templates
• Testing your template, https://github.com/Azure/arm-ttk
• What-If, What if function
• Policy as Code, https://docs.microsoft.com/en-
us/azure/governance/policy/overview
Summary
• We need to deploy infrastructure with our app code
• IaaS, infrastructure as Code
• ARM and Terraform are supported on Azure
• You can deploy ARM templates with Powershell or Azure CLI
• Author ARM templates with VS Code or VS, please use the
extensions – it will make your life easier
Feedback – we want to hear from you
• https://aka.ms/Reactor/Survey, event code is 7594"

Mais conteúdo relacionado

Mais procurados

Azure Days 2019: Infrastructure as Code auf Azure (Jonas Wanninger & Daniel H...
Azure Days 2019: Infrastructure as Code auf Azure (Jonas Wanninger & Daniel H...Azure Days 2019: Infrastructure as Code auf Azure (Jonas Wanninger & Daniel H...
Azure Days 2019: Infrastructure as Code auf Azure (Jonas Wanninger & Daniel H...Trivadis
 
Shift Remote AI: Build and deploy PyTorch Models with Azure Machine Learning ...
Shift Remote AI: Build and deploy PyTorch Models with Azure Machine Learning ...Shift Remote AI: Build and deploy PyTorch Models with Azure Machine Learning ...
Shift Remote AI: Build and deploy PyTorch Models with Azure Machine Learning ...Shift Conference
 
Deploy Microservices To Kubernetes Without Secrets by Reenu Saluja
Deploy Microservices To Kubernetes Without Secrets by Reenu SalujaDeploy Microservices To Kubernetes Without Secrets by Reenu Saluja
Deploy Microservices To Kubernetes Without Secrets by Reenu SalujaCodeOps Technologies LLP
 
Go Serverless with Java and Azure Functions
Go Serverless with Java and Azure FunctionsGo Serverless with Java and Azure Functions
Go Serverless with Java and Azure FunctionsCodeOps Technologies LLP
 
Leading Edge of Modern Web Apps on Azure - Menaka - CCDays
Leading Edge of Modern Web Apps on Azure - Menaka - CCDaysLeading Edge of Modern Web Apps on Azure - Menaka - CCDays
Leading Edge of Modern Web Apps on Azure - Menaka - CCDaysCodeOps Technologies LLP
 
Serverless in Azure with Functions
Serverless in Azure with FunctionsServerless in Azure with Functions
Serverless in Azure with FunctionsChristos Matskas
 
Improve monitoring and observability for kubernetes with oss tools
Improve monitoring and observability for kubernetes with oss toolsImprove monitoring and observability for kubernetes with oss tools
Improve monitoring and observability for kubernetes with oss toolsNilesh Gule
 
Monitor Azure Kubernetes Cluster With Prometheus by Mamta Jha
Monitor Azure Kubernetes Cluster With Prometheus by Mamta JhaMonitor Azure Kubernetes Cluster With Prometheus by Mamta Jha
Monitor Azure Kubernetes Cluster With Prometheus by Mamta JhaCodeOps Technologies LLP
 
ASP.NET Core deployment options
ASP.NET Core deployment optionsASP.NET Core deployment options
ASP.NET Core deployment optionsKen Cenerelli
 
Step by Step to learn Azure and get MCSE
Step by Step to learn Azure and get MCSEStep by Step to learn Azure and get MCSE
Step by Step to learn Azure and get MCSEThi Nguyen Dinh
 
Azure Service Fabric - Hamida Rebai - CCDays
Azure Service Fabric - Hamida Rebai - CCDaysAzure Service Fabric - Hamida Rebai - CCDays
Azure Service Fabric - Hamida Rebai - CCDaysCodeOps Technologies LLP
 
Going Serverless with Azure Functions
Going Serverless with Azure FunctionsGoing Serverless with Azure Functions
Going Serverless with Azure FunctionsChristos Matskas
 
Understanding Azure Batch Service - Niloshima - CCDays
Understanding Azure Batch Service - Niloshima - CCDays Understanding Azure Batch Service - Niloshima - CCDays
Understanding Azure Batch Service - Niloshima - CCDays CodeOps Technologies LLP
 
Azure serverless Full-Stack kickstart
Azure serverless Full-Stack kickstartAzure serverless Full-Stack kickstart
Azure serverless Full-Stack kickstartDavide Mauri
 
Azure DevOps Multistage YAML Pipelines – Top 10 Features
Azure DevOps Multistage YAML Pipelines – Top 10 FeaturesAzure DevOps Multistage YAML Pipelines – Top 10 Features
Azure DevOps Multistage YAML Pipelines – Top 10 FeaturesMarc Müller
 
Athena & Step Function 으로 통계 파이프라인 구축하기 - 변규현 (당근마켓) :: AWS Community Day Onl...
Athena & Step Function 으로 통계 파이프라인 구축하기 - 변규현 (당근마켓) :: AWS Community Day Onl...Athena & Step Function 으로 통계 파이프라인 구축하기 - 변규현 (당근마켓) :: AWS Community Day Onl...
Athena & Step Function 으로 통계 파이프라인 구축하기 - 변규현 (당근마켓) :: AWS Community Day Onl...AWSKRUG - AWS한국사용자모임
 

Mais procurados (20)

Azure Days 2019: Infrastructure as Code auf Azure (Jonas Wanninger & Daniel H...
Azure Days 2019: Infrastructure as Code auf Azure (Jonas Wanninger & Daniel H...Azure Days 2019: Infrastructure as Code auf Azure (Jonas Wanninger & Daniel H...
Azure Days 2019: Infrastructure as Code auf Azure (Jonas Wanninger & Daniel H...
 
Shift Remote AI: Build and deploy PyTorch Models with Azure Machine Learning ...
Shift Remote AI: Build and deploy PyTorch Models with Azure Machine Learning ...Shift Remote AI: Build and deploy PyTorch Models with Azure Machine Learning ...
Shift Remote AI: Build and deploy PyTorch Models with Azure Machine Learning ...
 
Deploy Microservices To Kubernetes Without Secrets by Reenu Saluja
Deploy Microservices To Kubernetes Without Secrets by Reenu SalujaDeploy Microservices To Kubernetes Without Secrets by Reenu Saluja
Deploy Microservices To Kubernetes Without Secrets by Reenu Saluja
 
Go Serverless with Java and Azure Functions
Go Serverless with Java and Azure FunctionsGo Serverless with Java and Azure Functions
Go Serverless with Java and Azure Functions
 
Leading Edge of Modern Web Apps on Azure - Menaka - CCDays
Leading Edge of Modern Web Apps on Azure - Menaka - CCDaysLeading Edge of Modern Web Apps on Azure - Menaka - CCDays
Leading Edge of Modern Web Apps on Azure - Menaka - CCDays
 
Serverless in Azure with Functions
Serverless in Azure with FunctionsServerless in Azure with Functions
Serverless in Azure with Functions
 
Improve monitoring and observability for kubernetes with oss tools
Improve monitoring and observability for kubernetes with oss toolsImprove monitoring and observability for kubernetes with oss tools
Improve monitoring and observability for kubernetes with oss tools
 
Monitor Azure Kubernetes Cluster With Prometheus by Mamta Jha
Monitor Azure Kubernetes Cluster With Prometheus by Mamta JhaMonitor Azure Kubernetes Cluster With Prometheus by Mamta Jha
Monitor Azure Kubernetes Cluster With Prometheus by Mamta Jha
 
Java & Microservices in Azure
Java & Microservices in AzureJava & Microservices in Azure
Java & Microservices in Azure
 
ASP.NET Core deployment options
ASP.NET Core deployment optionsASP.NET Core deployment options
ASP.NET Core deployment options
 
Step by Step to learn Azure and get MCSE
Step by Step to learn Azure and get MCSEStep by Step to learn Azure and get MCSE
Step by Step to learn Azure and get MCSE
 
SERVERLESS MIDDLEWARE IN AZURE FUNCTIONS
SERVERLESS MIDDLEWARE IN AZURE FUNCTIONSSERVERLESS MIDDLEWARE IN AZURE FUNCTIONS
SERVERLESS MIDDLEWARE IN AZURE FUNCTIONS
 
Azure Service Fabric - Hamida Rebai - CCDays
Azure Service Fabric - Hamida Rebai - CCDaysAzure Service Fabric - Hamida Rebai - CCDays
Azure Service Fabric - Hamida Rebai - CCDays
 
Going Serverless with Azure Functions
Going Serverless with Azure FunctionsGoing Serverless with Azure Functions
Going Serverless with Azure Functions
 
Understanding Azure Batch Service - Niloshima - CCDays
Understanding Azure Batch Service - Niloshima - CCDays Understanding Azure Batch Service - Niloshima - CCDays
Understanding Azure Batch Service - Niloshima - CCDays
 
Azure serverless Full-Stack kickstart
Azure serverless Full-Stack kickstartAzure serverless Full-Stack kickstart
Azure serverless Full-Stack kickstart
 
Azure DevOps Multistage YAML Pipelines – Top 10 Features
Azure DevOps Multistage YAML Pipelines – Top 10 FeaturesAzure DevOps Multistage YAML Pipelines – Top 10 Features
Azure DevOps Multistage YAML Pipelines – Top 10 Features
 
Athena & Step Function 으로 통계 파이프라인 구축하기 - 변규현 (당근마켓) :: AWS Community Day Onl...
Athena & Step Function 으로 통계 파이프라인 구축하기 - 변규현 (당근마켓) :: AWS Community Day Onl...Athena & Step Function 으로 통계 파이프라인 구축하기 - 변규현 (당근마켓) :: AWS Community Day Onl...
Athena & Step Function 으로 통계 파이프라인 구축하기 - 변규현 (당근마켓) :: AWS Community Day Onl...
 
Azure Functions
Azure FunctionsAzure Functions
Azure Functions
 
Serverless in action
Serverless in actionServerless in action
Serverless in action
 

Semelhante a IaaS with ARM templates for Azure

CCI2018 - Automatizzare la creazione di risorse con ARM template e PowerShell
CCI2018 - Automatizzare la creazione di risorse con ARM template e PowerShellCCI2018 - Automatizzare la creazione di risorse con ARM template e PowerShell
CCI2018 - Automatizzare la creazione di risorse con ARM template e PowerShellwalk2talk srl
 
Azure Day Reloaded 2019 - ARM Template workshop
Azure Day Reloaded 2019 - ARM Template workshopAzure Day Reloaded 2019 - ARM Template workshop
Azure Day Reloaded 2019 - ARM Template workshopMarco Obinu
 
Azure Resource Manager - Technical Primer
Azure Resource Manager - Technical PrimerAzure Resource Manager - Technical Primer
Azure Resource Manager - Technical PrimerBen Coleman
 
How Intuit Leveraged AWS OpsWorks as the Engine of Our PaaS (DMG305) | AWS re...
How Intuit Leveraged AWS OpsWorks as the Engine of Our PaaS (DMG305) | AWS re...How Intuit Leveraged AWS OpsWorks as the Engine of Our PaaS (DMG305) | AWS re...
How Intuit Leveraged AWS OpsWorks as the Engine of Our PaaS (DMG305) | AWS re...Amazon Web Services
 
Azure Resource Manager templates: Improve deployment time and reusability
Azure Resource Manager templates: Improve deployment time and reusabilityAzure Resource Manager templates: Improve deployment time and reusability
Azure Resource Manager templates: Improve deployment time and reusabilityStephane Lapointe
 
Rik Hepworth - ARM Yourself for Effective Azure Provisioning
Rik Hepworth - ARM Yourself for Effective Azure ProvisioningRik Hepworth - ARM Yourself for Effective Azure Provisioning
Rik Hepworth - ARM Yourself for Effective Azure ProvisioningWinOps Conf
 
Zero to Sixty: AWS CloudFormation (DMG201) | AWS re:Invent 2013
Zero to Sixty: AWS CloudFormation (DMG201) | AWS re:Invent 2013Zero to Sixty: AWS CloudFormation (DMG201) | AWS re:Invent 2013
Zero to Sixty: AWS CloudFormation (DMG201) | AWS re:Invent 2013Amazon Web Services
 
Improving Infrastructure Governance on AWS by Henrik Johansson, Solutions Ar...
 Improving Infrastructure Governance on AWS by Henrik Johansson, Solutions Ar... Improving Infrastructure Governance on AWS by Henrik Johansson, Solutions Ar...
Improving Infrastructure Governance on AWS by Henrik Johansson, Solutions Ar...Amazon Web Services
 
Iac :: Lessons Learned from Dev to Ops
Iac :: Lessons Learned from Dev to OpsIac :: Lessons Learned from Dev to Ops
Iac :: Lessons Learned from Dev to OpsEmma Button
 
Improving Infrastructure Governance on AWS - AWS June 2016 Webinar Series
Improving Infrastructure Governance on AWS - AWS June 2016 Webinar SeriesImproving Infrastructure Governance on AWS - AWS June 2016 Webinar Series
Improving Infrastructure Governance on AWS - AWS June 2016 Webinar SeriesAmazon Web Services
 
Improving Infrastructure Governance on AWS
Improving Infrastructure Governance on AWSImproving Infrastructure Governance on AWS
Improving Infrastructure Governance on AWSAmazon Web Services
 
Automating your Infrastructure Deployment with AWS CloudFormation and AWS Ops...
Automating your Infrastructure Deployment with AWS CloudFormation and AWS Ops...Automating your Infrastructure Deployment with AWS CloudFormation and AWS Ops...
Automating your Infrastructure Deployment with AWS CloudFormation and AWS Ops...Amazon Web Services
 
AWS re:Invent 2016: Chalk Talk: Succeeding at Infrastructure-as-Code (GPSCT312)
AWS re:Invent 2016: Chalk Talk: Succeeding at Infrastructure-as-Code (GPSCT312)AWS re:Invent 2016: Chalk Talk: Succeeding at Infrastructure-as-Code (GPSCT312)
AWS re:Invent 2016: Chalk Talk: Succeeding at Infrastructure-as-Code (GPSCT312)Amazon Web Services
 
Deep Dive - Infrastructure as Code
Deep Dive - Infrastructure as CodeDeep Dive - Infrastructure as Code
Deep Dive - Infrastructure as CodeAmazon Web Services
 
Dev & Test on AWS - Hebrew Webinar
Dev & Test on AWS - Hebrew WebinarDev & Test on AWS - Hebrew Webinar
Dev & Test on AWS - Hebrew WebinarBoaz Ziniman
 
Azure for SharePoint Developers - Workshop - Part 3: Web Services
Azure for SharePoint Developers - Workshop - Part 3: Web ServicesAzure for SharePoint Developers - Workshop - Part 3: Web Services
Azure for SharePoint Developers - Workshop - Part 3: Web ServicesBob German
 
Dev & Test on AWS Webinar October 2017 - IL Webinar
Dev & Test on AWS Webinar October 2017 - IL WebinarDev & Test on AWS Webinar October 2017 - IL Webinar
Dev & Test on AWS Webinar October 2017 - IL WebinarAmazon Web Services
 

Semelhante a IaaS with ARM templates for Azure (20)

CCI2018 - Automatizzare la creazione di risorse con ARM template e PowerShell
CCI2018 - Automatizzare la creazione di risorse con ARM template e PowerShellCCI2018 - Automatizzare la creazione di risorse con ARM template e PowerShell
CCI2018 - Automatizzare la creazione di risorse con ARM template e PowerShell
 
Azure arm templates
Azure arm templatesAzure arm templates
Azure arm templates
 
Azure Day Reloaded 2019 - ARM Template workshop
Azure Day Reloaded 2019 - ARM Template workshopAzure Day Reloaded 2019 - ARM Template workshop
Azure Day Reloaded 2019 - ARM Template workshop
 
Azure ARM Template
Azure ARM TemplateAzure ARM Template
Azure ARM Template
 
Azure Resource Manager - Technical Primer
Azure Resource Manager - Technical PrimerAzure Resource Manager - Technical Primer
Azure Resource Manager - Technical Primer
 
How Intuit Leveraged AWS OpsWorks as the Engine of Our PaaS (DMG305) | AWS re...
How Intuit Leveraged AWS OpsWorks as the Engine of Our PaaS (DMG305) | AWS re...How Intuit Leveraged AWS OpsWorks as the Engine of Our PaaS (DMG305) | AWS re...
How Intuit Leveraged AWS OpsWorks as the Engine of Our PaaS (DMG305) | AWS re...
 
Azure Resource Manager templates: Improve deployment time and reusability
Azure Resource Manager templates: Improve deployment time and reusabilityAzure Resource Manager templates: Improve deployment time and reusability
Azure Resource Manager templates: Improve deployment time and reusability
 
Rik Hepworth - ARM Yourself for Effective Azure Provisioning
Rik Hepworth - ARM Yourself for Effective Azure ProvisioningRik Hepworth - ARM Yourself for Effective Azure Provisioning
Rik Hepworth - ARM Yourself for Effective Azure Provisioning
 
Infrastructure as Code
Infrastructure as CodeInfrastructure as Code
Infrastructure as Code
 
Zero to Sixty: AWS CloudFormation (DMG201) | AWS re:Invent 2013
Zero to Sixty: AWS CloudFormation (DMG201) | AWS re:Invent 2013Zero to Sixty: AWS CloudFormation (DMG201) | AWS re:Invent 2013
Zero to Sixty: AWS CloudFormation (DMG201) | AWS re:Invent 2013
 
Improving Infrastructure Governance on AWS by Henrik Johansson, Solutions Ar...
 Improving Infrastructure Governance on AWS by Henrik Johansson, Solutions Ar... Improving Infrastructure Governance on AWS by Henrik Johansson, Solutions Ar...
Improving Infrastructure Governance on AWS by Henrik Johansson, Solutions Ar...
 
Iac :: Lessons Learned from Dev to Ops
Iac :: Lessons Learned from Dev to OpsIac :: Lessons Learned from Dev to Ops
Iac :: Lessons Learned from Dev to Ops
 
Improving Infrastructure Governance on AWS - AWS June 2016 Webinar Series
Improving Infrastructure Governance on AWS - AWS June 2016 Webinar SeriesImproving Infrastructure Governance on AWS - AWS June 2016 Webinar Series
Improving Infrastructure Governance on AWS - AWS June 2016 Webinar Series
 
Improving Infrastructure Governance on AWS
Improving Infrastructure Governance on AWSImproving Infrastructure Governance on AWS
Improving Infrastructure Governance on AWS
 
Automating your Infrastructure Deployment with AWS CloudFormation and AWS Ops...
Automating your Infrastructure Deployment with AWS CloudFormation and AWS Ops...Automating your Infrastructure Deployment with AWS CloudFormation and AWS Ops...
Automating your Infrastructure Deployment with AWS CloudFormation and AWS Ops...
 
AWS re:Invent 2016: Chalk Talk: Succeeding at Infrastructure-as-Code (GPSCT312)
AWS re:Invent 2016: Chalk Talk: Succeeding at Infrastructure-as-Code (GPSCT312)AWS re:Invent 2016: Chalk Talk: Succeeding at Infrastructure-as-Code (GPSCT312)
AWS re:Invent 2016: Chalk Talk: Succeeding at Infrastructure-as-Code (GPSCT312)
 
Deep Dive - Infrastructure as Code
Deep Dive - Infrastructure as CodeDeep Dive - Infrastructure as Code
Deep Dive - Infrastructure as Code
 
Dev & Test on AWS - Hebrew Webinar
Dev & Test on AWS - Hebrew WebinarDev & Test on AWS - Hebrew Webinar
Dev & Test on AWS - Hebrew Webinar
 
Azure for SharePoint Developers - Workshop - Part 3: Web Services
Azure for SharePoint Developers - Workshop - Part 3: Web ServicesAzure for SharePoint Developers - Workshop - Part 3: Web Services
Azure for SharePoint Developers - Workshop - Part 3: Web Services
 
Dev & Test on AWS Webinar October 2017 - IL Webinar
Dev & Test on AWS Webinar October 2017 - IL WebinarDev & Test on AWS Webinar October 2017 - IL Webinar
Dev & Test on AWS Webinar October 2017 - IL Webinar
 

Mais de Christoffer Noring (20)

Azure signalR
Azure signalRAzure signalR
Azure signalR
 
Game dev 101 part 3
Game dev 101 part 3Game dev 101 part 3
Game dev 101 part 3
 
Game dev 101 part 2
Game dev 101   part 2Game dev 101   part 2
Game dev 101 part 2
 
Game dev workshop
Game dev workshopGame dev workshop
Game dev workshop
 
Deploying your static web app to the Cloud
Deploying your static web app to the CloudDeploying your static web app to the Cloud
Deploying your static web app to the Cloud
 
Learning Svelte
Learning SvelteLearning Svelte
Learning Svelte
 
Ng spain
Ng spainNg spain
Ng spain
 
Angular Schematics
Angular SchematicsAngular Schematics
Angular Schematics
 
Design thinking
Design thinkingDesign thinking
Design thinking
 
Keynote ijs
Keynote ijsKeynote ijs
Keynote ijs
 
Vue fundamentasl with Testing and Vuex
Vue fundamentasl with Testing and VuexVue fundamentasl with Testing and Vuex
Vue fundamentasl with Testing and Vuex
 
Ngrx slides
Ngrx slidesNgrx slides
Ngrx slides
 
Kendoui
KendouiKendoui
Kendoui
 
Angular mix chrisnoring
Angular mix chrisnoringAngular mix chrisnoring
Angular mix chrisnoring
 
Nativescript angular
Nativescript angularNativescript angular
Nativescript angular
 
Graphql, REST and Apollo
Graphql, REST and ApolloGraphql, REST and Apollo
Graphql, REST and Apollo
 
Angular 2 introduction
Angular 2 introductionAngular 2 introduction
Angular 2 introduction
 
Rxjs vienna
Rxjs viennaRxjs vienna
Rxjs vienna
 
Rxjs marble-testing
Rxjs marble-testingRxjs marble-testing
Rxjs marble-testing
 
React lecture
React lectureReact lecture
React lecture
 

Último

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 

Último (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 

IaaS with ARM templates for Azure

  • 1. INFRASTRUCTURE AS CODE With ARM templates Senior Cloud Advocate at Microsoft Chris Noring @chris_noring
  • 2. Why & What DevOps, Dev and Ops are on the same team, same processes How we iterate has changed, Iteration = Code change + Deployment Frequent & Accurate deploys, Need to deploy and redeploy often & accurately = we need our infrastructure to be code, so we know exactly what is deployed Benefit, Infra that is code can be stored in a Repo and versioned Anyone can deploy everything, Any team member can now deploy code & infrastructure @chris_noring
  • 3. IaaS on Azure ARM, Azure Resoure Manager templates, first class citizen Terraform, open format that can be used cross cloud, a subset is supported on Azure @chris_noring
  • 4. Why ARM Declarative syntax Repeatable results Orchestration Module files Create any Azure resource Extensibility Testing Preview changes Built-in validation Tracked deployments Policy as Code Deployment blueprints CI/CD integration Exportable code Authoring tools @chris_noring
  • 5. An ARM template is JSON { "$schema": "https://schema.management.azure.com/schemas/2019-04- 01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "storageName": { "type": "string", "minLength": 3, "maxLength": 24 }, "storageSKU": { "type": "string", "defaultValue": "Standard_LRS", "allowedValues": [ "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", "Standard_GZRS", "Standard_RAGZRS" ] } }, "resources": [ { "type": "Microsoft.Storage/storageAccounts", "apiVersion": "2019-04-01", "tags": { "displayName": "[utils.Company(parameters('storageName'))]" }, "name": "[parameters('storageName')]", "location": "eastus", "sku": { "name": "[parameters('storageSKU')]" }, "kind": "StorageV2", "properties": { "supportsHttpsTrafficOnly": true } } ], "functions": [ { "namespace": "utils", "members": { "Company": { "parameters": [ { "name": "in", "type": "string" } ], @chris_noring Send help!!
  • 7. Anatomy of an ARM template • Parameters • Variables • User-defined functions • Resources • Outputs @chris_noring
  • 8. Deployment • We deploy ARM template files using (choose one) • Powershell • Azure CLI @chris_noring
  • 9. ARM – my first template { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "resources": [] } @chris_noring
  • 10. Deploy the template templateFile="azuredeploy.json" az deployment group create --name blanktemplate --resource-group <resource group> --template-file $templateFile Translated to a REST call like so: PUT https://management.azure.com/subscriptions/{subscription Id}/resourceGroups/{resourceGroupName}/providers/Micr osoft.Storage/storageAccounts/mystorageaccount?api- version=2016-01-01 REQUEST BODY { "location": "westus", "sku": { "name": "Standard_LRS" }, "kind": "Storage", "properties": {} } This is not a match to the command Above ( as it creates a storage account) @chris_noring
  • 11. What happens on the portal side? • portal.azure.com , go to the resource group @chris_noring
  • 13. ARM – deploy a resource { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "resources": [ { "name": "storageaccount1", "type": "Microsoft.Storage/storageAccounts", "apiVersion": "2019-06-01", "tags": { "displayName": "storageaccount1" }, "location": "eastus", "kind": "StorageV2", "sku": { "name": "Premium_LRS", "tier": "Premium" }}] } @chris_noring
  • 14. DEMO – add resource @chris_noring
  • 15.
  • 16. Deploy the template templateFile="azure-storage-deploy.json" az deployment group create --name addstorage --resource-group <my resource group> --template-file $templateFile @chris_noring
  • 17. ARM input parameters "parameters": { "storageName": { "type": "string", "defaultValue": "change-me", "metadata": { "description": "name for the storage account, should be called something like companyprefix- region-storage" } } } @chris_noring
  • 18. ARM, input parameters, usage { "name": "[parameters('storageName')]", "type": "Microsoft.Storage/storageAccounts", "apiVersion": "2019-06-01", "tags": { "displayName": "[parameters('storageName')]" }, "location": "eastus", "kind": "StorageV2", "sku": { "name": "Premium_LRS", "tier": "Premium" } } @chris_noring
  • 19. DEMO – add parameter @chris_noring
  • 20.
  • 21. Deploy template az deployment group create --name addnameparameter --resource-group <resource group name> --template-file azure-parameter.json --parameters storageName=storageuniquename @chris_noring
  • 22. ARM parameters, allowed values "storageSKU": { "type": "string", "defaultValue": "Standard_LRS", "allowedValues": [ "Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", "Standard_GZRS", "Standard_RAGZRS" ] } @chris_noring
  • 23. ARM template functions "location": { "type": "string", "defaultValue": "[resourceGroup().location]" } https://docs.microsoft.com/en-us/azure/azure-resource- manager/templates/template-functions @chris_noring
  • 24. DEMO – add template function @chris_noring
  • 25.
  • 26. ARM variables "variables": { "uniqueStorageName": "[concat(parameters('storagePrefix'), uniqueString(resourceGroup().id))]” } concat parameters uniqueString resourceGroup - concat(), this takes `parameters(storagePrefix)`, this is referring to the input parameter `storagePrefix`. - uniqueString() Note how the `uniqueString()` method takes `resourceGroup().id` as input. `uniqueString()` creates a 13 character hash value.v "resources": [ { "name": "[variables('uniqueStorageName')]" @chris_noring
  • 28.
  • 29. ARM variables - deploying az deployment group create --name addnamevariable --resource-group myResourceGroup --template-file $templateFile --parameters storagePrefix=store storageSKU=Standard_LRS @chris_noring
  • 30. ARM outputs "outputs": { "storageEndpoint": { "type": "object", "value": "[reference(variables('uniqueStorageName')).primaryEndpoints]" } } reference() primaryEndpoints @chris_noring
  • 32.
  • 33. ARM User defined function "functions": [ { "namespace": "utils", "members": { "Company": { "parameters": [ { "name": "in", "type": "string" }], "output": { "type": "string", "value": "[concat('My Company-', parameters('in'))]" } } } }] @chris_noring
  • 34. DEMO – user defined function @chris_noring
  • 35.
  • 36. ARM Template viewer extension It’s able to take a JSON file and show what we are about to deploy visually @chris_noring
  • 37. ARM template viewer @chris_noring
  • 39. Where do I start • Author templates using VS Code, extensions and snippets • Existing infra, Get the ARM templates of existing infra • Strategy, how do I want to deploy: Think about deployment strategy for example • Master template and linked templates • Deploy by “product” • Whatever strategy suits you company @chris_noring
  • 40. Exported template JSON template that we can copy @chris_noring
  • 41. Learn more • Introduction https://docs.microsoft.com/en-us/azure/azure-resource- manager/templates/ • Tutorial, https://docs.microsoft.com/en-us/azure/azure-resource- manager/templates/template-tutorial-create-first-template?tabs=azure-cli • Template functions, https://docs.microsoft.com/en-us/azure/azure- resource-manager/templates/template-functions • Linked templates, https://docs.microsoft.com/en-us/azure/azure-resource- manager/templates/linked-templates • Testing your template, https://github.com/Azure/arm-ttk • What-If, What if function • Policy as Code, https://docs.microsoft.com/en- us/azure/governance/policy/overview
  • 42. Summary • We need to deploy infrastructure with our app code • IaaS, infrastructure as Code • ARM and Terraform are supported on Azure • You can deploy ARM templates with Powershell or Azure CLI • Author ARM templates with VS Code or VS, please use the extensions – it will make your life easier
  • 43. Feedback – we want to hear from you • https://aka.ms/Reactor/Survey, event code is 7594"

Notas do Editor

  1. Declarative syntax, ARM templates allow you to create and deploy an entire Azure infrastructure declaratively. For example, you can deploy not only *virtual machines*, but also the *network infrastructure*, *storage systems* and any other resources you may need. In short you specify what you want and Azure provides it for you. Repeatable results, Repeatedly deploy your infrastructure throughout the *development lifecycle* and have confidence your resources are deployed in a consistent manner. Templates are *idempotent*, which means you can deploy the same template many times and get the same resource types in the same state. You can develop one template that represents the desired state, rather than developing lots of separate templates to represent updates. Orchestration, You don't have to worry about the complexities of ordering operations. Resource Manager *orchestrates* the deployment of interdependent resources so they're created in the correct order. When possible, Resource Manager deploys resources in *parallel* so your deployments finish faster than serial deployments. You deploy the template through *one command*, rather than through multiple imperative commands. Module files, You can break your templates into smaller, reusable components and *link* them together at deployment time. You can also nest one template inside another templates. Create any Azure resource, You can immediately use new Azure services and features in templates. As soon as a resource provider introduces new resources, you can deploy those resources through templates. You don't have to wait for tools or modules to be updated before using the new services. Extensibility, With *deployment scripts*, you can add PowerShell or Bash scripts to your templates. The deployment scripts extend your ability to set up resources during deployment. A script can be included in the template, or stored in an external source and referenced in the template. Deployment scripts give you the ability to complete your end-to-end environment setup in a single ARM template. Testing, You can make sure your template follows recommended guidelines by testing it with the ARM template tool kit (*arm-ttk*). This test kit is a PowerShell script that you can download from GitHub. The tool kit makes it easier for you to develop expertise using the template language. > https://github.com/Azure/arm-ttk Preview changes, You can use the *what-if* operation to get a preview of changes before deploying the template. With *what-if*, you see which resources will be created, updated, or deleted, and any resource properties that will change. The *what-if* operation checks the current state of your environment and eliminates the need to manage state.https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/template-deploy-what-if?tabs=azure-powershell Built-in validation, Your template is deployed only after passing validation. Resource Manager checks the template before starting the deployment to make sure the deployment will succeed. Your deployment is less likely to stop in a half-finished state. Tracked deployments, In the Azure portal, you can review the deployment history and get information about the template deployment. You can see the template that was deployed, the parameter values passed in, and any output values. Other infrastructure as code services aren't tracked through the portal. https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/media/overview/deployment-history.png - Policy as code, Azure Policy is a policy as code framework to automate governance. If you're using Azure policies, policy remediation is done on non-compliant resources when deployed through templates. https://docs.microsoft.com/en-us/azure/governance/policy/overview Deployment blueprints, You can take advantage of Blueprints provided by Microsoft to meet regulatory and compliance standards. These blueprints include pre-built templates for various architectures. CI/CD integration, You can integrate templates into your continuous integration and continuous deployment (CI/CD) tools, which can automate your release pipelines for fast and reliable application and infrastructure updates. By using Azure DevOps and Resource Manager template task, you can use Azure Pipelines to continuously build and deploy ARM template projects. To learn more, see VS project with pipelines and Tutorial: Continuous integration of Azure Resource Manager templates with Azure Pipelines. Exportable code, You can get a template for an existing resource group by either exporting the current state of the resource group, or viewing the template used for a particular deployment. Viewing the exported template is a helpful way to learn about the template syntax. Authoring tools, You can author templates with Visual Studio Code and the template tool extension. You get intellisense, syntax highlighting, in-line help, and many other language functions. In addition to Visual Studio code, you can also use Visual Studio.
  2. Lot’s and lots of JSON. It might look unreadable How can I ever write this by hand? Good news – you don’t have to there are great extensions for Visual Studio as well as VS Code that helps us with auto completion, syntax highlighting and snippets
  3. Azure CLI, what can it do Intellisense, Name files with extension .azcli Snippets Run command in terminal & side-by-side view Mouse over Documentation Status display at the bottom Azure Resource manager Template language completion Validation Error guidance Schema and API validation, Validation against schema and api version Template outline view, for easy overview of large schemas Expression Colorization, for expressions JSON analysis and syntax validation, Analyze and validate JSON syntax Snippets Commands, e.g Insert item in JSON and outline view, right-click on `resources`
  4. Parameters, is input variables, so you can flexible templates for different environments Variables, internal variables that can aid us User-defined functions, we can define our own custom functions, there are a lot of defined functions that can help us as well Resources, this is what we deploy, like storage accounts, virtual machines, web apps, databases and more Outputs, we can have our template return a result, we might want to return things like password, endpoint URLs so we don’t have to log in to our portal and find that info or write an extra command
  5. Both Powershell and Azure CLI are well supported to use to deploy your templates. I will use azure-cli throughout this presentation. Have a look at the links at the end of this presentation where I link to a tutorial using both Powershell and Azure-CLI, you want Powershell.
  6. Schema, All templates have a schema, schema might look different depending on what you are trying to accomplish Version, They also have a version Resources, this is where the resources should be declared
  7. Specify a variable pointing to the path of where our ARM template is located Perform our command `deployment group create` - deploy to a resource group 3. Your command is translated to a HTTP request with a BODY
  8. 1. Go to portal.azure.com 2. Click deployment link on the right, It has created the deployment on the resource group We can drill into details by clicking into the link.
  9. The detail of the deployment shows Inputs, if we have an parameter inputs Outputs, if we returned anything from the ARM template Template, this is the JSOn we just deployed
  10. Let’s add a resource this time by adding an entry to the the resources Locate the `resources` array Add an entry. The `type` says we have a storageAccount Set location `eastus`, set whatever location make sense to you SKU, set whatever SKU make sense, depending on your needs. We will look at different SKUs later
  11. - Start from a template with empty resources array
  12. We want to be able to provide parameters into the template to make it flexible. We might want to reuse a value all over the template. Great if you want to reuse the template for different environments. defaultValue will be used if no valus is provided
  13. We’ve covered how you can create a first parameter and call it as part of the deployment. We can do this even better if we specify a list of allowed values Allowed values is a list of values that the parameter can assume, anything else will lead to a validation error
  14. Imagine you have a case where you want all deployed resources end up on the same location by default, how would you solve that? Answer, use a built-in template function, `resourceGroup().location`. `resourceGroup()` returns the current resource group we are deploying to. There are a lot of functions, I’ve added a link at the end of the deck so you can explore what else is there. https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/template-functions
  15. Reuse Variables simplify your templates by enabling you to write an expression once and reuse it throughout the template Tired of guessing unique names Example case - The parameter for the storage account name is hard-to-use because you have to provide a unique name. You're probably tired of guessing a unique name.
  16. We can return values from a template reference(), this a function that given a value can look up an object during runtime and give us a property, for example `primaryEndpoints` primaryEndpoints, contains the URLs we can talk to
  17. This is a big topic, there are a lots and lots of helper functions for this. The idea is to create some utility functions that can take input and produce output to suit your needs Namespace, e.g `company` Company, the name of our function Parameters, our input parameters Output, our return section but `value` is where we write our function logic.