Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
214 lines (214 sloc) 7.88 KB
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"vmName": {
"type": "string",
"defaultValue": "centos73vm"
},
"vmSize": {
"type": "string",
"defaultValue": "Standard_A5"
},
"adminUser": {
"type": "string"
},
"adminPassword": {
"type": "securestring"
},
"virtualNetworkName": {
"type": "string",
"defaultValue": "vNet"
},
"nicName": {
"type": "string",
"defaultValue": "nic"
},
"adminPublicKey": {
"type": "string"
},
"diagnosticsStorageAccountName": {
"type": "string",
"defaultValue": "store0518"
},
"addressPrefix": {
"type": "string",
"defaultValue": "192.168.1.0/24"
},
"subnetName": {
"type": "string",
"defaultValue": "subnet1"
},
"subnetPrefix": {
"type": "string",
"defaultValue": "192.168.1.0/27"
},
"publicIpAddressName": {
"type": "string",
"defaultValue": "pip"
},
"publicIpAddressType": {
"type": "string",
"defaultValue": "ipv4"
}
},
"variables": {
"vnetId": "[resourceId('Microsoft.Network/virtualNetworks', parameters('virtualNetworkName'))]",
"subnetRef": "[concat(variables('vnetId'), '/subnets/', parameters('subnetName'))]"
},
"resources": [
{
"name": "[parameters('vmName')]",
"type": "Microsoft.Compute/virtualMachines",
"apiVersion": "2016-04-30-preview",
"location": "[resourceGroup().location]",
"dependsOn": [
"[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]"
],
"properties": {
"osProfile": {
"adminPassword": "[parameters('adminPassword')]",
"computerName": "[parameters('vmName')]",
"adminUsername": "[parameters('adminUser')]",
"linuxConfiguration": {
"disablePasswordAuthentication": "false",
"ssh": {
"publicKeys": [
{
"path": "[concat('/home/', parameters('adminUser'), '/.ssh/authorized_keys')]",
"keyData": "[parameters('adminPublicKey')]"
}
]
}
}
},
"hardwareProfile": {
"vmSize": "[parameters('vmSize')]"
},
"storageProfile": {
"imageReference": {
"publisher": "OpenLogic",
"offer": "CentOS",
"sku": "7.3",
"version": "latest"
},
"osDisk": {
"createOption": "FromImage",
"managedDisk": {
"storageAccountType": "Standard_LRS"
}
},
"dataDisks": []
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces', parameters('nicName'))]"
}
]
},
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": true,
"storageUri": "[concat('http://', parameters('diagnosticsStorageAccountName'), '.blob.core.windows.net')]"
}
}
},
"resources": [
{
"type": "extensions",
"name": "LAMPCustomScriptExtension",
"location": "[resourceGroup().location]",
"apiVersion": "2015-06-15",
"dependsOn": [
"[concat('Microsoft.Compute/virtualMachines/', parameters('vmName'))]"
],
"tags": {
"displayName": "CentOSLAMPScript"
},
"properties": {
"publisher": "Microsoft.Azure.Extensions",
"type": "CustomScript",
"typeHandlerVersion": "2.0",
"autoUpgradeMinorVersion": true,
"settings": {
"fileUris": [
"https://store0518.blob.core.windows.net/templates/lamp73-setup.sh?sv=2016-05-31&ss=b&srt=sco&sp=rwdlac&se=2017-12-21T00:51:20Z&st=2017-06-20T16:51:20Z&spr=https&sig=f%2FLnz4u40U0tGdmxBDfO6VgWdhHzj%2BRJMVK8UjMKTUI%3D"
],
"commandToExecute": "sudo sh lamp73-setup.sh"
}
}
}
]
},
{
"name": "[parameters('virtualNetworkName')]",
"type": "Microsoft.Network/virtualNetworks",
"apiVersion": "2016-12-01",
"location": "[resourceGroup().location]",
"properties": {
"addressSpace": {
"addressPrefixes": [
"[parameters('addressPrefix')]"
]
},
"subnets": [
{
"name": "[parameters('subnetName')]",
"properties": {
"addressPrefix": "[parameters('subnetPrefix')]"
}
}
]
}
},
{
"type": "Microsoft.Network/networkInterfaces",
"name": "[parameters('nicName')]",
"apiVersion": "2016-09-01",
"location": "[resourceGroup().location]",
"dependsOn": [
"[concat('Microsoft.Network/virtualNetworks/', parameters('virtualNetworkName'))]",
"[concat('Microsoft.Network/publicIpAddresses/', parameters('publicIpAddressName'))]"
],
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"subnet": {
"id": "[variables('subnetRef')]"
},
"privateIPAllocationMethod": "Dynamic",
"publicIpAddress": {
"id": "[resourceId('Microsoft.Network/publicIpAddresses', parameters('publicIpAddressName'))]"
}
}
}
]
}
},
{
"type": "Microsoft.Network/publicIpAddresses",
"apiVersion": "2016-09-01",
"location": "[resourceGroup().location]",
"name": "[parameters('publicIPAddressName')]",
"properties": {
"publicIpAllocationMethod": "Dynamic",
"dnsSettings": {
"domainNameLabel": "[parameters('vmName')]"
}
}
}
],
"outputs": {
"adminUsername": {
"type": "string",
"value": "[parameters('adminUser')]"
},
"sshCommand": {
"type": "string",
"value": "[concat('ssh ', parameters('adminUser'), '@', reference(parameters('publicIPAddressName')).dnsSettings.fqdn)]"
}
}
}