Created
October 18, 2018 15:24
-
-
Save CodeHeight/b68cd90158d91705742b41b603b0d21c 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": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", | |
"contentVersion": "1.0.0.0", | |
"parameters": { | |
"location": { | |
"type": "String" | |
}, | |
"networkInterfaceName": { | |
"type": "String" | |
}, | |
"networkSecurityGroupName": { | |
"type": "String" | |
}, | |
"networkSecurityGroupRules": { | |
"type": "Array" | |
}, | |
"virtualNetworkName": { | |
"type": "String" | |
}, | |
"addressPrefix": { | |
"type": "String" | |
}, | |
"subnetName": { | |
"type": "String" | |
}, | |
"subnetPrefix": { | |
"type": "String" | |
}, | |
"publicIpAddressName": { | |
"type": "String" | |
}, | |
"publicIpAddressType": { | |
"type": "String" | |
}, | |
"publicIpAddressSku": { | |
"type": "String" | |
}, | |
"virtualMachineName": { | |
"type": "String" | |
}, | |
"virtualMachineRG": { | |
"type": "String" | |
}, | |
"osDiskType": { | |
"type": "String" | |
}, | |
"virtualMachineSize": { | |
"type": "String" | |
}, | |
"adminUsername": { | |
"type": "String" | |
}, | |
"adminPublicKey": { | |
"type": "SecureString" | |
}, | |
"diagnosticsStorageAccountName": { | |
"type": "String" | |
}, | |
"diagnosticsStorageAccountId": { | |
"type": "String" | |
}, | |
"diagnosticsStorageAccountType": { | |
"type": "String" | |
}, | |
"diagnosticsStorageAccountKind": { | |
"type": "String" | |
} | |
}, | |
"variables": { | |
"nsgId": "[resourceId(resourceGroup().name, 'Microsoft.Network/networkSecurityGroups', parameters('networkSecurityGroupName'))]", | |
"vnetId": "[resourceId(resourceGroup().name,'Microsoft.Network/virtualNetworks', parameters('virtualNetworkName'))]", | |
"subnetRef": "[concat(variables('vnetId'), '/subnets/', parameters('subnetName'))]" | |
}, | |
"resources": [ | |
{ | |
"type": "Microsoft.Network/networkInterfaces", | |
"name": "[parameters('networkInterfaceName')]", | |
"apiVersion": "2018-04-01", | |
"location": "[parameters('location')]", | |
"tags": {}, | |
"properties": { | |
"ipConfigurations": [ | |
{ | |
"name": "ipconfig1", | |
"properties": { | |
"subnet": { | |
"id": "[variables('subnetRef')]" | |
}, | |
"privateIPAllocationMethod": "Dynamic", | |
"publicIpAddress": { | |
"id": "[resourceId(resourceGroup().name, 'Microsoft.Network/publicIpAddresses', parameters('publicIpAddressName'))]" | |
} | |
} | |
} | |
], | |
"networkSecurityGroup": { | |
"id": "[variables('nsgId')]" | |
} | |
}, | |
"dependsOn": [ | |
"[concat('Microsoft.Network/networkSecurityGroups/', parameters('networkSecurityGroupName'))]", | |
"[concat('Microsoft.Network/virtualNetworks/', parameters('virtualNetworkName'))]", | |
"[concat('Microsoft.Network/publicIpAddresses/', parameters('publicIpAddressName'))]" | |
] | |
}, | |
{ | |
"type": "Microsoft.Network/networkSecurityGroups", | |
"name": "[parameters('networkSecurityGroupName')]", | |
"apiVersion": "2018-08-01", | |
"location": "[parameters('location')]", | |
"tags": {}, | |
"properties": { | |
"securityRules": "[parameters('networkSecurityGroupRules')]" | |
} | |
}, | |
{ | |
"type": "Microsoft.Network/virtualNetworks", | |
"name": "[parameters('virtualNetworkName')]", | |
"apiVersion": "2018-08-01", | |
"location": "[parameters('location')]", | |
"tags": {}, | |
"properties": { | |
"addressSpace": { | |
"addressPrefixes": [ | |
"[parameters('addressPrefix')]" | |
] | |
}, | |
"subnets": [ | |
{ | |
"name": "[parameters('subnetName')]", | |
"properties": { | |
"addressPrefix": "[parameters('subnetPrefix')]" | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"type": "Microsoft.Network/publicIpAddresses", | |
"sku": { | |
"name": "[parameters('publicIpAddressSku')]" | |
}, | |
"name": "[parameters('publicIpAddressName')]", | |
"apiVersion": "2018-08-01", | |
"location": "[parameters('location')]", | |
"tags": {}, | |
"properties": { | |
"publicIpAllocationMethod": "[parameters('publicIpAddressType')]" | |
} | |
}, | |
{ | |
"type": "Microsoft.Compute/virtualMachines", | |
"name": "[parameters('virtualMachineName')]", | |
"apiVersion": "2018-04-01", | |
"location": "[parameters('location')]", | |
"tags": {}, | |
"properties": { | |
"hardwareProfile": { | |
"vmSize": "[parameters('virtualMachineSize')]" | |
}, | |
"storageProfile": { | |
"osDisk": { | |
"createOption": "fromImage", | |
"managedDisk": { | |
"storageAccountType": "[parameters('osDiskType')]" | |
} | |
}, | |
"imageReference": { | |
"publisher": "Canonical", | |
"offer": "UbuntuServer", | |
"sku": "16.04-LTS", | |
"version": "latest" | |
} | |
}, | |
"networkProfile": { | |
"networkInterfaces": [ | |
{ | |
"id": "[resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaceName'))]" | |
} | |
] | |
}, | |
"osProfile": { | |
"computerName": "[parameters('virtualMachineName')]", | |
"adminUsername": "[parameters('adminUsername')]", | |
"linuxConfiguration": { | |
"disablePasswordAuthentication": true, | |
"ssh": { | |
"publicKeys": [ | |
{ | |
"path": "[concat('/home/', parameters('adminUsername'), '/.ssh/authorized_keys')]", | |
"keyData": "[parameters('adminPublicKey')]" | |
} | |
] | |
} | |
} | |
}, | |
"diagnosticsProfile": { | |
"bootDiagnostics": { | |
"enabled": true, | |
"storageUri": "[concat('https://', parameters('diagnosticsStorageAccountName'), '.blob.core.windows.net/')]" | |
} | |
} | |
}, | |
"dependsOn": [ | |
"[concat('Microsoft.Network/networkInterfaces/', parameters('networkInterfaceName'))]", | |
"[concat('Microsoft.Storage/storageAccounts/', parameters('diagnosticsStorageAccountName'))]" | |
] | |
}, | |
{ | |
"type": "Microsoft.Storage/storageAccounts", | |
"sku": { | |
"name": "[parameters('diagnosticsStorageAccountType')]" | |
}, | |
"kind": "[parameters('diagnosticsStorageAccountKind')]", | |
"name": "[parameters('diagnosticsStorageAccountName')]", | |
"apiVersion": "2018-07-01", | |
"location": "[parameters('location')]", | |
"tags": {}, | |
"properties": {} | |
} | |
], | |
"outputs": { | |
"adminUsername": { | |
"type": "String", | |
"value": "[parameters('adminUsername')]" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment