You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

199 lines
6.5 KiB

  1. {
  2. "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  3. "contentVersion": "1.0.0.0",
  4. "parameters": {
  5. "newStorageAccountName": {
  6. "type": "string",
  7. "metadata": {
  8. "description": "Unique DNS Name for the Storage Account where the Virtual Machine's disks will be placed."
  9. }
  10. },
  11. "adminUsername": {
  12. "type": "string",
  13. "metadata": {
  14. "description": "Username for the Virtual Machine."
  15. }
  16. },
  17. "adminPassword": {
  18. "type": "securestring",
  19. "metadata": {
  20. "description": "Password for the Virtual Machine."
  21. }
  22. },
  23. "dnsNameForPublicIP": {
  24. "type": "string",
  25. "metadata": {
  26. "description": "Unique DNS Name for the Public IP used to access the Virtual Machine."
  27. }
  28. },
  29. "ubuntuOSVersion": {
  30. "type": "string",
  31. "defaultValue": "14.04.4-LTS",
  32. "metadata": {
  33. "description": "The Ubuntu version for deploying the Docker containers. This will pick a fully patched image of this given Ubuntu version. Allowed values: 14.04.4-LTS, 15.10, 16.04.0-LTS"
  34. },
  35. "allowedValues": [
  36. "14.04.4-LTS",
  37. "15.10",
  38. "16.04.0-LTS"
  39. ]
  40. },
  41. "VMName": {
  42. "type": "string",
  43. "metadata": {
  44. "description": "Name of VM in Azure"
  45. }
  46. }
  47. },
  48. "variables": {
  49. "newStorageAccountName": "[take(concat(parameters('newStorageAccountName'), uniqueString(resourceGroup().id)), 23)]",
  50. "dnsNameForPublicIP": "[concat(parameters('dnsNameForPublicIP'), uniqueString(resourceGroup().id))]",
  51. "imagePublisher": "Canonical",
  52. "imageOffer": "UbuntuServer",
  53. "OSDiskName": "osdiskfordockersimple",
  54. "nicName": "myVMNicD",
  55. "extensionName": "DockerExtension",
  56. "addressPrefix": "10.0.0.0/16",
  57. "subnetName": "Subnet",
  58. "subnetPrefix": "10.0.0.0/24",
  59. "storageAccountType": "Standard_LRS",
  60. "publicIPAddressName": "myPublicIPD",
  61. "publicIPAddressType": "Dynamic",
  62. "vmStorageAccountContainerName": "vhds",
  63. "vmName": "[parameters('VMName')]",
  64. "vmSize": "Standard_F1",
  65. "virtualNetworkName": "MyVNETD",
  66. "vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]",
  67. "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]"
  68. },
  69. "resources": [
  70. {
  71. "type": "Microsoft.Storage/storageAccounts",
  72. "name": "[variables('newStorageAccountName')]",
  73. "apiVersion": "2015-05-01-preview",
  74. "location": "[resourceGroup().location]",
  75. "properties": {
  76. "accountType": "[variables('storageAccountType')]"
  77. }
  78. },
  79. {
  80. "apiVersion": "2015-05-01-preview",
  81. "type": "Microsoft.Network/publicIPAddresses",
  82. "name": "[variables('publicIPAddressName')]",
  83. "location": "[resourceGroup().location]",
  84. "properties": {
  85. "publicIPAllocationMethod": "[variables('publicIPAddressType')]",
  86. "dnsSettings": {
  87. "domainNameLabel": "[variables('dnsNameForPublicIP')]"
  88. }
  89. }
  90. },
  91. {
  92. "apiVersion": "2015-05-01-preview",
  93. "type": "Microsoft.Network/virtualNetworks",
  94. "name": "[variables('virtualNetworkName')]",
  95. "location": "[resourceGroup().location]",
  96. "properties": {
  97. "addressSpace": {
  98. "addressPrefixes": [
  99. "[variables('addressPrefix')]"
  100. ]
  101. },
  102. "subnets": [
  103. {
  104. "name": "[variables('subnetName')]",
  105. "properties": {
  106. "addressPrefix": "[variables('subnetPrefix')]"
  107. }
  108. }
  109. ]
  110. }
  111. },
  112. {
  113. "apiVersion": "2015-05-01-preview",
  114. "type": "Microsoft.Network/networkInterfaces",
  115. "name": "[variables('nicName')]",
  116. "location": "[resourceGroup().location]",
  117. "dependsOn": [
  118. "[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]",
  119. "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
  120. ],
  121. "properties": {
  122. "ipConfigurations": [
  123. {
  124. "name": "ipconfig1",
  125. "properties": {
  126. "privateIPAllocationMethod": "Dynamic",
  127. "publicIPAddress": {
  128. "id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]"
  129. },
  130. "subnet": {
  131. "id": "[variables('subnetRef')]"
  132. }
  133. }
  134. }
  135. ]
  136. }
  137. },
  138. {
  139. "apiVersion": "2015-05-01-preview",
  140. "type": "Microsoft.Compute/virtualMachines",
  141. "name": "[variables('vmName')]",
  142. "location": "[resourceGroup().location]",
  143. "dependsOn": [
  144. "[concat('Microsoft.Storage/storageAccounts/', variables('newStorageAccountName'))]",
  145. "[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
  146. ],
  147. "properties": {
  148. "hardwareProfile": {
  149. "vmSize": "[variables('vmSize')]"
  150. },
  151. "osProfile": {
  152. "computerName": "[variables('vmName')]",
  153. "adminUsername": "[parameters('adminUsername')]",
  154. "adminPassword": "[parameters('adminPassword')]"
  155. },
  156. "storageProfile": {
  157. "imageReference": {
  158. "publisher": "[variables('imagePublisher')]",
  159. "offer": "[variables('imageOffer')]",
  160. "sku": "[parameters('ubuntuOSVersion')]",
  161. "version": "latest"
  162. },
  163. "osDisk": {
  164. "name": "osdisk1",
  165. "vhd": {
  166. "uri": "[concat('http://',variables('newStorageAccountName'),'.blob.core.windows.net/',variables('vmStorageAccountContainerName'),'/',variables('OSDiskName'),'.vhd')]"
  167. },
  168. "caching": "ReadWrite",
  169. "createOption": "FromImage"
  170. }
  171. },
  172. "networkProfile": {
  173. "networkInterfaces": [
  174. {
  175. "id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]"
  176. }
  177. ]
  178. }
  179. }
  180. },
  181. {
  182. "type": "Microsoft.Compute/virtualMachines/extensions",
  183. "name": "[concat(variables('vmName'),'/', variables('extensionName'))]",
  184. "apiVersion": "2015-05-01-preview",
  185. "location": "[resourceGroup().location]",
  186. "dependsOn": [
  187. "[concat('Microsoft.Compute/virtualMachines/', variables('vmName'))]"
  188. ],
  189. "properties": {
  190. "publisher": "Microsoft.Azure.Extensions",
  191. "type": "DockerExtension",
  192. "typeHandlerVersion": "1.0",
  193. "autoUpgradeMinorVersion": true,
  194. "settings": { }
  195. }
  196. }
  197. ]
  198. }