Created
December 12, 2019 03:48
-
-
Save lrakai/2f621bc39cded843a2fd15c0b14b652c to your computer and use it in GitHub Desktop.
Original Template From 2017
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": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", | |
"contentVersion": "1.0.0.0", | |
"parameters": { | |
"virtualMachineName": { | |
"type": "string", | |
"defaultValue": "ca-lab-vm" | |
}, | |
"virtualMachineSize": { | |
"type": "string", | |
"defaultValue": "Standard_B2ms" | |
}, | |
"adminUsername": { | |
"type": "string", | |
"defaultValue": "student" | |
}, | |
"virtualNetworkName": { | |
"type": "string", | |
"defaultValue": "ca-lab-vnet" | |
}, | |
"networkInterfaceName": { | |
"type": "string", | |
"defaultValue": "ca-lab-vm001" | |
}, | |
"networkSecurityGroupName": { | |
"type": "string", | |
"defaultValue": "ca-lab-vm-nsg" | |
}, | |
"adminPassword": { | |
"type": "string", | |
"defaultValue": "1Cloud_Academy_Labs!" | |
}, | |
"storageAccountName": { | |
"type": "string", | |
"defaultValue": "calabdisks" | |
}, | |
"storageAccountType": { | |
"type": "string", | |
"defaultValue": "Standard_LRS" | |
}, | |
"addressPrefix": { | |
"type": "string", | |
"defaultValue": "10.0.0.0/24" | |
}, | |
"subnetName": { | |
"type": "string", | |
"defaultValue": "default" | |
}, | |
"subnetPrefix": { | |
"type": "string", | |
"defaultValue": "10.0.0.0/24" | |
}, | |
"publicIpAddressName": { | |
"type": "string", | |
"defaultValue": "ca-lab-vm-ip" | |
}, | |
"publicIpAddressType": { | |
"type": "string", | |
"defaultValue": "Dynamic" | |
} | |
}, | |
"variables": { | |
"vnetId": "[resourceId(resourceGroup().name,'Microsoft.Network/virtualNetworks', parameters('virtualNetworkName'))]", | |
"subnetRef": "[concat(variables('vnetId'), '/subnets/', parameters('subnetName'))]" | |
}, | |
"resources": [ | |
{ | |
"name": "[parameters('virtualMachineName')]", | |
"type": "Microsoft.Compute/virtualMachines", | |
"apiVersion": "2016-04-30-preview", | |
"location": "[resourceGroup().location]", | |
"dependsOn": [ | |
"[concat('Microsoft.Network/networkInterfaces/', parameters('networkInterfaceName'))]", | |
"[concat('Microsoft.Storage/storageAccounts/', toLower(replace(concat(parameters('storageAccountName'), resourceGroup().name),'-', '')))]" | |
], | |
"properties": { | |
"osProfile": { | |
"computerName": "[parameters('virtualMachineName')]", | |
"adminUsername": "[parameters('adminUsername')]", | |
"adminPassword": "[parameters('adminPassword')]", | |
"windowsConfiguration": { | |
"provisionVmAgent": "true" | |
} | |
}, | |
"hardwareProfile": { | |
"vmSize": "[parameters('virtualMachineSize')]" | |
}, | |
"storageProfile": { | |
"imageReference": { | |
"publisher": "MicrosoftWindowsServer", | |
"offer": "WindowsServer", | |
"sku": "2016-Datacenter", | |
"version": "latest" | |
}, | |
"osDisk": { | |
"createOption": "fromImage", | |
"vhd": { | |
"uri": "[concat(concat(reference(resourceId('Microsoft.Storage/storageAccounts', toLower(replace(concat(parameters('storageAccountName'), resourceGroup().name),'-', ''))), '2015-06-15').primaryEndpoints['blob'], 'vhds/'), parameters('virtualMachineName'), '20170610002357.vhd')]" | |
}, | |
"name": "[parameters('virtualMachineName')]" | |
}, | |
"dataDisks": [] | |
}, | |
"networkProfile": { | |
"networkInterfaces": [ | |
{ | |
"id": "[resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaceName'))]" | |
} | |
] | |
} | |
}, | |
"resources": [ | |
{ | |
"apiVersion": "2015-06-15", | |
"type": "extensions", | |
"name": "provision", | |
"location": "[resourceGroup().location]", | |
"dependsOn": [ | |
"[concat('Microsoft.Compute/virtualMachines/', parameters('virtualMachineName'))]" | |
], | |
"tags": { | |
"displayName": "provision-vm" | |
}, | |
"properties": { | |
"publisher": "Microsoft.Compute", | |
"type": "CustomScriptExtension", | |
"typeHandlerVersion": "1.4", | |
"autoUpgradeMinorVersion": true, | |
"settings": { | |
"fileUris": [ | |
"https://raw.githubusercontent.com/cloudacademy/azure-lab-provisioners/master/keyvault-diskencryption-lab/bootstrap.ps1" | |
] | |
}, | |
"protectedSettings": { | |
"commandToExecute": "[concat('powershell -ExecutionPolicy Unrestricted -File bootstrap.ps1 -user ',parameters('adminUsername'),' -password ',parameters('adminPassword'))]" | |
} | |
} | |
} | |
] | |
}, | |
{ | |
"name": "[toLower(replace(concat(parameters('storageAccountName'), resourceGroup().name),'-', ''))]", | |
"type": "Microsoft.Storage/storageAccounts", | |
"apiVersion": "2015-06-15", | |
"location": "[resourceGroup().location]", | |
"properties": { | |
"accountType": "[parameters('storageAccountType')]" | |
} | |
}, | |
{ | |
"name": "[parameters('virtualNetworkName')]", | |
"type": "Microsoft.Network/virtualNetworks", | |
"apiVersion": "2016-12-01", | |
"location": "[resourceGroup().location]", | |
"properties": { | |
"addressSpace": { | |
"addressPrefixes": [ | |
"[parameters('addressPrefix')]" | |
] | |
}, | |
"subnets": [ | |
{ | |
"name": "[parameters('subnetName')]", | |
"properties": { | |
"addressPrefix": "[parameters('subnetPrefix')]" | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"name": "[parameters('networkInterfaceName')]", | |
"type": "Microsoft.Network/networkInterfaces", | |
"apiVersion": "2016-09-01", | |
"location": "[resourceGroup().location]", | |
"dependsOn": [ | |
"[concat('Microsoft.Network/virtualNetworks/', parameters('virtualNetworkName'))]", | |
"[concat('Microsoft.Network/publicIpAddresses/', parameters('publicIpAddressName'))]", | |
"[concat('Microsoft.Network/networkSecurityGroups/', parameters('networkSecurityGroupName'))]" | |
], | |
"properties": { | |
"ipConfigurations": [ | |
{ | |
"name": "ipconfig1", | |
"properties": { | |
"subnet": { | |
"id": "[variables('subnetRef')]" | |
}, | |
"privateIPAllocationMethod": "Dynamic", | |
"publicIpAddress": { | |
"id": "[resourceId(resourceGroup().name,'Microsoft.Network/publicIpAddresses', parameters('publicIpAddressName'))]" | |
} | |
} | |
} | |
], | |
"networkSecurityGroup": { | |
"id": "[resourceId(resourceGroup().name, 'Microsoft.Network/networkSecurityGroups', parameters('networkSecurityGroupName'))]" | |
} | |
} | |
}, | |
{ | |
"name": "[parameters('publicIpAddressName')]", | |
"type": "Microsoft.Network/publicIpAddresses", | |
"apiVersion": "2016-09-01", | |
"location": "[resourceGroup().location]", | |
"properties": { | |
"publicIpAllocationMethod": "[parameters('publicIpAddressType')]" | |
} | |
}, | |
{ | |
"name": "[parameters('networkSecurityGroupName')]", | |
"type": "Microsoft.Network/networkSecurityGroups", | |
"apiVersion": "2016-09-01", | |
"location": "[resourceGroup().location]", | |
"properties": { | |
"securityRules": [ | |
{ | |
"name": "default-allow-rdp", | |
"properties": { | |
"priority": 1000, | |
"sourceAddressPrefix": "*", | |
"protocol": "TCP", | |
"destinationPortRange": "3389", | |
"access": "Allow", | |
"direction": "Inbound", | |
"sourcePortRange": "*", | |
"destinationAddressPrefix": "*" | |
} | |
} | |
] | |
} | |
} | |
], | |
"outputs": { | |
"adminUsername": { | |
"type": "string", | |
"value": "[parameters('adminUsername')]" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment