Skip to content

Instantly share code, notes, and snippets.

@jwstl
Created February 21, 2017 18:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwstl/d3b4cc62f1648346024df59d4853f993 to your computer and use it in GitHub Desktop.
Save jwstl/d3b4cc62f1648346024df59d4853f993 to your computer and use it in GitHub Desktop.
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"vmName": {
"type": "string",
"defaultValue": "Core613a",
"metadata": {
"description": "Core613a"
}
}
},
"variables": {
"addressPrefix": "10.1.0.0/16",
"adminPassword": "DTPass.01",
"adminUsername": "DTech",
"apiVersion": "2016-03-30",
"containerName": "vhds",
"dnsLabelPrefix": "[toLower(parameters('vmName'))]",
"domainLabel": "[parameters('vmName')]",
"frontEndNSGName": "[concat(parameters('vmName'),'-NSG')]",
"nicName": "[concat(parameters('vmName'),'-NIC')]",
"osDiskVhdUri": "[concat('https://',variables('storageAccountName'),'.blob.core.windows.net/',variables('containerName'),'/',parameters('vmName'),'.vhd')]",
"osType": "windows",
"publicIPAddressName": "[concat(parameters('vmName'),'-PIP')]",
"publicIPAddressType": "Dynamic",
"StorageAccountName1": "[toLower(parameters('vmName'))]",
"StorageAccountName2": "[replace(variables('StorageAccountName1'),'-','')]",
"StorageAccountName": "[concat(variables('StorageAccountName2'),'str')]",
"subnetName": "default",
"subnetPrefix": "10.1.0.0/24",
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]",
"virtualNetworkName": "[concat(parameters('vmName'),'-VNET')]",
"vmSize": "Standard_A5",
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]"
},
"resources": [
{
"apiVersion": "[variables('apiVersion')]",
"type": "Microsoft.Network/networkSecurityGroups",
"name": "[variables('frontEndNSGName')]",
"location": "[resourceGroup().location]",
"properties": {
"securityRules": [
{
"name": "rdp-rule",
"properties": {
"description": "Allow RDP",
"protocol": "Tcp",
"sourcePortRange": "*",
"destinationPortRange": "3389",
"sourceAddressPrefix": "Internet",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 100,
"direction": "Inbound"
}
},
{
"name": "web-rule",
"properties": {
"description": "Allow WEB",
"protocol": "Tcp",
"sourcePortRange": "*",
"destinationPortRange": "80",
"sourceAddressPrefix": "Internet",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 101,
"direction": "Inbound"
}
},
{
"name": "https-rule",
"properties": {
"description": "Allow HTTPS",
"protocol": "Tcp",
"sourcePortRange": "*",
"destinationPortRange": "443",
"sourceAddressPrefix": "Internet",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 102,
"direction": "Inbound"
}
}
]
}
},
{
"apiVersion": "[variables('apiVersion')]",
"type": "Microsoft.Network/virtualNetworks",
"name": "[variables('virtualNetworkName')]",
"location": "[resourceGroup().location]",
"dependsOn": [
"[concat('Microsoft.Network/networkSecurityGroups/', variables('frontEndNSGName'))]"
],
"properties": {
"addressSpace": {
"addressPrefixes": [
"[variables('addressPrefix')]"
]
},
"subnets": [
{
"name": "[variables('subnetName')]",
"properties": {
"addressPrefix": "[variables('subnetPrefix')]",
"networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('frontEndNSGName'))]"
}
}
}
]
}
},
{
"apiVersion": "[variables('apiVersion')]",
"type": "Microsoft.Network/networkInterfaces",
"name": "[variables('nicName')]",
"location": "[resourceGroup().location]",
"dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]",
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
],
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]"
},
"subnet": {
"id": "[variables('subnetRef')]"
}
}
}
]
}
},
{
"apiVersion": "[variables('apiVersion')]",
"type": "Microsoft.Network/publicIPAddresses",
"name": "[variables('publicIPAddressName')]",
"location": "[resourceGroup().location]",
"properties": {
"publicIPAllocationMethod": "[variables('publicIPAddressType')]",
"idleTimeoutInMinutes": 30,
"dnsSettings": {
"domainNameLabel": "[variables('dnsLabelPrefix')]"
}
}
},
{
"apiVersion": "[variables('apiVersion')]",
"type": "Microsoft.Compute/virtualMachines",
"name": "[parameters('vmName')]",
"location": "[resourceGroup().location]",
"dependsOn": [
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
],
"properties": {
"hardwareProfile": {
"vmSize": "[variables('vmSize')]"
},
"storageProfile": {
"osDisk": {
"caching": "ReadWrite",
"createOption": "Attach",
"name": "[concat(parameters('vmName'),'.-OS')]",
"osType": "[variables('osType')]",
"vhd": {
"uri": "[variables('osDiskVhdUri')]"
}
}
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]"
}
]
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment