Skip to content

Instantly share code, notes, and snippets.

@danapplegate
Last active November 22, 2023 08:26
Show Gist options
  • Save danapplegate/25eec620196c9ff6df271bc138f8eccc to your computer and use it in GitHub Desktop.
Save danapplegate/25eec620196c9ff6df271bc138f8eccc to your computer and use it in GitHub Desktop.
An Azure template to automate the creation of a Parsec-ready server and network firewall Windows Server 2016 instance.
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"vmName": {
"defaultValue": "parsec-azure",
"type": "string"
},
"userName": {
"defaultValue": "parsec",
"type": "string"
},
"userPassword": {
"defaultValue": "parsecServer123",
"type": "string"
},
"customData": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "String passed down to the Virtual Machine."
}
}
},
"variables": {
"storageName": "[uniqueString(resourceGroup().id)]",
"storageAccountName": "[concat('storage', variables('storageName'))]"
},
"resources": [
{
"name": "[variables('storageAccountName')]",
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2016-01-01",
"sku": {
"name": "Standard_LRS"
},
"kind": "Storage",
"location": "[resourceGroup().location]",
"tags": {},
"properties": {}
},
{
"location": "[resourceGroup().location]",
"type": "Microsoft.Compute/virtualMachines",
"name": "[parameters('vmName')]",
"apiVersion": "2016-04-30-preview",
"properties": {
"hardwareProfile": {
"vmSize": "Standard_NV6"
},
"storageProfile": {
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "2016-Datacenter",
"version": "latest"
},
"osDisk": {
"name": "[parameters('vmName')]",
"createOption": "fromImage",
"vhd": {
"uri": "[concat(concat(reference(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))).primaryEndpoints['blob'], 'vhds/'), parameters('vmName'), '.vhd')]"
}
}
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces', 'parsecNetworkInterface')]"
}
]
},
"osProfile": {
"adminUsername": "[parameters('userName')]",
"computerName": "[parameters('vmName')]",
"adminPassword": "[parameters('userPassword')]",
"customData": "[base64(parameters('customData'))]"
},
"provisioningState": 0,
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": false
}
}
},
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]",
"[resourceId('Microsoft.Network/networkInterfaces', 'parsecNetworkInterface')]"
]
},
{
"name": "parsecNetworkInterface",
"type": "Microsoft.Network/networkInterfaces",
"apiVersion": "2016-09-01",
"location": "[resourceGroup().location]",
"tags": {},
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAddress": "10.0.0.4",
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses', 'parsec-server-ip')]"
},
"subnet": {
"id": "[concat(resourceId('Microsoft.Network/virtualNetworks', 'parsec-servers-vnet'), '/subnets/default')]"
}
}
}
],
"networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', 'parsec-server-nsg')]"
}
},
"dependsOn": [
"[resourceId('Microsoft.Network/publicIPAddresses', 'parsec-server-ip')]",
"[resourceId('Microsoft.Network/virtualNetworks', 'parsec-servers-vnet')]",
"[resourceId('Microsoft.Network/networkSecurityGroups', 'parsec-server-nsg')]"
]
},
{
"type": "Microsoft.Network/publicIPAddresses",
"name": "parsec-server-ip",
"apiVersion": "2016-03-30",
"location": "[resourceGroup().location]",
"properties": {
"publicIPAllocationMethod": "Dynamic",
"idleTimeoutInMinutes": 4
},
"dependsOn": []
},
{
"type": "Microsoft.Network/virtualNetworks",
"name": "parsec-servers-vnet",
"apiVersion": "2016-03-30",
"location": "[resourceGroup().location]",
"properties": {
"addressSpace": {
"addressPrefixes": [
"10.0.0.0/24"
]
},
"subnets": [
{
"name": "default",
"properties": {
"addressPrefix": "10.0.0.0/24"
}
}
]
},
"dependsOn": []
},
{
"name": "parsec-server-nsg",
"type": "Microsoft.Network/networkSecurityGroups",
"apiVersion": "2016-09-01",
"location": "[resourceGroup().location]",
"tags": {},
"properties": {
"securityRules": [
{
"name": "default-allow-rdp",
"properties": {
"protocol": "TCP",
"sourcePortRange": "*",
"destinationPortRange": "3389",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 1000,
"direction": "Inbound"
}
},
{
"name": "parsec-server",
"properties": {
"protocol": "*",
"sourcePortRange": "*",
"destinationPortRange": "8000-8040",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 1020,
"direction": "Inbound"
}
}
]
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment