automatizzare tutto con azure resource manager
TRANSCRIPT
![Page 1: Automatizzare tutto con Azure Resource Manager](https://reader034.vdocuments.us/reader034/viewer/2022042723/58cf96a01a28ab65538b57ed/html5/thumbnails/1.jpg)
P R E S E N TA
Automatizzare tutto: le ultime novità di Azure Resource Manager e le best practiceVito Flavio Lorusso – Senior SDE - Microsoft
![Page 2: Automatizzare tutto con Azure Resource Manager](https://reader034.vdocuments.us/reader034/viewer/2022042723/58cf96a01a28ab65538b57ed/html5/thumbnails/2.jpg)
www.wpc2016.it – [email protected] - +39 02 365738.11 2
• Modello di gestione a «Risorse» di Azure
• Architettura dei Resource template
• Ciclo di vita delle applicazioni con Azure RM
Obiettivi
![Page 4: Automatizzare tutto con Azure Resource Manager](https://reader034.vdocuments.us/reader034/viewer/2022042723/58cf96a01a28ab65538b57ed/html5/thumbnails/4.jpg)
www.wpc2016.it – [email protected] - +39 02 365738.11 4
1996-2007Un giorno a casoUn’ora a caso
Io in un datacenter
![Page 5: Automatizzare tutto con Azure Resource Manager](https://reader034.vdocuments.us/reader034/viewer/2022042723/58cf96a01a28ab65538b57ed/html5/thumbnails/5.jpg)
www.wpc2016.it – [email protected] - +39 02 365738.11 5
1996-2013Un giorno a casoUn’ora a caso
Io che cerco di mettere in staging o in produzione una soluzione«non ti preoccupare, le specifiche dell’ambiente sono le stesse!»
![Page 6: Automatizzare tutto con Azure Resource Manager](https://reader034.vdocuments.us/reader034/viewer/2022042723/58cf96a01a28ab65538b57ed/html5/thumbnails/6.jpg)
www.wpc2016.it – [email protected] - +39 02 365738.11 6
Esemplare UnicoGenerazioni per ottenerloDifficilmente riparabileAltamente personalizzatoPuò tentare inutilmente di uccidere Luke Skywalker
Quanti ne vogliamo (basta pagare)Minuti per ottenerlo (dopo lo sforzo iniziale)SostituibileSufficientemente personalizzatoControllabili dalla forza
![Page 7: Automatizzare tutto con Azure Resource Manager](https://reader034.vdocuments.us/reader034/viewer/2022042723/58cf96a01a28ab65538b57ed/html5/thumbnails/7.jpg)
www.wpc2016.it – [email protected] - +39 02 365738.11 7
Azure Resource Manager
Azure Resource
Resource provider
VIRTUAL MACHINE STORAGESQLDATABASE
Resource Group
![Page 8: Automatizzare tutto con Azure Resource Manager](https://reader034.vdocuments.us/reader034/viewer/2022042723/58cf96a01a28ab65538b57ed/html5/thumbnails/8.jpg)
www.wpc2016.it – [email protected] - +39 02 365738.11 8
PowershellComandi Base
Comandi Base in Powershell
Login-AzureRmAccount$SubscriptionName = “mysubscription"Select-AzureRmSubscription -SubscriptionName $SubscriptionName
$RGName = “myresroucegroup"$location = "westeurope"$templatefile = “mytemplate.json"$templateparameters = “mytemplate.parameters.json"
# Create a Resource GroupNew-AzureRmResourceGroup -Name $RGName -Location $location # Deploy the Template to the Resource GroupNew-AzureRmResourceGroupDeployment -ResourceGroupName $RGName ` -TemplateFile $templatefile ` -TemplateParameterFile $templateparameters
![Page 9: Automatizzare tutto con Azure Resource Manager](https://reader034.vdocuments.us/reader034/viewer/2022042723/58cf96a01a28ab65538b57ed/html5/thumbnails/9.jpg)
www.wpc2016.it – [email protected] - +39 02 365738.11 9
Struttura di un template
Parameters: i parametri in ingressoVariables: variabili definite con le funzioni, utilizzabili nel templateResources: le risorse che verranno effettivamente createOutput: gli output del template stesso
![Page 10: Automatizzare tutto con Azure Resource Manager](https://reader034.vdocuments.us/reader034/viewer/2022042723/58cf96a01a28ab65538b57ed/html5/thumbnails/10.jpg)
www.wpc2016.it – [email protected] - +39 02 365738.11 10
Fornire i parametri al template
• File di Parametri
• Hashtable
![Page 11: Automatizzare tutto con Azure Resource Manager](https://reader034.vdocuments.us/reader034/viewer/2022042723/58cf96a01a28ab65538b57ed/html5/thumbnails/11.jpg)
www.wpc2016.it – [email protected] - +39 02 365738.11 11
Parametri• I parametri possono essere di 2 tipi
Tipi semplici String, secureString, int, bool
Json Objects object , secureObject, array
![Page 12: Automatizzare tutto con Azure Resource Manager](https://reader034.vdocuments.us/reader034/viewer/2022042723/58cf96a01a28ab65538b57ed/html5/thumbnails/12.jpg)
www.wpc2016.it – [email protected] - +39 02 365738.11 12
Parametri(consigli)
• Consigli sui parametri Utilizzare gli oggetti JSON per raggruppare strutture di valori
Validare i parametri in ingresso quando possibile
Ridurre i parametri al minimo
![Page 13: Automatizzare tutto con Azure Resource Manager](https://reader034.vdocuments.us/reader034/viewer/2022042723/58cf96a01a28ab65538b57ed/html5/thumbnails/13.jpg)
www.wpc2016.it – [email protected] - +39 02 365738.11 13
Variabili
Usare le variabili per semplificare la parte di scrittura delle risorse!
![Page 15: Automatizzare tutto con Azure Resource Manager](https://reader034.vdocuments.us/reader034/viewer/2022042723/58cf96a01a28ab65538b57ed/html5/thumbnails/15.jpg)
www.wpc2016.it – [email protected] - +39 02 365738.11 15
Aiuti per comporre i JSON delle risorse
• Recuperare i Resource Provider e i JSONGet-AzureRmResourceProvider –ListAvailable
• Recuperare i tipi di risorsa disponibili(Get-AzureRmResourceProvider -ProviderNamespace Microsoft.Storage).ResourceTypes
• Recuperare le versioni API disponibili((Get-AzureRmResourceProvider -ProviderNamespace Microsoft.Storage).ResourceTypes | Where-Object ResourceTypeName -eq storageAccounts).ApiVersions
• Recuperare le region dove il Resource Provider è disponibile((Get-AzureRmResourceProvider -ProviderNamespace Microsoft.Storage).ResourceTypes | Where-Object ResourceTypeName -eq storageAccounts).Locations
![Page 16: Automatizzare tutto con Azure Resource Manager](https://reader034.vdocuments.us/reader034/viewer/2022042723/58cf96a01a28ab65538b57ed/html5/thumbnails/16.jpg)
www.wpc2016.it – [email protected] - +39 02 365738.11 16
Aiuti per comporre i JSON delle risorse (Virtual Machines)
• Per le Virtual Machine bisogna specificare Publisher, Offer e SKU
Esempio da Powershell:$location = "West Europe"Get-AzureRmVMImagePublisher -Location $locationGet-AzureRmVMImageOffer -Location $location -PublisherName "OpenLogic"Get-AzureRmVMImageSku -Location $location -PublisherName "OpenLogic" -Offer "CentOS"Get-AzureRmVMImage -Location $location -PublisherName "OpenLogic" -Offer "CentOS" -Sku "7.0"
![Page 17: Automatizzare tutto con Azure Resource Manager](https://reader034.vdocuments.us/reader034/viewer/2022042723/58cf96a01a28ab65538b57ed/html5/thumbnails/17.jpg)
www.wpc2016.it – [email protected] - +39 02 365738.11 17
Output
Gli Output servono a:• Passare informazioni allo script chiamante• Passare informazioni al template chiamanteEs.: Account name e key di uno storage account da usare nelal configurazione di una web app
![Page 19: Automatizzare tutto con Azure Resource Manager](https://reader034.vdocuments.us/reader034/viewer/2022042723/58cf96a01a28ab65538b57ed/html5/thumbnails/19.jpg)
www.wpc2016.it – [email protected] - +39 02 365738.11 19
Automatizzare la personalizzazione delle VM
![Page 20: Automatizzare tutto con Azure Resource Manager](https://reader034.vdocuments.us/reader034/viewer/2022042723/58cf96a01a28ab65538b57ed/html5/thumbnails/20.jpg)
www.wpc2016.it – [email protected] - +39 02 365738.11 20
Automatizzare le VM
• WindowsPowershell DSC
• LinuxCustom Script Extension
• EntrambePuppetChefAnsible
![Page 21: Automatizzare tutto con Azure Resource Manager](https://reader034.vdocuments.us/reader034/viewer/2022042723/58cf96a01a28ab65538b57ed/html5/thumbnails/21.jpg)
www.wpc2016.it – [email protected] - +39 02 365738.11 21
Link• Link utili
Resources Explorer: https://resources.azure.com/
ARM Visualizer http://armviz.io/designer
Resource Manager Schemas https://github.com/Azure/azure-resource-manager-schema
s
Template functions https://docs.microsoft.com/en-us/azure/azure-resource-ma
nager/resource-group-template-functions Authoring templates
https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-authoring-templates
Quickstart templates https://github.com/Azure/azure-quickstart-templates/
![Page 23: Automatizzare tutto con Azure Resource Manager](https://reader034.vdocuments.us/reader034/viewer/2022042723/58cf96a01a28ab65538b57ed/html5/thumbnails/23.jpg)
www.wpc2016.it – [email protected] - +39 02 365738.11 23
Contatti OverNet Education
OverNet [email protected]. 02 365738
@overnetewww.facebook.com/OverNetEducationwww.linkedin.com/company/overnet-solutionswww.wpc2016.it