Azure Resource Manager or how to create your cloud infrastructure by the power of thought Anton Boyko Microsoft Azure MVP, MCP Microsoft TE [email protected] [email protected]
Azure deployment models
Service model (aka classic)
Applica'onInsight
SqlDatabase
MobileApp
Storage WebApp
Resource model
ResourceGroup
Applica'onInsight
SqlDatabase
MobileApp
Storage WebApp
Resource group
• Groupof'ghtlycoupledresourcesthatsharealifecycle
• Containerformul'pleresources
• Resourcesexistinoneresourcegroup
• Resourcegroupscanspanregions
• Resourcegroupscanspanservices
Power of repeatability
ARMtemplatescan• Ensureidempotency• Simplifyorchestra'on• Providecross-resourceconfigura'onandupdatesupport
• IntegrateinCI/CDpipeline
ARMtemplatesare• Sourcefile,checked-in• Specifiesresourcesanddependencies(VMs,WebApps,DBs)andconnec'ons(config,LBsets)
• Input/outputwithparameters
ARM templates
• Parameters• userinputforthetemplate
• Variables• Datatobereusedinthetemplate• Nouserinput• Ex:subnetIPrange,resourcesnameswithprefixes
• Resources• Modelsalltheresourcesintheresourcegroup
• Outputs• informa'ontobesendfromtheexecu'on• Ex:DNSnameforthecreatedblog
ARM template parameters "parameters": {
"EnvironmentName": {
"type": "string",
"minLength": 1,
"maxLength": 10
},
"WebFarmSKU": {
"type": "string",
"allowedValues": [ "Standard", "Premium" ],
"defaultValue": "Standard"
},
"WebFarmWorkersCount": {
"type": "int",
"allowedValues": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ],
"defaultValue": 1
}
}
ARM template variables
"variables": {
"WebFarmName": "[concat('WebFarm-‘, parameters('EnvironmentName'), '-', uniqueString(resourceGroup().id))]",
"SqlServerName": "[toLower(concat('SqlServer-', parameters('EnvironmentName'), '-', uniqueString(resourceGroup().id)))]",
"CdnProfileName": "[concat('Cdn-', parameters('EnvironmentName'), '-', uniqueString(resourceGroup().id))]",
"StorageName": "[toLower(concat(parameters('EnvironmentName'), uniqueString(resourceGroup().id)))]"
}
ARM template resources
"resources": [{
"name": "[variables('WebFarmName')]",
"type": "Microsoft.Web/serverfarms",
"location": "[resourceGroup().location]",
"apiVersion": "2014-06-01",
"dependsOn": [],
"tags": {},
"properties": {
"name": "[variables('WebFarmName')]",
"sku": "[parameters('WebFarmSKU')]",
"workerSize": "[parameters('WebFarmWorkersSize')]",
"numberOfWorkers": "[parameters('WebFarmWorkersCount')]"
}
}]
ARM template and parameters
Template"parameters": {
…
},
"variables": {
…
},
"resources": [
…
],
"outputs": {
…
}
Parameters"parameters": {
"EnvironmentName": {
"value": "demo"
},
"SqlServerAdminLogin": {
"value": "master"
},
"SqlServerAdminPassword": {
"value": "Qwerty12!"
}
}
ARM template execuAon
Start
AppPlan
SqlServer
WebApp
SqlDB
Conn.String
AlertRule
StorageAcc.
Backuppolicy
End
Moving to ARM
• ARMtemplatecanbeextractedfromanyexis'ngresourcegroupviaexportdeploymentfunc'onality(currentlyinpreview)
• Resourceexplorercanbeusedtofindoutcurrentresourceconfigura'onhSps://resources.azure.com/
• QuickstarttemplatesonGitHubhSps://github.com/Azure/azure-quickstart-templates
• UkrainianAzureCommunitytemplatesonGitHubhSps://github.com/AzureUA/ARM-Templates
Role based access control
WriAng ARM templates
Any JSON editor
Visual Studio
Deploying ARM templates
Visual Studio
Azure PowerShell
PS C:\Users\v-anboyk>
New-AzureRmResourceGroupDeployment
-TemplateFile <path-to-template>
-TemplateParameterFile <path-to-params>
-ResourceGroupName <group-name>
-Name <deployment-name>
Azure xPlat CLI
C:\Users\v-anboyk>
azure group deployment create
--template-file <path-to-template>
--parameters-file <path-to-params>
--resource-group <group-name>
--name <deployment-name>
Azure portal
QuesAons?
AntonBoykoMicrosoYAzureUkraineCommunityFounderMicrosoYAzureMVP,MCPMicrosoYTE
[email protected]@BoykoAnthSps://facebook.com/boyko.anthSps://youtube.com/user/boykoanthSps://ua.linkedin.com/in/boykoant
Top Related