Last active
August 6, 2018 09:53
-
-
Save versionsix/406dcd2f8da4afc13918030e79166f7f to your computer and use it in GitHub Desktop.
Ubuntu Azure ARM VM template
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": { | |
"dnsLabelPrefix": { | |
"type": "string", | |
"metadata": { | |
"description": "Unique DNS Name for the Storage Account where the Virtual Machine's disks will be placed." | |
} | |
}, | |
"adminUsername": { | |
"type": "string", | |
"metadata": { | |
"description": "User name for the Virtual Machine." | |
} | |
}, | |
"adminPassword": { | |
"type": "string", | |
"defaultValue": "securestring", | |
"metadata": { | |
"description": "Password for the Virtual Machine." | |
} | |
}, | |
"virtualNetworkName": { | |
"type": "string", | |
"defaultValue": "ExistingVnet", | |
"metadata": { | |
"description": "Password for the Virtual Machine." | |
} | |
}, | |
"subnetName": { | |
"type": "string", | |
"defaultValue": "ExistingSubnet", | |
"metadata": { | |
"description": "Password for the Virtual Machine." | |
} | |
}, | |
"customData": { | |
"type": "string", | |
"defaultValue": "echo customData", | |
"metadata": { | |
"description": "String passed down to the Virtual Machine." | |
} | |
}, | |
"location": { | |
"type": "string", | |
"defaultValue": "[resourceGroup().location]", | |
"metadata": { | |
"description": "Location for all resources." | |
} | |
} | |
}, | |
"variables": { | |
"storageAccountName": "[concat(uniquestring(resourceGroup().id), 'storage')]", | |
"imagePublisher": "OpenLogic", | |
"imageOffer": "CentOS", | |
"nicName": "[concat(parameters('dnsLabelPrefix'), '-networkInterface-1')]", | |
"vmName": "[parameters('dnsLabelPrefix')]", | |
"publicIPAddressName": "[concat(parameters('dnsLabelPrefix'), '-publicIp')]", | |
"publicIPAddressType": "Dynamic", | |
"storageAccountType": "Standard_LRS", | |
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks',parameters('virtualNetworkName'))]", | |
"subnet1Ref": "[concat(variables('vnetID'),'/subnets/',parameters('subnetName'))]", | |
"apiVersion": "2015-06-15" | |
}, | |
"resources": [ | |
{ | |
"type": "Microsoft.Storage/storageAccounts", | |
"name": "[variables('storageAccountName')]", | |
"apiVersion": "2015-06-15", | |
"location": "[parameters('location')]", | |
"properties": { | |
"accountType": "[variables('storageAccountType')]" | |
} | |
}, | |
{ | |
"apiVersion": "2015-06-15", | |
"type": "Microsoft.Network/publicIPAddresses", | |
"name": "[variables('publicIPAddressName')]", | |
"location": "[parameters('location')]", | |
"properties": { | |
"publicIPAllocationMethod": "[variables('publicIPAddressType')]", | |
"dnsSettings": { | |
"domainNameLabel": "[parameters('dnsLabelPrefix')]" | |
} | |
} | |
}, | |
{ | |
"apiVersion": "2015-06-15", | |
"type": "Microsoft.Network/networkInterfaces", | |
"name": "[variables('nicName')]", | |
"location": "[parameters('location')]", | |
"dependsOn": [ | |
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]" | |
], | |
"properties": { | |
"ipConfigurations": [ | |
{ | |
"name": "ipconfig1", | |
"properties": { | |
"privateIPAllocationMethod": "Dynamic", | |
"publicIPAddress": { | |
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]" | |
}, | |
"subnet": { | |
"id": "[variables('subnet1Ref')]" | |
} | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"apiVersion": "2016-04-30-preview", | |
"type": "Microsoft.Compute/virtualMachines", | |
"name": "[variables('vmName')]", | |
"location": "[parameters('location')]", | |
"dependsOn": [ | |
"[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]", | |
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]" | |
], | |
"properties": { | |
"hardwareProfile": { | |
"vmSize": "Standard_B1s" | |
}, | |
"osProfile": { | |
"computerName": "[variables('vmName')]", | |
"adminUsername": "[parameters('adminUsername')]", | |
"adminPassword": "[parameters('adminPassword')]", | |
"customData": "[base64(parameters('customData'))]" | |
}, | |
"storageProfile": { | |
"imageReference": { | |
"publisher": "[variables('imagePublisher')]", | |
"offer": "[variables('imageOffer')]", | |
"sku": "7-CI", | |
"version": "latest" | |
}, | |
"osDisk": { | |
"createOption": "FromImage" | |
} | |
}, | |
"networkProfile": { | |
"networkInterfaces": [ | |
{ | |
"id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]" | |
} | |
] | |
}, | |
"diagnosticsProfile": { | |
"bootDiagnostics": { | |
"enabled": true, | |
"storageUri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName')), variables('apiVersion')).primaryEndpoints.blob)]" | |
} | |
} | |
} | |
} | |
] | |
} |
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": { | |
"dnsLabelPrefix": { | |
"type": "string", | |
"metadata": { | |
"description": "Unique DNS Name for the Storage Account where the Virtual Machine's disks will be placed." | |
} | |
}, | |
"adminUsername": { | |
"type": "string", | |
"metadata": { | |
"description": "User name for the Virtual Machine." | |
} | |
}, | |
"adminPassword": { | |
"type": "string", | |
"defaultValue": "securestring", | |
"metadata": { | |
"description": "Password for the Virtual Machine." | |
} | |
}, | |
"virtualNetworkName": { | |
"type": "string", | |
"defaultValue": "ExistingVnet", | |
"metadata": { | |
"description": "Password for the Virtual Machine." | |
} | |
}, | |
"subnetName": { | |
"type": "string", | |
"defaultValue": "ExistingSubnet", | |
"metadata": { | |
"description": "Password for the Virtual Machine." | |
} | |
}, | |
"customData": { | |
"type": "string", | |
"defaultValue": "echo customData", | |
"metadata": { | |
"description": "String passed down to the Virtual Machine." | |
} | |
}, | |
"location": { | |
"type": "string", | |
"defaultValue": "[resourceGroup().location]", | |
"metadata": { | |
"description": "Location for all resources." | |
} | |
} | |
}, | |
"variables": { | |
"storageAccountName": "[concat(replace(parameters('dnsLabelPrefix'),'-', ''), uniquestring(resourceGroup().id)]", | |
"imagePublisher": "Canonical", | |
"imageOffer": "UbuntuServer", | |
"nicName": "[concat(parameters('dnsLabelPrefix'), '-networkInterface-1')]", | |
"vmName": "[parameters('dnsLabelPrefix')]", | |
"publicIPAddressName": "[concat(parameters('dnsLabelPrefix'), '-publicIp')]", | |
"publicIPAddressType": "Dynamic", | |
"storageAccountType": "Standard_LRS", | |
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks',parameters('virtualNetworkName'))]", | |
"subnet1Ref": "[concat(variables('vnetID'),'/subnets/',parameters('subnetName'))]", | |
"apiVersion": "2015-06-15" | |
}, | |
"resources": [ | |
{ | |
"type": "Microsoft.Storage/storageAccounts", | |
"name": "[variables('storageAccountName')]", | |
"apiVersion": "2015-06-15", | |
"location": "[parameters('location')]", | |
"properties": { | |
"accountType": "[variables('storageAccountType')]" | |
} | |
}, | |
{ | |
"apiVersion": "2015-06-15", | |
"type": "Microsoft.Network/publicIPAddresses", | |
"name": "[variables('publicIPAddressName')]", | |
"location": "[parameters('location')]", | |
"properties": { | |
"publicIPAllocationMethod": "[variables('publicIPAddressType')]", | |
"dnsSettings": { | |
"domainNameLabel": "[parameters('dnsLabelPrefix')]" | |
} | |
} | |
}, | |
{ | |
"apiVersion": "2015-06-15", | |
"type": "Microsoft.Network/networkInterfaces", | |
"name": "[variables('nicName')]", | |
"location": "[parameters('location')]", | |
"dependsOn": [ | |
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]" | |
], | |
"properties": { | |
"ipConfigurations": [ | |
{ | |
"name": "ipconfig1", | |
"properties": { | |
"privateIPAllocationMethod": "Dynamic", | |
"publicIPAddress": { | |
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]" | |
}, | |
"subnet": { | |
"id": "[variables('subnet1Ref')]" | |
} | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"apiVersion": "2016-04-30-preview", | |
"type": "Microsoft.Compute/virtualMachines", | |
"name": "[variables('vmName')]", | |
"location": "[parameters('location')]", | |
"dependsOn": [ | |
"[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]", | |
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]" | |
], | |
"properties": { | |
"hardwareProfile": { | |
"vmSize": "Standard_B1s" | |
}, | |
"osProfile": { | |
"computerName": "[variables('vmName')]", | |
"adminUsername": "[parameters('adminUsername')]", | |
"adminPassword": "[parameters('adminPassword')]", | |
"customData": "[base64(parameters('customData'))]" | |
}, | |
"storageProfile": { | |
"imageReference": { | |
"publisher": "[variables('imagePublisher')]", | |
"offer": "[variables('imageOffer')]", | |
"sku": "18.04-LTS", | |
"version": "latest" | |
}, | |
"osDisk": { | |
"createOption": "FromImage" | |
} | |
}, | |
"networkProfile": { | |
"networkInterfaces": [ | |
{ | |
"id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]" | |
} | |
] | |
}, | |
"diagnosticsProfile": { | |
"bootDiagnostics": { | |
"enabled": true, | |
"storageUri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName')), variables('apiVersion')).primaryEndpoints.blob)]" | |
} | |
} | |
} | |
} | |
] | |
} |
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
"resources": [ | |
{ | |
"apiVersion": "2017-05-10", | |
"name": "linkedTemplate", | |
"type": "Microsoft.Resources/deployments", | |
"dependsOn": [ | |
"[concat('Microsoft.Network/virtualNetworks/', variables('uniqueVnetCoreName'))]" | |
], | |
"properties": { | |
"mode": "Incremental", | |
"templateLink": { | |
"uri":"https://gist.github.com/xenefix/406dcd2f8da4afc13918030e79166f7f/raw/e23acabaf3c570fd47f0f32bd68bc46153bb95dd/vm_template.json", | |
"contentVersion":"1.0.0.0" | |
}, | |
"parameters": { | |
"dnsLabelPrefix":{"value": "swamble"}, | |
"adminUsername": {"value": "swamble"}, | |
"adminPassword": {"value": "swambleswamble!1"}, | |
"virtualNetworkName": {"value": "VNet-Core"}, | |
"subnetName": {"value": "VNet-Core-Subnet-1"}, | |
"customData": {"value": "echo customData"}, | |
"location": {"value": "[resourceGroup().location]"} | |
} | |
} | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment