Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
288 lines (286 sloc) 8.49 KB
{
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"apiProfile": "2018-03-01-hybrid",
"parameters": {
"adminUserName": {
"type": "string",
"defaultValue": "azure",
"metadata": {
"description": "User name for the Virtual Machine."
}
},
"imagePublisher": {
"type": "string",
"metadata": {
"description": "Name of the image publisher"
}
},
"imageOffer": {
"type": "string",
"metadata": {
"description": "Name of the image offer"
}
},
"imageSku": {
"type": "string",
"metadata": {
"description": "Name of the image sku"
}
},
"imageVersion": {
"type": "string",
"metadata": {
"description": "Name of the image sku"
}
},
"networkSecurityGroupName": {
"type": "string",
"metadata": {
"description": "Name of network security group to join NICs to."
}
},
"sshKeyData": {
"type": "string",
"metadata": {
"description": "SSH rsa public key file as a string."
}
},
"storageAccountName": {
"type": "string",
"metadata": {
"description": "Unique alphanumeric identifier."
}
},
"storageAccountType": {
"type": "string",
"metadata": {
"description": "See: https://docs.microsoft.com/it-it/rest/api/compute/disks/createorupdate#disksku"
}
},
"subnetName": {
"type": "string",
"defaultValue": "subnet",
"metadata": {
"description": "Name of the subnet"
}
},
"virtualNetworkName": {
"type": "string",
"defaultValue": "elasticluster",
"metadata": {
"description": "Name of the virtual network"
}
},
"vmName": {
"type": "string",
"metadata": {
"description": "Name of the VM"
}
},
"vmSize": {
"type": "string",
"metadata": {
"description": "Size of the VM"
}
},
"bootDiskSize": {
"type": "int",
"defaultValue": 30,
"metadata": {
"description": "Size of boot disk to use; values are specified in gigabytes."
}
}
},
"variables": {
"dnsLabelPrefix": "[parameters('vmName')]",
"location": "[resourceGroup().location]",
"osDiskName": "[concat(parameters('vmName'), '-disk')]",
"addressPrefix": "10.0.0.0/8",
"subnetPrefix": "10.0.0.0/16",
"vmStorageAccountContainerName": "[concat(resourceGroup().name, '-vm-storage')]",
"nicName": "[concat(parameters('vmName'), '-nic')]",
"publicIPAddressName": "[concat(parameters('vmName'), '-public-ip')]",
"publicIPAddressType": "Dynamic",
"networkSecurityGroupName": "[concat(resourceGroup().name, '-secgroup')]",
"sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]",
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks', parameters('virtualNetworkName'))]",
"subnetRef": "[concat(variables('vnetID'),'/subnets/',parameters('subnetName'))]"
},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"name": "[parameters('storageAccountName')]",
"sku": {
"name": "[parameters('storageAccountType')]",
"tier": "Standard"
},
"location": "[variables('location')]",
"tags": {},
"scale": null,
"kind": "Storage",
"properties": {
"networkAcls": {
"bypass": "AzureServices",
"virtualNetworkRules": [],
"ipRules": [],
"defaultAction": "Allow"
},
"supportsHttpsTrafficOnly": false,
"encryption": {
"services": {
"blob": {
"enabled": true
}
},
"keySource": "Microsoft.Storage"
}
}
},
{
"type": "Microsoft.Network/networkSecurityGroups",
"name": "[parameters('networkSecurityGroupName')]",
"location": "[variables('location')]",
"properties": {
"securityRules": [
{
"name": "ssh_rule",
"properties": {
"description": "Locks inbound down to ssh default port 22.",
"protocol": "Tcp",
"sourcePortRange": "*",
"destinationPortRange": "22",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 123,
"direction": "Inbound"
}
}
]
}
},
{
"type": "Microsoft.Network/publicIPAddresses",
"name": "[variables('publicIPAddressName')]",
"location": "[variables('location')]",
"properties": {
"publicIPAllocationMethod": "[variables('publicIPAddressType')]",
"dnsSettings": {
"domainNameLabel": "[variables('dnsLabelPrefix')]"
}
}
},
{
"type": "Microsoft.Network/virtualNetworks",
"name": "[parameters('virtualNetworkName')]",
"location": "[variables('location')]",
"dependsOn": [
"[concat('Microsoft.Network/networkSecurityGroups/', parameters('networkSecurityGroupName'))]"
],
"properties": {
"addressSpace": {
"addressPrefixes": [
"[variables('addressPrefix')]"
]
},
"subnets": [
{
"name": "[parameters('subnetName')]",
"properties": {
"addressPrefix": "[variables('subnetPrefix')]",
"networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', parameters('networkSecurityGroupName'))]"
}
}
}
]
}
},
{
"type": "Microsoft.Network/networkInterfaces",
"name": "[variables('nicName')]",
"location": "[variables('location')]",
"dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]",
"[concat('Microsoft.Network/virtualNetworks/', parameters('virtualNetworkName'))]"
],
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIPAddressName'))]"
},
"subnet": {
"id": "[variables('subnetRef')]"
}
}
}
]
}
},
{
"type": "Microsoft.Compute/virtualMachines",
"name": "[parameters('vmName')]",
"location": "[variables('location')]",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts/', parameters('storageAccountName'))]",
"[resourceId('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
],
"tags": {},
"properties": {
"hardwareProfile": {
"vmSize": "[parameters('vmSize')]"
},
"osProfile": {
"computerName": "[parameters('vmName')]",
"adminUsername": "[parameters('adminUsername')]",
"linuxConfiguration": {
"disablePasswordAuthentication": "true",
"ssh": {
"publicKeys": [
{
"path": "[variables('sshKeyPath')]",
"keyData": "[parameters('sshKeyData')]"
}
]
}
}
},
"storageProfile": {
"imageReference": {
"publisher": "[parameters('imagePublisher')]",
"offer": "[parameters('imageOffer')]",
"sku": "[parameters('imageSku')]",
"version": "[parameters('imageVersion')]"
},
"osDisk": {
"createOption": "FromImage",
"name": "[variables('osDiskName')]",
"caching": "ReadWrite",
"diskSizeGB": "[parameters('bootDiskSize')]",
"managedDisk": {
"storageAccountType": "[parameters('storageAccountType')]"
}
}
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]"
}
]
},
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": "true",
"storageUri": "[concat('http://',parameters('storageAccountName'),'.blob.core.windows.net')]"
}
}
}
}
]
}
You can’t perform that action at this time.