Post on 09-Apr-2017
Łukasz Kałużny, Cloud Architect @ ITMAGINATION, MVP: Microsoft Azurelukasz.kaluzny@itmagination.pl @kaluzaaa blog.kaluzny.pro
BUDOWANIE SZABLONÓWAZURE RESOURCE MANAGER W PRAKTYCE OD PODSTAW
CONSISTENT MANAGEMENT LAYER
AZURE RESOURCE MANAGER API
AREAS OF FOCUS
Deploy Organize Control
RESOURCE GROUP container for multiple resources resources exist in one* resource
group resource groups can span
regions resource groups can span
services
RESOURCE GROUP
*and only one
DEPLOYMENT tracks template execution created within a resource
group allows nested deployments
RESOURCE GROUP
DEPLOYING WITH AZURE RESOURCE MANAGER• template-driven• declarative• multi-service• multi-region• extensible
TOOLS• Visual Studio 2015 with Azure SDK• https://resources.azure.com/• Azure CLI• Azure PowerShell (module)
https://resources.azure.com/DEMO
SCOPES/subscriptions/{id}/resourceGroups/{name}/providers/…/
sites/{site} subscription level
resource group level
resource level
IMPERATIVE OR DECLARATIVEimperative
New-AzureVM –VM $myVM
New-AzureStorageAccount –StorageAccountName $acct
Set-AzureVNetConfig –ConfigurationPath -Path
declarative
{
"$schema": "https://../deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"variables": {},
"resources": [],
"outputs": {}
}
TEMPLATE STRUCTURE{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
},
"variables": {
},
"resources": [
],
"outputs": {
}
}
base64encode(‘stringtoencode’)
concat(‘string’,’to’,’encode’)
copyIndex(offset)
listKeys(storageAccountResourceId, apiVersion)
padLeft(stringToPad,targetLength,paddingCharacter)
parameters(‘parameterName’)
providers(namespace, resourceType)
reference(resourceId,apiVersion)
resourceGroup()
resourceId(‘namespace/resourceType', ‘resourceName’)
subscription()
variables(‘variables’)
@ a glance - template language expressions*
*Looking for examples? See these in action @ https://github.com/rjmax/ArmExamples
Visual Studio 2015 with Azure SDKDEMO
DEMO 1• New resource group azureusergroup-demo01• Deployment demo1.json from portal.azure.com• WebApp
DEMO 2• Deployment demo2.json using Azure CLI• Deployment app from GitHub
Commandsazure loginazure account set a59a6d94-0c3c-4aba-8a6b-8ac63a5f7e2fazure config mode armazure group deployment create -f "C:\Users\lukasz.kaluzny\Documents\GitHub\arm-WebAppForArmDemo\demo2.json" -g azureusergroup-demo01 -n azure -vv
DEMO 3• Deployment demo3.json using Azure PowerShell• Deployment of app.setting
CommandsLogin-AzureRmAccountSelect-AzureRmSubscription -SubscriptionId a59a6d94-0c3c-4aba-8a6b-8ac63a5f7e2f$tFile = "C:\Users\lukasz.kaluzny\Documents\GitHub\arm-WebAppForArmDemo\demo3.json"New-AzureRmResourceGroupDeployment -ResourceGroupName azureusergroup-demo01 -TemplateFile $tFile -Mode Incremental -Name demo -Verbose
DEMO 4• Deployment demo4.json• Deployment of SQL Database & connectionstrings
DEMO 5• Deployment demo5.json• Deployment of Storage Account
Deploy a template today!• https://github.com/kaluzaaa/arm-WebAppForArmDemo• https://github.com/kaluzaaa/arm-WebAppForArmDemo • Many examples available @ https://
github.com/Azure/azure-quickstart-templates • More examples available @ https://
github.com/rjmax/ArmExamples • More examples available @
http://azure.microsoft.com/en-us/documentation/templates/
• Documentation available @ http://azure.microsoft.com/en-us/documentation/articles/resource-group-overview/