Created
August 25, 2016 23:56
-
-
Save kenazk/669dc5be476a0177cbcb811d05d66d93 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." | |
} | |
}, | |
"mysqlPassword": { | |
"type": "securestring", | |
"metadata": { | |
"description": "Root password password for the MySQL database." | |
} | |
}, | |
"adminUsername": { | |
"type": "string", | |
"metadata": { | |
"description": "Username for the Virtual Machine." | |
} | |
}, | |
"sshKeyData": { | |
"type": "securestring", | |
"metadata": { | |
"description": "sshKeyData for the Virtual Machine." | |
} | |
}, | |
"dnsNameForPublicIP": { | |
"type": "string", | |
"metadata": { | |
"description": "Unique DNS Name for the Public IP used to access the Virtual Machine." | |
} | |
} | |
}, | |
"variables": { | |
"imagePublisher": "Canonical", | |
"imageOffer": "UbuntuServer", | |
"ubuntuOSVersion": "15.10", | |
"OSDiskName": "osdiskfordockersimple", | |
"nsgName": "myNSG", | |
"nicName": "myVMNic", | |
"extensionName": "DockerExtension", | |
"addressPrefix": "10.0.0.0/16", | |
"subnetName": "Subnet", | |
"subnetPrefix": "10.0.0.0/24", | |
"storageAccountType": "Standard_LRS", | |
"publicIPAddressName": "myPublicIP", | |
"publicIPAddressType": "Dynamic", | |
"vmStorageAccountContainerName": "vhds", | |
"vmName": "MyDockerVM", | |
"vmSize": "Standard_D1", | |
"virtualNetworkName": "MyVNET", | |
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]", | |
"nsgID": "[resourceId('Microsoft.Network/networkSecurityGroups',variables('nsgName'))]", | |
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", | |
"sshKeyPath": "[concat('/home/',parameters('adminUserName'),'/.ssh/authorized_keys')]" | |
}, | |
"resources": [ | |
{ | |
"type": "Microsoft.Storage/storageAccounts", | |
"name": "[parameters('newStorageAccountName')]", | |
"apiVersion": "2015-05-01-preview", | |
"location": "[resourceGroup().location]", | |
"properties": { | |
"accountType": "[variables('storageAccountType')]" | |
} | |
}, | |
{ | |
"apiVersion": "2015-05-01-preview", | |
"type": "Microsoft.Network/publicIPAddresses", | |
"name": "[variables('publicIPAddressName')]", | |
"location": "[resourceGroup().location]", | |
"properties": { | |
"publicIPAllocationMethod": "[variables('publicIPAddressType')]", | |
"dnsSettings": { | |
"domainNameLabel": "[parameters('dnsNameForPublicIP')]" | |
} | |
} | |
}, | |
{ | |
"apiVersion": "2015-05-01-preview", | |
"type": "Microsoft.Network/virtualNetworks", | |
"name": "[variables('virtualNetworkName')]", | |
"location": "[resourceGroup().location]", | |
"dependsOn": [ | |
"[variables('nsgID')]" | |
], | |
"properties": { | |
"addressSpace": { | |
"addressPrefixes": [ | |
"[variables('addressPrefix')]" | |
] | |
}, | |
"subnets": [ | |
{ | |
"name": "[variables('subnetName')]", | |
"properties": { | |
"addressPrefix": "[variables('subnetPrefix')]", | |
"networkSecurityGroup": { | |
"id": "[variables('nsgID')]" | |
} | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"apiVersion": "2015-05-01-preview", | |
"type": "Microsoft.Network/networkInterfaces", | |
"name": "[variables('nicName')]", | |
"location": "[resourceGroup().location]", | |
"dependsOn": [ | |
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]", | |
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" | |
], | |
"properties": { | |
"ipConfigurations": [ | |
{ | |
"name": "ipconfig1", | |
"properties": { | |
"privateIPAllocationMethod": "Static", | |
"publicIPAddress": { | |
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]" | |
}, | |
"subnet": { | |
"id": "[variables('subnetRef')]" | |
} | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"apiVersion": "2015-05-01-preview", | |
"type": "Microsoft.Network/networkSecurityGroups", | |
"name": "[variables('nsgName')]", | |
"location": "[resourceGroup().location]", | |
"properties": { | |
"securityRules": [ | |
{ | |
"name": "http", | |
"properties": { | |
"description": "Allow HTTP", | |
"protocol": "Tcp", | |
"sourcePortRange": "*", | |
"destinationPortRange": "80", | |
"sourceAddressPrefix": "Internet", | |
"destinationAddressPrefix": "*", | |
"access": "Allow", | |
"priority": 100, | |
"direction": "Inbound" | |
} | |
}, | |
{ | |
"name": "ssh", | |
"properties": { | |
"description": "Allow SSH", | |
"protocol": "Tcp", | |
"sourcePortRange": "*", | |
"destinationPortRange": "22", | |
"sourceAddressPrefix": "Internet", | |
"destinationAddressPrefix": "*", | |
"access": "Allow", | |
"priority": 110, | |
"direction": "Inbound" | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"apiVersion": "2015-05-01-preview", | |
"type": "Microsoft.Compute/virtualMachines", | |
"name": "[variables('vmName')]", | |
"location": "[resourceGroup().location]", | |
"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')]", | |
"linuxConfiguration": { | |
"disablePasswordAuthentication": "true", | |
"ssh": { | |
"publicKeys": [ | |
{ | |
"path": "[variables('sshKeyPath')]", | |
"keyData": "[parameters('sshKeyData')]" | |
} | |
] | |
} | |
} | |
}, | |
"storageProfile": { | |
"imageReference": { | |
"publisher": "[variables('imagePublisher')]", | |
"offer": "[variables('imageOffer')]", | |
"sku": "[variables('ubuntuOSVersion')]", | |
"version": "latest" | |
}, | |
"osDisk": { | |
"name": "osdisk1", | |
"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'))]" | |
} | |
] | |
} | |
} | |
}, | |
{ | |
"type": "Microsoft.Compute/virtualMachines/extensions", | |
"name": "[concat(variables('vmName'),'/', variables('extensionName'))]", | |
"apiVersion": "2015-05-01-preview", | |
"location": "[resourceGroup().location]", | |
"dependsOn": [ | |
"[concat('Microsoft.Compute/virtualMachines/', variables('vmName'))]" | |
], | |
"properties": { | |
"publisher": "Microsoft.Azure.Extensions", | |
"type": "DockerExtension", | |
"typeHandlerVersion": "1.0", | |
"autoUpgradeMinorVersion": true, | |
"protectedSettings": { | |
"environment": { | |
"MYSQL_ROOT_PASSWORD": "[parameters('mysqlPassword')]" | |
} | |
}, | |
"settings": { | |
"compose": { | |
"db": { | |
"image": "mysql", | |
"ports": [ | |
"3306:3306" | |
], | |
"volumes": [ | |
"/var/lib/mysql:/var/lib/mysql" | |
], | |
"environment": [ | |
"MYSQL_ROOT_PASSWORD" | |
] | |
}, | |
"wordpress": { | |
"image": "wordpress", | |
"ports": [ | |
"80:80" | |
], | |
"links": [ | |
"db:mysql" | |
] | |
} | |
} | |
} | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment