Azure ARM getting started

Click here to load reader

download Azure ARM getting started

of 64

  • date post

    13-Apr-2017
  • Category

    Documents

  • view

    59
  • download

    1

Embed Size (px)

Transcript of Azure ARM getting started

Getting started in Azure

Azure ARM getting startedHerman Keijzer PTS HMSP

2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.1/4/2017 3:48 PM1

Azure Templates can:Ensure IdempotencySimplify OrchestrationSimplify Roll-backProvide Cross-Resource Configuration and Update Support

Azure Templates are: Source file, checked-inSpecifies resources and dependencies (VMs, WebSites, DBs) and connections (config, LB sets)Parametized input/outputInstantiation of repeatable config.Configuration Resource GroupPower of Repeatability

SQL - A

Website

VirtualMachines

SQL-AWebsite[SQL CONFIG] VM (2x)

DEPENDS ON SQL

DEPENDS ON SQL

SQLCONFIG

template-drivendeclarativeidempotentmulti-servicemulti-regionextensible

Deploying with Azure Resource Manager

Why IaaS under ARM?Cloudformation CompeteComplex application templatesRole based Access ControlEnterprise grade security Tags based billing Superior cost management on the Cloud Deep Integration with Azure ServicesEx: Websites with Virtual Machines Enhanced Portal experiencesAzure Marketplace Solution templates Regional ArchitectureIncreased Subscription ScaleIncreased throttling scaleEngineering Agility for features/fixesDecoupled network modelClean separation of compute and network conceptsNetwork model resembles traditional physical devicesReduced locking semanticsMassively parallel deployment of virtual machinesEnhanced Compute Capabilities Improved SSH Experience 3 fault domains and 20 update domainsUnified Azure StackOne single model to interact with the Microsoft Cloud

Simplified Manageability of Applications on IaaSUpgrade

complexity made simplemaster template can be used to rollout upgradesimperative APIs, Client tools support to update the resources

Manageability, Auditing

operations can be tracked upto 90 daysmanagement Locks to lock down resources from deletion

Wide range of Quickstart TemplatesGithub RepoIndexed on Azure.comCommunity & Microsoft contributed

Integration of IaaS with Azure ServicesGetting Started with Azure Templates https://azure.microsoft.com/en-us/documentation/templates/

Githubhttps://github.com/Azure/azure-quickstart-templates

CacheConsistent Management LayerAzure Resource ManagerWebsiteVMSQL DBResource Provider

..Provider Contracthttps://management.azure.com/subscriptions/{{subscriptionId}}/providers?api-version={{apiVersion}}Tools?REST API

Resource Manager: Building a VM

Resource Group

Subnet

Storage

VM

VNET

Public IPstorageAccountaccountType

publicIPAddressallocationMethoddomainNameLabelvirtualNetworkaddressSpaceSubnetaddressPrefixnetworkInterfaceprivateIPAllocationMethodvirtualMachinehardwareProfileosProfilestorageProfilenetworkProfile

NIC

Templates 101The Basics

BlueR:0 G:120 B:215CyanR:0 G:188 B:242Light GrayR:210 G:210 B:210Dark BlueR:0 G:32 B:80Dark GrayR:80 G:80 B:80GrayR:115 G:115 B:115PurpleR:92 G:45 B:145OrangeR:216 G:59 B:1GreenR:16 G:124 B:16Main colorsSecondary colors (use only when necessary)Inside vs. Outside the boxARM TemplatePowerShell DSCChefPuppetCustom Script Ext (.ps1, .sh)

BlueR:0 G:120 B:215CyanR:0 G:188 B:242Light GrayR:210 G:210 B:210Dark BlueR:0 G:32 B:80Dark GrayR:80 G:80 B:80GrayR:115 G:115 B:115PurpleR:92 G:45 B:145OrangeR:216 G:59 B:1GreenR:16 G:124 B:16Main colorsSecondary colors (use only when necessary)Inside vs. Outside the boxOutside part of the templateVM, network topology, tags, RBAC, references to certs/secrets, etc.

Inside executed by template onlyConfigure server roles, configure software, deploy a website, manage services, manage local users, etc.Extensions for PowerShell DSC, Chef, Puppet, and custom scripts.

BlueR:0 G:120 B:215CyanR:0 G:188 B:242Light GrayR:210 G:210 B:210Dark BlueR:0 G:32 B:80Dark GrayR:80 G:80 B:80GrayR:115 G:115 B:115PurpleR:92 G:45 B:145OrangeR:216 G:59 B:1GreenR:16 G:124 B:16Main colorsSecondary colors (use only when necessary)ARM templates are for control things outside the VM the VM itself and resources related to the deployment.Inside installed software and overall desired state. Scripts are executed by the ARM template but arent contained within the template itself.

DSC extensions can help to control drift.12

The Basics{"$schema": "","contentVersion": "1.0.0.0","parameters":{},"variables": {},"resources": []}

BlueR:0 G:120 B:215CyanR:0 G:188 B:242Light GrayR:210 G:210 B:210Dark BlueR:0 G:32 B:80Dark GrayR:80 G:80 B:80GrayR:115 G:115 B:115PurpleR:92 G:45 B:145OrangeR:216 G:59 B:1GreenR:16 G:124 B:16Main colorsSecondary colors (use only when necessary)The Basics - Parameters{"$schema": "","contentVersion": "1.0.0.0","parameters":{ "adminUsername": { "type": "string", "minLength": 1 }, "windowsOSVersion": { "type": "string", "defaultValue": "2012-R2-Datacenter", "allowedValues": [ "2008-R2-SP1", "2012-Datacenter", "2012-R2-Datacenter" ], "metadata": { "description": "The Windows version for the VM." } }},}

BlueR:0 G:120 B:215CyanR:0 G:188 B:242Light GrayR:210 G:210 B:210Dark BlueR:0 G:32 B:80Dark GrayR:80 G:80 B:80GrayR:115 G:115 B:115PurpleR:92 G:45 B:145OrangeR:216 G:59 B:1GreenR:16 G:124 B:16Main colorsSecondary colors (use only when necessary)The Basics - Variables{"$schema": "","contentVersion": "1.0.0.0","parameters":{}"variables": { "imagePublisher": "MicrosoftWindowsServer", "subnetName": "Subnet", "virtualNetworkName": "MyVNET", "vhdStorageType": "Standard_LRS", "vhdStorageName": "[concat('vhdstorage', uniqueString(resourceGroup().id))]", "vnetId": "[resourceId('Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]", "subnetRef": "[concat(variables('vnetId'), '/subnets/', variables('subnetName'))]",},}

BlueR:0 G:120 B:215CyanR:0 G:188 B:242Light GrayR:210 G:210 B:210Dark BlueR:0 G:32 B:80Dark GrayR:80 G:80 B:80GrayR:115 G:115 B:115PurpleR:92 G:45 B:145OrangeR:216 G:59 B:1GreenR:16 G:124 B:16Main colorsSecondary colors (use only when necessary)The Basics - Resources{"$schema": "","contentVersion": "1.0.0.0","parameters":{}"variables": {}"resources": [ { "type": "Microsoft.Storage/storageAccounts", "name": "[variables('vhdStorageName')]", "apiVersion": "2015-06-15", "location": "[resourceGroup().location]", "tags": { "displayName": "StorageAccount" }, "properties": { "accountType": "[variables('vhdStorageType')]" } }, ]}

BlueR:0 G:120 B:215CyanR:0 G:188 B:242Light GrayR:210 G:210 B:210Dark BlueR:0 G:32 B:80Dark GrayR:80 G:80 B:80GrayR:115 G:115 B:115PurpleR:92 G:45 B:145OrangeR:216 G:59 B:1GreenR:16 G:124 B:16Main colorsSecondary colors (use only when necessary)DSC Extension{ "name": "DSCExt1", "type": "extensions", "location": "[resourceGroup().location]", "apiVersion": "2015-05-01-preview", "dependsOn": [ "[concat('Microsoft.Compute/virtualMachines/', parameters('vmName'))]" ], "properties": { "publisher": "Microsoft.Powershell", "type": "DSC", "typeHandlerVersion": "2.8", "settings": { "modulesUrl": "[parameters('modulesUrl')]", "configurationFunction": "ConfigureWebServer.ps1\\Main", "properties": { "MachineName": "[parameters('vmName')]", "WebDeployPackagePath": "[parameters('webdeploypkg')]", "UserName": "[parameters('adminUserName')]", "Password": "[parameters('adminPassword')]", } }, }}URL to DSC ZIPURL to WebDeploy ZIPURLs must be publically accessible (not local files)* SAS Token

BlueR:0 G:120 B:215CyanR:0 G:188 B:242Light GrayR:210 G:210 B:210Dark BlueR:0 G:32 B:80Dark GrayR:80 G:80 B:80GrayR:115 G:115 B:115PurpleR:92 G:45 B:145OrangeR:216 G:59 B:1GreenR:16 G:124 B:16Main colorsSecondary colors (use only when necessary)Template Language ExpressionsBuilding Blocks

BlueR:0 G:120 B:215CyanR:0 G:188 B:242Light GrayR:210 G:210 B:210Dark BlueR:0 G:32 B:80Dark GrayR:80 G:80 B:80GrayR:115 G:115 B:115PurpleR:92 G:45 B:145OrangeR:216 G:59 B:1GreenR:16 G:124 B:16Main colorsSecondary colors (use only when necessary)Most Commonparameters('parameterName')variables('variableName')

concat('string', 'to', 'join')

Usage"variables":{"authorizationHeader": "[concat('Basic ', base64(variables('password')))]}

BlueR:0 G:120 B:215CyanR:0 G:188 B:242Light GrayR:210 G:210 B:210Dark BlueR:0 G:32 B:80Dark GrayR:80 G:80 B:80GrayR:115 G:115 B:115PurpleR:92 G:45 B:145OrangeR:216 G:59 B:1GreenR:16 G:124 B:16Main colorsSecondary colors (use only when necessary)copyIndex()"parameters": { "numberOfInstances": { "type": "int", },"resources":[ { "apiVersion": "[variables('apiVersion')]", "type": "Microsoft.Compute/virtualMachines", "name": "[concat('myvm', copyIndex())]", "location": "[variables('location')]", "copy": { "name": "virtualMachineLoop", "count": "[parameters('numberOfInstances')]" }, "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', 'nic', copyindex())]", "[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]" ],}

Create me N of thesemyvm0myvm1.myvmN

BlueR:0 G:120 B:215CyanR:0 G:188 B:242Light GrayR:210 G:210 B:210Dark BlueR:0 G:32 B:80Dark GrayR:80 G:80 B:80GrayR:115 G:115 B:115PurpleR:92 G:45 B:145OrangeR:216 G:59 B:1GreenR:16 G:124 B:16Main colorsSecondary col