Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
- "contentVersion": "1.0.0.0",
- "parameters": {
- "location": {
- "type": "string",
- "defaultValue": "[resourceGroup().location]"
- },
- "networkInterfaceName": {
- "type": "string"
- },
- "projectName": {
- "type": "string"
- },
- "networkSecurityGroupName": {
- "type": "string",
- "defaultValue": "[concat(parameters('projectName'), 'Nsg')]"
- },
- "networkSecurityGroupRules": {
- "type": "array",
- "defaultValue":
- [
- {
- "name": "SSH",
- "properties": {
- "priority": 300,
- "protocol": "TCP",
- "access": "Allow",
- "direction": "Inbound",
- "sourceAddressPrefix": "*",
- "sourcePortRange": "*",
- "destinationAddressPrefix": "*",
- "destinationPortRange": "22"
- }
- }
- ]
- },
- "subnetName": {
- "type": "string",
- "defaultValue": "default"
- },
- "virtualNetworkName": {
- "type": "string",
- "defaultValue": "[concat(resourceGroup().name, '-vnet')]"
- },
- "addressPrefixes": {
- "type": "array",
- "defaultValue": [
- "10.0.0.0/24"
- ]
- },
- "subnets": {
- "type": "array",
- "defaultValue": [
- {
- "name": "default",
- "properties": {
- "addressPrefix": "10.0.0.0/24"
- }
- }
- ]
- },
- "publicIpAddressName": {
- "type": "string"
- },
- "virtualMachineName": {
- "type": "string"
- },
- "osDiskType": {
- "type": "string",
- "defaultValue": "Standard_LRS"
- },
- "virtualMachineSize": {
- "type": "string",
- "defaultValue": "Standard_B1ls"
- },
- "adminUsername": {
- "type": "string"
- },
- "adminPassword": {
- "type": "securestring"
- }
- },
- "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": [
- {
- "name": "[parameters('networkInterfaceName')]",
- "type": "Microsoft.Network/networkInterfaces",
- "apiVersion": "2019-07-01",
- "location": "[parameters('location')]",
- "dependsOn": [
- "[concat('Microsoft.Network/networkSecurityGroups/', parameters('networkSecurityGroupName'))]",
- "[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(resourceGroup().name, 'Microsoft.Network/publicIpAddresses', parameters('publicIpAddressName'))]"
- }
- }
- }
- ],
- "networkSecurityGroup": {
- "id": "[variables('nsgId')]"
- }
- }
- },
- {
- "name": "[parameters('networkSecurityGroupName')]",
- "type": "Microsoft.Network/networkSecurityGroups",
- "apiVersion": "2019-02-01",
- "location": "[parameters('location')]",
- "properties": {
- "securityRules": "[parameters('networkSecurityGroupRules')]"
- }
- },
- {
- "name": "[parameters('virtualNetworkName')]",
- "type": "Microsoft.Network/virtualNetworks",
- "apiVersion": "2019-04-01",
- "location": "[parameters('location')]",
- "properties": {
- "addressSpace": {
- "addressPrefixes": "[parameters('addressPrefixes')]"
- },
- "subnets": "[parameters('subnets')]"
- }
- },
- {
- "name": "[parameters('publicIpAddressName')]",
- "type": "Microsoft.Network/publicIpAddresses",
- "apiVersion": "2019-02-01",
- "location": "[parameters('location')]",
- "properties": {
- "publicIpAllocationMethod": "Dynamic"
- },
- "sku": {
- "name": "Basic"
- }
- },
- {
- "name": "[parameters('virtualMachineName')]",
- "type": "Microsoft.Compute/virtualMachines",
- "apiVersion": "2019-07-01",
- "location": "[parameters('location')]",
- "dependsOn": [
- "[concat('Microsoft.Network/networkInterfaces/', parameters('networkInterfaceName'))]"
- ],
- "properties": {
- "hardwareProfile": {
- "vmSize": "[parameters('virtualMachineSize')]"
- },
- "storageProfile": {
- "osDisk": {
- "createOption": "fromImage",
- "managedDisk": {
- "storageAccountType": "[parameters('osDiskType')]"
- }
- },
- "imageReference": {
- "publisher": "Canonical",
- "offer": "UbuntuServer",
- "sku": "18.04-LTS",
- "version": "latest"
- }
- },
- "networkProfile": {
- "networkInterfaces": [
- {
- "id": "[resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaceName'))]"
- }
- ]
- },
- "osProfile": {
- "computerName": "[parameters('virtualMachineName')]",
- "adminUsername": "[parameters('adminUsername')]",
- "adminPassword": "[parameters('adminPassword')]"
- }
- },
- "identity": {
- "type": "systemAssigned"
- }
- }
- ]
- }
Advertisement
Add Comment
Please, Sign In to add comment