Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
265 lines (264 sloc) 12.5 KB
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"adminUsername": {
"type": "String",
"metadata": {
"description": "Admin username"
}
},
"adminPassword": {
"type": "SecureString",
"metadata": {
"description": "Admin password (must be a strong password as required by Windows)"
}
}
},
"variables": {
"vmName": "[uniqueString(resourceGroup().id,deployment().name)]",
"networkInterfaceName": "[concat(uniqueString(resourceGroup().id,deployment().name),'-nic')]",
"networkSecurityGroupName": "[concat(uniqueString(resourceGroup().id,deployment().name),'-nsg')]",
"publicIPAddressName": "[concat(uniqueString(resourceGroup().id,deployment().name),'-public')]",
"virtualNetworkName": "[concat(uniqueString(resourceGroup().id,deployment().name),'-vnet')]",
"storageAccountName": "[concat(uniqueString(resourceGroup().id,deployment().name),'vhds')]",
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "2016-Datacenter",
"dnsPrefix": "[concat('lab',uniqueString(resourceGroup().id,deployment().name))]",
"storageAccountDiagnostics": "[concat(uniqueString(resourceGroup().id),'diag')]"
},
"resources": [
{
"type": "Microsoft.Compute/virtualMachines",
"name": "[variables('vmName')]",
"apiVersion": "2016-04-30-preview",
"location": "[resourceGroup().location]",
"properties": {
"hardwareProfile": {
"vmSize": "Standard_DS2_v2"
},
"storageProfile": {
"imageReference": {
"publisher": "[variables('publisher')]",
"offer": "[variables('offer')]",
"sku": "[variables('sku')]",
"version": "latest"
},
"osDisk": {
"osType": "Windows",
"name": "[variables('vmName')]",
"createOption": "FromImage",
"vhd": {
"uri": "[concat('https', '://', variables('storageAccountName'), '.blob.core.windows.net', concat('/vhds/', variables('vmName'),'20170212095102.vhd'))]"
},
"caching": "ReadWrite"
},
"dataDisks": []
},
"osProfile": {
"computerName": "[variables('vmName')]",
"adminUsername": "[parameters('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]",
"windowsConfiguration": {
"provisionVMAgent": true,
"enableAutomaticUpdates": true
},
"secrets": []
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces', variables('networkInterfaceName'))]"
}
]
},
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": true,
"storageUri": "[concat('https', '://', variables('storageAccountDiagnostics'), '.blob.core.windows.net', '/')]"
}
}
},
"resources": [
{
"type": "extensions",
"name": "installdocker",
"apiVersion": "2016-03-30",
"location": "[resourceGroup().location]",
"tags": {
"displayName": "installdocker"
},
"properties": {
"publisher": "Microsoft.Compute",
"type": "CustomScriptExtension",
"typeHandlerVersion": "1.4",
"autoUpgradeMinorVersion": true,
"settings": {
"commandToExecute": "powershell Set-ExecutionPolicy Bypass -Force ; powershell.exe -Command 'Set-ItemProperty -Path ''HKLM:\\SOFTWARE\\Microsoft\\Active Setup\\Installed Components\\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}'' -Name ''IsInstalled'' -Type DWord -Value 0' ; powershell -Command 'iex ((New-Object System.Net.WebClient).DownloadString(''https://chocolatey.org/install.ps1''))' ; powershell C:\\ProgramData\\chocolatey\\choco install -y putty ; powershell C:\\ProgramData\\chocolatey\\choco install -y nodejs.install; powershell C:\\ProgramData\\chocolatey\\choco install -y azure-cli; powershell C:\\ProgramData\\chocolatey\\choco install -y sql-server-management-studio; powershell C:\\ProgramData\\chocolatey\\choco install -y visualstudiocode; powershell C:\\ProgramData\\chocolatey\\choco install -y visualstudio2017community ; powershell C:\\ProgramData\\chocolatey\\choco install -y visualstudio2017-workload-netcoretools ; powershell C:\\ProgramData\\chocolatey\\choco install -y visualstudio2017-workload-node –y ; powershell C:\\ProgramData\\chocolatey\\choco install -y visualstudio2017-workload-azure ; powershell -ExecutionPolicy Unrestricted Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force; powershell -ExecutionPolicy Unrestricted Install-Module -Name DockerMsftProvider -Repository PSGallery -Force; powershell -ExecutionPolicy Unrestricted Install-Package -Name docker -ProviderName DockerMsftProvider -Force; Invoke-WebRequest 'https://github.com/docker/compose/releases/download/1.13.0/docker-compose-Windows-x86_64.exe' -UseBasicParsing -OutFile $Env:ProgramFiles\\docker\\docker-compose.exe ; Restart-Computer -Force"
}
},
"dependsOn": [
"[resourceId('Microsoft.Compute/virtualMachines', variables('vmName'))]"
]
}
],
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]",
"[resourceId('Microsoft.Network/networkInterfaces', variables('networkInterfaceName'))]",
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountDiagnostics'))]"
]
},
{
"type": "Microsoft.Network/networkInterfaces",
"name": "[variables('networkInterfaceName')]",
"apiVersion": "2017-03-01",
"location": "[resourceGroup().location]",
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAddress": "10.0.0.4",
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIPAddressName'))]"
},
"subnet": {
"id": "[concat(resourceId('Microsoft.Network/virtualNetworks', variables('virtualNetworkName')), '/subnets/default')]"
}
}
}
],
"dnsSettings": {
"dnsServers": []
},
"enableIPForwarding": false,
"networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]"
}
},
"dependsOn": [
"[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIPAddressName'))]",
"[resourceId('Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]",
"[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]"
]
},
{
"type": "Microsoft.Network/networkSecurityGroups",
"name": "[variables('networkSecurityGroupName')]",
"apiVersion": "2017-03-01",
"location": "[resourceGroup().location]",
"properties": {
"securityRules": [
{
"name": "default-allow-rdp",
"properties": {
"protocol": "TCP",
"sourcePortRange": "*",
"destinationPortRange": "3389",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 1000,
"direction": "Inbound"
}
},
{
"name": "ALL_PORTS_NOT_FOR_PROD",
"properties": {
"protocol": "*",
"sourcePortRange": "*",
"destinationPortRange": "*",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 1010,
"direction": "Inbound"
}
}
]
},
"dependsOn": []
},
{
"type": "Microsoft.Network/publicIPAddresses",
"name": "[variables('publicIPAddressName')]",
"apiVersion": "2017-03-01",
"location": "[resourceGroup().location]",
"properties": {
"publicIPAllocationMethod": "Dynamic",
"idleTimeoutInMinutes": 4,
"dnsSettings": {
"domainNameLabel": "[variables('dnsPrefix')]"
}
},
"dependsOn": []
},
{
"type": "Microsoft.Network/virtualNetworks",
"name": "[variables('virtualNetworkName')]",
"apiVersion": "2017-03-01",
"location": "[resourceGroup().location]",
"properties": {
"addressSpace": {
"addressPrefixes": [
"10.0.0.0/24"
]
},
"subnets": [
{
"name": "default",
"properties": {
"addressPrefix": "10.0.0.0/24"
}
}
],
"virtualNetworkPeerings": []
},
"dependsOn": []
},
{
"type": "Microsoft.Storage/storageAccounts",
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
},
"kind": "Storage",
"name": "[variables('storageAccountDiagnostics')]",
"apiVersion": "2016-01-01",
"location": "[resourceGroup().location]",
"tags": {},
"properties": {},
"dependsOn": []
},
{
"type": "Microsoft.Storage/storageAccounts",
"sku": {
"name": "Premium_LRS",
"tier": "Premium"
},
"kind": "Storage",
"name": "[variables('storageAccountName')]",
"apiVersion": "2016-01-01",
"location": "[resourceGroup().location]",
"tags": {},
"properties": {},
"dependsOn": []
}
],
"outputs": {
"VirtualMachineName": {
"type": "String",
"value": "[reference(resourceId('Microsoft.Compute/virtualMachines', variables('vmName'))).osProfile.computerName]"
},
"FDQN": {
"type": "String",
"value": "[concat('http://',reference(resourceId('Microsoft.Network/publicIPAddresses', variables('publicIPAddressName'))).dnsSettings.fqdn)]"
},
"RDP": {
"type": "String",
"value": "[concat(concat('mstsc /V:',reference(resourceId('Microsoft.Network/publicIPAddresses', variables('publicIPAddressName'))).dnsSettings.fqdn),':3389')]"
}
}
}