Skip to content

Instantly share code, notes, and snippets.

@nicocesar
Last active February 25, 2016 03:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicocesar/9611d6eeec9c4b7f924e to your computer and use it in GitHub Desktop.
Save nicocesar/9611d6eeec9c4b7f924e to your computer and use it in GitHub Desktop.
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"uuid-prefix": { "type": "string" },
"newStorageAccountNamePrefixMain": { "type": "string" },
"newStorageAccountNamePrefixSSD": { "type": "string" },
"name": { "type": "string" },
"image_url": { "type": "string" },
"addressPrefix": { "type": "string", "defaultValue": "10.0.0.0/16" },
"subnetPublicPrefix": { "type": "string", "defaultValue": "10.0.0.0/18" },
"subnetPrivatePrefix": { "type": "string", "defaultValue": "10.0.64.0/18" },
"adminUserName": { "type": "string" },
"adminSshKey": { "type": "string" },
"vmSize": { "type": "string", "defaultValue": "Standard_DS1" }
},
"variables": {
"imagePublisher": "Canonical",
"imageOffer": "UbuntuServer",
"ubuntuOSVersion": "14.04.3-LTS",
"sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]"
},
"resources": [
{
"apiVersion": "2015-01-01",
"name": "networkDeploy",
"type": "Microsoft.Resources/deployments",
"properties": {
"mode": "incremental",
"templateLink": {
"uri": "https://gist.githubusercontent.com/nicocesar/2707109710bd535acd29/raw",
"contentVersion": "1.0.0.0"
},
"parameters": {
"uuid-prefix": { "value": "[parameters('uuid-prefix')]" },
"addressPrefix": { "value": "[parameters('addressPrefix')]" },
"subnetPublicPrefix": { "value": "[parameters('subnetPublicPrefix')]" },
"subnetPrivatePrefix": { "value": "[parameters('subnetPrivatePrefix')]" }
}
}
},
{
"apiVersion": "2015-01-01",
"name": "storageAccountsDeploy",
"type": "Microsoft.Resources/deployments",
"properties": {
"mode": "incremental",
"templateLink": {
"uri": "https://gist.githubusercontent.com/nicocesar/9e5dd99a34d98d737696/raw",
"contentVersion": "1.0.0.0"
},
"parameters": {
"newStorageAccountNamePrefixMain": { "value": "[parameters('newStorageAccountNamePrefixMain')]"},
"newStorageAccountNamePrefixSSD": { "value": "[parameters('newStorageAccountNamePrefixSSD')]"}
}
}
},
{
"apiVersion": "2015-05-01-preview",
"type": "Microsoft.Network/publicIPAddresses",
"name": "[concat(parameters('uuid-prefix'),'-',parameters('name'))]",
"location": "[resourceGroup().location]",
"tags": {
"displayName": "PublicIPAddress"
},
"properties": {
"publicIPAllocationMethod": "Dynamic",
"dnsSettings": {
"domainNameLabel": "[concat(parameters('uuid-prefix'),'-',parameters('name'))]"
}
}
},
{
"apiVersion": "2015-05-01-preview",
"type": "Microsoft.Network/networkInterfaces",
"name": "[concat(parameters('uuid-prefix'),'-',parameters('name'))]",
"location": "[resourceGroup().location]",
"tags": {
"displayName": "NetworkInterface"
},
"dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', concat(parameters('uuid-prefix'),'-',parameters('name')))]",
"Microsoft.Resources/deployments/networkDeploy"
],
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses',concat(parameters('uuid-prefix'),'-',parameters('name')))]"
},
"subnet": {
"id": "[reference('Microsoft.Resources/deployments/networkDeploy').outputs.subnetPublicRef.value]"
}
}
}
]
}
},
{
"apiVersion": "2015-05-01-preview",
"type": "Microsoft.Compute/virtualMachines",
"name": "[concat(parameters('uuid-prefix'),'-',parameters('name'))]",
"location": "[resourceGroup().location]",
"tags": {
"displayName": "VirtualMachine"
},
"dependsOn": [
"Microsoft.Resources/deployments/storageAccountsDeploy",
"Microsoft.Resources/deployments/networkDeploy",
"[concat('Microsoft.Network/networkInterfaces/', concat(parameters('uuid-prefix'),'-',parameters('name')))]"
],
"properties": {
"hardwareProfile": {
"vmSize": "[parameters('vmSize')]"
},
"storageProfile": {
"osDisk": {
"name": "osdisk",
"osType": "linux",
"vhd": {
"uri": "[concat('http://',parameters('newStorageAccountNamePrefixMain'),'.blob.core.windows.net/vhds/',parameters('uuid-prefix'),'-',parameters('name'),'-osdisk.vhd')]"
},
"createOption": "Attach",
"caching": "ReadWrite"
}
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces',concat(parameters('uuid-prefix'),'-',parameters('name')))]"
}
]
}
}
}
],
"outputs": {
"PrivateIp": {
"value": "[reference(concat('Microsoft.Network/networkInterfaces/',concat(parameters('uuid-prefix'),'-',parameters('name')))).ipConfigurations[0].properties.privateIPAddress]",
"type": "string"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment