Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
232 lines (232 sloc) 7.65 KB
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"image_location": {
"type": "string"
},
"imageName": {
"type": "string"
},
"image_Resourcegroup_name": {
"type": "string"
},
"virtualMachineName": {
"type": "string",
"metadata": {
"description": "Name for the Virtual Machine to be provisioned. Azure resource names cannot contain special characters \"/[]:|<>+=;,?*@& or begin with ' _ or end with '. or - Virtual machine name must be unique in the current resource group."
},
"minLength": 1,
"maxLength": 15
},
"virtualMachineSize": {
"type": "string",
"metadata": {
"description": "Size of the virtual machine."
},
"allowedValues": [
"Standard_A0",
"Standard_A1",
"Standard_A2",
"Standard_A3",
"Standard_A4",
"Standard_A5",
"Standard_A6",
"Standard_A7",
"Standard_D2_v3",
"Standard_D4_v3",
"Standard_D8_v3",
"Standard_D1_v2",
"Standard_D2_v2",
"Standard_D3_v2",
"Standard_D4_v2",
"Standard_A1_v2",
"Standard_A2_v2",
"Standard_A4_v2",
"Standard_A8_v2"
]
},
"adminUsername": {
"type": "string",
"metadata": {
"description": "Username for the Virtual Machine.Username cannot contain special characters \"/[]:|<>+=;,?*@& or end with '.'"
},
"minLength": 1,
"maxLength": 20
},
"adminPassword": {
"type": "secureString",
"metadata": {
"description": "Password for the Virtual Machine.Password must have 3 of the following: 1 lower case character, 1 upper case character, 1 number, and 1 special character"
},
"minLength": 12,
"maxLength": 123
}
},
"variables": {
"publicIpAddressName": "[concat(parameters('virtualMachineName'), '-ip')]",
"networkInterfaceName": "[concat(parameters('virtualMachineName'), take(uniquestring(parameters('virtualMachineName'), deployment().name), 3))]",
"virtualNetworkName": "[concat('csvnet', take(uniquestring(parameters('virtualMachineName'), deployment().name), 6))]",
"addressPrefixes": "10.6.0.0/24",
"subnet_prefix": "10.6.0.0/24",
"networkSecurityGroupName": "[concat(parameters('virtualMachineName'), '-nsg')]",
"subnetName": "default",
"diagnosticsStorageAccountName": "[concat('storagediag', take(uniquestring(parameters('virtualMachineName'),deployment().name), 6))]",
"nsgId": "[resourceId(resourceGroup().name, 'Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]",
"vnetId": "[resourceId(resourceGroup().name,'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]",
"subnetRef": "[concat(variables('vnetId'), '/subnets/', variables('subnetName'))]"
},
"resources": [
{
"name": "[variables('networkInterfaceName')]",
"type": "Microsoft.Network/networkInterfaces",
"apiVersion": "2019-07-01",
"location": "[parameters('image_location')]",
"dependsOn": [
"[concat('Microsoft.Network/networkSecurityGroups/', variables('networkSecurityGroupName'))]",
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]",
"[concat('Microsoft.Network/publicIpAddresses/', variables('publicIpAddressName'))]"
],
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"subnet": {
"id": "[variables('subnetRef')]"
},
"privateIPAllocationMethod": "Dynamic",
"publicIpAddress": {
"id": "[resourceId(resourceGroup().name, 'Microsoft.Network/publicIpAddresses', variables('publicIpAddressName'))]"
}
}
}
],
"networkSecurityGroup": {
"id": "[variables('nsgId')]"
}
}
},
{
"name": "[variables('networkSecurityGroupName')]",
"type": "Microsoft.Network/networkSecurityGroups",
"apiVersion": "2019-02-01",
"location": "[parameters('image_location')]",
"properties": {
"securityRules": [
{
"name": "RDP",
"properties": {
"priority": 300,
"protocol": "TCP",
"access": "Allow",
"direction": "Inbound",
"sourceAddressPrefix": "*",
"sourcePortRange": "*",
"destinationAddressPrefix": "*",
"destinationPortRange": "3389"
}
}
]
}
},
{
"name": "[variables('virtualNetworkName')]",
"type": "Microsoft.Network/virtualNetworks",
"apiVersion": "2018-08-01",
"location": "[parameters('image_location')]",
"properties": {
"addressSpace": {
"addressPrefixes": [
"[variables('addressPrefixes')]"
]
},
"subnets": [
{
"name": "[variables('subnetName')]",
"properties": {
"addressPrefix": "[variables('subnet_prefix')]"
}
}
]
}
},
{
"name": "[variables('publicIpAddressName')]",
"type": "Microsoft.Network/publicIpAddresses",
"apiVersion": "2019-02-01",
"location": "[parameters('image_location')]",
"properties": {
"publicIpAllocationMethod": "Static"
},
"sku": {
"name": "Standard"
}
},
{
"name": "[parameters('virtualMachineName')]",
"type": "Microsoft.Compute/virtualMachines",
"apiVersion": "2019-07-01",
"location": "[parameters('image_location')]",
"dependsOn": [
"[concat('Microsoft.Network/networkInterfaces/', variables('networkInterfaceName'))]",
"[concat('Microsoft.Storage/storageAccounts/', variables('diagnosticsStorageAccountName'))]"
],
"properties": {
"hardwareProfile": {
"vmSize": "[parameters('virtualMachineSize')]"
},
"storageProfile": {
"osDisk": {
"createOption": "fromImage",
"managedDisk": {
"storageAccountType": "Standard_LRS"
}
},
"imageReference": {
"id": "[resourceId(parameters('image_Resourcegroup_name'),'Microsoft.Compute/images', parameters('imageName'))]"
}
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces', variables('networkInterfaceName'))]"
}
]
},
"osProfile": {
"computerName": "[parameters('virtualMachineName')]",
"adminUsername": "[parameters('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]",
"windowsConfiguration": {
"enableAutomaticUpdates": true,
"provisionVmAgent": true
}
},
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": true,
"storageUri": "[concat('https://', variables('diagnosticsStorageAccountName'), '.blob.core.windows.net/')]"
}
}
}
},
{
"name": "[variables('diagnosticsStorageAccountName')]",
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2019-06-01",
"location": "[parameters('image_location')]",
"properties": {},
"kind": "Storage",
"sku": {
"name": "Standard_LRS"
}
}
],
"outputs": {
"adminUsername": {
"type": "string",
"value": "[parameters('adminUsername')]"
}
}
}
You can’t perform that action at this time.