Last active
August 3, 2017 11:42
-
-
Save marckean/0418b8b109d64efd867b5a167ad5b7ff 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": { | |
"adminUsername": { | |
"type": "string", | |
"metadata": { | |
"description": "User name for the Virtual Machine." | |
} | |
}, | |
"adminPassword": { | |
"type": "securestring", | |
"metadata": { | |
"description": "Password for the Virtual Machine." | |
} | |
}, | |
"dnsLabelPrefix": { | |
"type": "string", | |
"metadata": { | |
"description": "Unique DNS Name for the Public IP used to access the Virtual Machine." | |
} | |
}, | |
"location": { | |
"type": "string", | |
"metadata": { | |
"description": "Location for the Virtual Machine." | |
} | |
}, | |
"vNetName": { | |
"type": "string", | |
"metadata": { | |
"description": "Name of Virtual Network." | |
} | |
}, | |
"vNetResourceGroupID": { | |
"type": "string", | |
"metadata": { | |
"description": "Name of Virtual Network." | |
} | |
}, | |
"SubNetName": { | |
"type": "string", | |
"metadata": { | |
"description": "Name of Subnet." | |
} | |
}, | |
"ubuntuOSVersion": { | |
"type": "string", | |
"defaultValue": "16.04.0-LTS", | |
"allowedValues": [ | |
"12.04.5-LTS", | |
"14.04.5-LTS", | |
"15.10", | |
"16.04.0-LTS" | |
], | |
"metadata": { | |
"description": "The Ubuntu version for the VM. This will pick a fully patched image of this given Ubuntu version." | |
} | |
}, | |
"index": { | |
"type": "int" | |
} | |
}, | |
"variables": { | |
"storageAccountName": "[concat(uniquestring(resourceGroup().id), 'salinuxvm')]", | |
"imagePublisher": "Canonical", | |
"imageOffer": "UbuntuServer", | |
"nicName": "myVMNic", | |
"storageAccountType": "Standard_LRS", | |
"publicIPAddressName": "myPublicIP", | |
"publicIPAddressType": "Dynamic", | |
"vmName": "MyUbuntuVM", | |
"vmSize": "Standard_A1", | |
"vnetID": "[concat(parameters('vNetResourceGroupID'),'Microsoft.Network/virtualNetworks/',parameters('vNetName'))]", | |
"subnetRef": "[concat(variables('vnetID'),'/subnets/',parameters('subNetName'))]" | |
}, | |
"resources": [ | |
{ | |
"type": "Microsoft.Storage/storageAccounts", | |
"name": "[concat(parameters('index'), variables('storageAccountName'))]", | |
"apiVersion": "2017-06-01", | |
"location": "[parameters('location')]", | |
"sku": { | |
"name": "[variables('storageAccountType')]" | |
}, | |
"kind": "Storage", | |
"properties": {} | |
}, | |
{ | |
"apiVersion": "2017-04-01", | |
"type": "Microsoft.Network/publicIPAddresses", | |
"name": "[concat(parameters('index'), variables('publicIPAddressName'))]", | |
"location": "[parameters('location')]", | |
"properties": { | |
"publicIPAllocationMethod": "[variables('publicIPAddressType')]", | |
"dnsSettings": { | |
"domainNameLabel": "[concat(parameters('dnsLabelPrefix'), parameters('index'))]" | |
} | |
} | |
}, | |
{ | |
"apiVersion": "2017-04-01", | |
"type": "Microsoft.Network/networkInterfaces", | |
"name": "[concat(parameters('index'), variables('nicName'))]", | |
"location": "[parameters('location')]", | |
"dependsOn": [ | |
"[resourceId('Microsoft.Network/publicIPAddresses/', concat(parameters('index'),variables('publicIPAddressName')))]" | |
], | |
"properties": { | |
"ipConfigurations": [ | |
{ | |
"name": "ipconfig1", | |
"properties": { | |
"privateIPAllocationMethod": "Dynamic", | |
"publicIPAddress": { | |
"id": "[resourceId('Microsoft.Network/publicIPAddresses/', concat(parameters('index'),variables('publicIPAddressName')))]" | |
}, | |
"subnet": { | |
"id": "[variables('subnetRef')]" | |
} | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"apiVersion": "2017-03-30", | |
"type": "Microsoft.Compute/virtualMachines", | |
"name": "[concat(parameters('index'), variables('vmName'))]", | |
"location": "[parameters('location')]", | |
"dependsOn": [ | |
"[resourceId('Microsoft.Storage/storageAccounts/', concat(parameters('index'),variables('storageAccountName')))]", | |
"[resourceId('Microsoft.Network/networkInterfaces/', concat(parameters('index'),variables('nicName')))]" | |
], | |
"properties": { | |
"hardwareProfile": { | |
"vmSize": "[variables('vmSize')]" | |
}, | |
"osProfile": { | |
"computerName": "[concat(parameters('index'), variables('vmName'))]", | |
"adminUsername": "[parameters('adminUsername')]", | |
"adminPassword": "[parameters('adminPassword')]" | |
}, | |
"storageProfile": { | |
"imageReference": { | |
"publisher": "[variables('imagePublisher')]", | |
"offer": "[variables('imageOffer')]", | |
"sku": "[parameters('ubuntuOSVersion')]", | |
"version": "latest" | |
}, | |
"osDisk": { | |
"createOption": "FromImage" | |
}, | |
"dataDisks": [ | |
{ | |
"diskSizeGB": "1023", | |
"lun": 0, | |
"createOption": "Empty" | |
} | |
] | |
}, | |
"networkProfile": { | |
"networkInterfaces": [ | |
{ | |
"id": "[resourceId('Microsoft.Network/networkInterfaces/', concat(parameters('index'),variables('nicName')))]" | |
} | |
] | |
}, | |
"diagnosticsProfile": { | |
"bootDiagnostics": { | |
"enabled": "true", | |
"storageUri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', concat(parameters('index'),variables('storageAccountName'))), '2016-01-01').primaryEndpoints.blob)]" | |
} | |
} | |
} | |
} | |
], | |
"outputs": { | |
"hostname": { | |
"type": "string", | |
"value": "[reference(concat(parameters('index'),variables('publicIPAddressName'))).dnsSettings.fqdn]" | |
}, | |
"sshCommand": { | |
"type": "string", | |
"value": "[concat('ssh ', parameters('adminUsername'), '@', reference(concat(parameters('index'),variables('publicIPAddressName'))).dnsSettings.fqdn)]" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment