Azure VM JSON Template

Her gecen gun biraz daha Azure Resource Manager ile hasir nesir oluyorum ve yeteneklerini biraz daha kesfediyorum.

ARM tabanli Azure altyapi yonetiminin bircok avantaji bulunuyor. En onemlisi tum altyapinizi kod/template haline getirebiliyorsunuz. Bu sayede altyapiniz icin surumleme yapabilirsiniz.

Ornegin tum altyapi icin bir onceki surume donebilmeniz mumkun. Her bir Azure bileseni sizin sablonunuz icerisinde bir resource olarak bulunuyor ve bu resourcelar arasinda dependency olusturabiliyorsunuz. Bu sayede Azure Service Fabric ilgili bileseni olusturmadan once dependencyleri olusturmaya basliyor.

Diger faydalarini ayri bloglarda inceliyor olacagim. Asagida Azure uzerinde yeni nesil (IaaS V2) sanal makine olusturmak icin gerekli olan JSON sablonunu bulabilirsiniz.

4050-2

{
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-
preview/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
 "newStorageAccountName": {
 "type": "string",
 "metadata": {
 "Description": "Unique DNS name for the storage account where the virtual
machine's disks will be placed."
 }
 },
 "adminUsername": {
 "type": "string",
 "metadata": {
 "Description": "User name for the virtual machine."
 }
 },
 "adminPassword": {
 "type": "securestring",
 "metadata": {
 "Description": "Password for the virtual machine."
 }
 },
 "dnsNameForPublicIP": {
 "type": "string",
 "metadata": {
 "Description": "Unique DNS Name for the Public IP used to access the virtual
machine."
 }
 },
 "windowsOSVersion": {
 "type": "string",
 "defaultValue": "2012-R2-Datacenter",
 "allowedValues": [ 
"2008-R2-SP1",
 "2012-Datacenter",
 "2012-R2-Datacenter",
 "Windows-Server-Technical-Preview"
 ],
 "metadata": {
 "Description": "The Windows version for the virtual machine. This will pick a
fully updated image of this given Windows version. Allowed values: 2008-R2-SP1, 2012-
Datacenter, 2012-R2-Datacenter, Windows-Server-Technical-Preview."
 }
 }
},
"variables": {
 "location": "West US",
 "imagePublisher": "MicrosoftWindowsServer",
 "imageOffer": "WindowsServer",
 "OSDiskName": "osdiskforwindowssimple",
 "nicName": "myVMNic",
 "addressPrefix": "10.0.0.0/16",
 "subnetName": "Subnet",
 "subnetPrefix": "10.0.0.0/24",
 "storageAccountType": "Standard_LRS",
 "publicIPAddressName": "myPublicIP",
 "publicIPAddressType": "Dynamic",
 "vmStorageAccountContainerName": "vhds",
 "vmName": "MyWindowsVM",
 "vmSize": "Standard_D1",
 "virtualNetworkName": "MyVNET",
 "vnetID":
"[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]",
 "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]"
}

Leave a Reply

Your email address will not be published. Required fields are marked *

38 − 32 =