Created
September 14, 2015 08:24
-
-
Save kerslake/b5e7f467c8b97d15553f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/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": "Username 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 VM. This will pick a fully patched image of this given Windows version. Allowed values: 2008-R2-SP1, 2012-Datacenter, 2012-R2-Datacenter, Windows-Server-Technical-Preview." | |
} | |
}, | |
"modulesUrl": { | |
"type": "string" | |
}, | |
"sasToken": { | |
"type": "string" | |
}, | |
"configurationFunction": { | |
"type": "string", | |
"defaultValue": "Provision-VM.ps1\\FileResourceDemo" | |
} | |
}, | |
"variables": { | |
"location": "North Europe", | |
"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_A1", | |
"virtualNetworkName": "MyVNET", | |
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]", | |
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]" | |
}, | |
"resources": [ | |
{ | |
"type": "Microsoft.Storage/storageAccounts", | |
"name": "[parameters('newStorageAccountName')]", | |
"apiVersion": "2015-05-01-preview", | |
"location": "[variables('location')]", | |
"tags": { | |
"displayName": "StorageAccount" | |
}, | |
"properties": { | |
"accountType": "[variables('storageAccountType')]" | |
} | |
}, | |
{ | |
"apiVersion": "2015-05-01-preview", | |
"type": "Microsoft.Network/publicIPAddresses", | |
"name": "[variables('publicIPAddressName')]", | |
"location": "[variables('location')]", | |
"tags": { | |
"displayName": "PublicIPAddress" | |
}, | |
"properties": { | |
"publicIPAllocationMethod": "[variables('publicIPAddressType')]", | |
"dnsSettings": { | |
"domainNameLabel": "[parameters('dnsNameForPublicIP')]" | |
} | |
} | |
}, | |
{ | |
"apiVersion": "2015-05-01-preview", | |
"type": "Microsoft.Network/virtualNetworks", | |
"name": "[variables('virtualNetworkName')]", | |
"location": "[variables('location')]", | |
"tags": { | |
"displayName": "VirtualNetwork" | |
}, | |
"properties": { | |
"addressSpace": { | |
"addressPrefixes": [ | |
"[variables('addressPrefix')]" | |
] | |
}, | |
"subnets": [ | |
{ | |
"name": "[variables('subnetName')]", | |
"properties": { | |
"addressPrefix": "[variables('subnetPrefix')]" | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"apiVersion": "2015-05-01-preview", | |
"type": "Microsoft.Network/networkInterfaces", | |
"name": "[variables('nicName')]", | |
"location": "[variables('location')]", | |
"tags": { | |
"displayName": "NetworkInterface" | |
}, | |
"dependsOn": [ | |
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]", | |
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" | |
], | |
"properties": { | |
"ipConfigurations": [ | |
{ | |
"name": "ipconfig1", | |
"properties": { | |
"privateIPAllocationMethod": "Dynamic", | |
"publicIPAddress": { | |
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]" | |
}, | |
"subnet": { | |
"id": "[variables('subnetRef')]" | |
} | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"apiVersion": "2015-05-01-preview", | |
"type": "Microsoft.Compute/virtualMachines", | |
"name": "[variables('vmName')]", | |
"location": "[variables('location')]", | |
"tags": { | |
"displayName": "VirtualMachine" | |
}, | |
"dependsOn": [ | |
"[concat('Microsoft.Storage/storageAccounts/', parameters('newStorageAccountName'))]", | |
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]" | |
], | |
"properties": { | |
"hardwareProfile": { | |
"vmSize": "[variables('vmSize')]" | |
}, | |
"osProfile": { | |
"computername": "[variables('vmName')]", | |
"adminUsername": "[parameters('adminUsername')]", | |
"adminPassword": "[parameters('adminPassword')]" | |
}, | |
"storageProfile": { | |
"imageReference": { | |
"publisher": "[variables('imagePublisher')]", | |
"offer": "[variables('imageOffer')]", | |
"sku": "[parameters('windowsOSVersion')]", | |
"version": "latest" | |
}, | |
"osDisk": { | |
"name": "osdisk", | |
"vhd": { | |
"uri": "[concat('http://',parameters('newStorageAccountName'),'.blob.core.windows.net/',variables('vmStorageAccountContainerName'),'/',variables('OSDiskName'),'.vhd')]" | |
}, | |
"caching": "ReadWrite", | |
"createOption": "FromImage" | |
} | |
}, | |
"networkProfile": { | |
"networkInterfaces": [ | |
{ | |
"id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]" | |
} | |
] | |
} | |
}, | |
"resources": [ | |
{ | |
"name": "dscExt", | |
"type": "extensions", | |
"location": "[variables('location')]", | |
"apiVersion": "2015-05-01-preview", | |
"dependsOn": [ | |
"[concat('Microsoft.Compute/virtualMachines/', variables('vmName'))]" | |
], | |
"tags": { | |
"displayName": "dscExt" | |
}, | |
"properties": { | |
"publisher": "Microsoft.Powershell", | |
"type": "DSC", | |
"typeHandlerVersion": "2.0", | |
"autoUpgradeMinorVersion": "true", | |
"settings": { | |
"modulesUrl": "[parameters('modulesUrl')]", | |
"sasToken": "[parameters('sasToken')]", | |
"configurationFunction": "[parameters('configurationFunction')]", | |
"properties": { } | |
}, | |
"protectedSettings": { } | |
} | |
} | |
] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment