396 lines
14 KiB
JSON
396 lines
14 KiB
JSON
{
|
|
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
|
"contentVersion": "1.0.0.0",
|
|
"parameters": {
|
|
"machineName": {
|
|
"defaultValue": "",
|
|
"type": "string",
|
|
"minLength": 1,
|
|
"maxLength": 15,
|
|
"metadata": {
|
|
"description": "The name of the virtual machine. "
|
|
}
|
|
},
|
|
"adminUsername": {
|
|
"type": "string"
|
|
},
|
|
"adminPassword": {
|
|
"type": "securestring"
|
|
},
|
|
"diskType": {
|
|
"type": "string"
|
|
},
|
|
"exsitingVnetName": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "Existing VNET that contains the domain controller"
|
|
}
|
|
},
|
|
"vmSize": {
|
|
"type": "string"
|
|
},
|
|
"existingSubnetName": {
|
|
"defaultValue": "Subnet-1",
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "Existing subnet that contains the domain controller."
|
|
}
|
|
},
|
|
"existingPrimaryName": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "Computer name for the primary site server. "
|
|
}
|
|
},
|
|
"existingDomainFQDN": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "DomainName on the AD domain. "
|
|
}
|
|
},
|
|
"existingDomainAdminUsername": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "Username of the account on the AD domain. "
|
|
}
|
|
},
|
|
"existingDomainAdminPassword": {
|
|
"type": "securestring",
|
|
"metadata": {
|
|
"description": "Password of the account on the AD domain"
|
|
}
|
|
},
|
|
"existingStorageUrl": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "The storage Url. Example is like https://{storageaccountname}.blob.core.windows.net/{containername}/{blobname}. "
|
|
}
|
|
},
|
|
"existingSASKey": {
|
|
"type": "securestring",
|
|
"metadata": {
|
|
"description": "The sasToken required to access existingStorageUrl. It requires read and write permissions to save some temp data. "
|
|
}
|
|
},
|
|
"existingVnetResourcegroup": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "Existing azure virtual network resource group. "
|
|
}
|
|
},
|
|
"location": {
|
|
"type": "string",
|
|
"defaultValue": "[resourceGroup().location]",
|
|
"metadata": {
|
|
"description": "Location for all resources."
|
|
}
|
|
},
|
|
"RoleType": {
|
|
"type": "string",
|
|
"defaultValue": "Passive",
|
|
"allowedValues": [
|
|
"Passive",
|
|
"DP",
|
|
"MP",
|
|
"SUP",
|
|
"General"
|
|
],
|
|
"metadata": {
|
|
"description": "Role type of VM."
|
|
}
|
|
}
|
|
},
|
|
"variables": {
|
|
"Quotes": "\"",
|
|
"vnetId": "[resourceId(parameters('existingVnetResourcegroup'), 'Microsoft.Network/virtualNetworks', parameters('exsitingVnetName'))]",
|
|
"networkSettings": {
|
|
"subnetRef": "[concat(variables('vnetId'), '/subnets/',parameters('existingSubnetName'))]",
|
|
"privateIPAllocationMethod": "Dynamic",
|
|
"privateIPAddressVersion": "IPv4"
|
|
},
|
|
"securityGroupRule": {
|
|
"name": "default-allow-rdp",
|
|
"priority": 1000,
|
|
"sourceAddressPrefix": "*",
|
|
"protocol": "Tcp",
|
|
"destinationPortRange": "3389",
|
|
"access": "Allow",
|
|
"direction": "Inbound",
|
|
"sourcePortRange": "*",
|
|
"destinationAddressPrefix": "*"
|
|
}
|
|
},
|
|
"resources": [
|
|
{
|
|
"type": "Microsoft.Compute/virtualMachines",
|
|
"apiVersion": "2018-06-01",
|
|
"name": "[parameters('machineName')]",
|
|
"location": "[parameters('location')]",
|
|
"dependsOn": [
|
|
"[concat('Microsoft.Network/networkInterfaces/', toLower(parameters('machineName')), '-ni')]"
|
|
],
|
|
"properties": {
|
|
"osProfile": {
|
|
"computerName": "[parameters('machineName')]",
|
|
"adminUsername": "[parameters('adminUsername')]",
|
|
"adminPassword": "[parameters('adminPassword')]",
|
|
"windowsConfiguration": {
|
|
"provisionVmAgent": "true"
|
|
}
|
|
},
|
|
"hardwareProfile": {
|
|
"vmSize": "[parameters('vmSize')]"
|
|
},
|
|
"storageProfile": {
|
|
"imageReference": {
|
|
"publisher": "MicrosoftWindowsServer",
|
|
"offer": "WindowsServer",
|
|
"sku": "2019-Datacenter",
|
|
"version": "latest"
|
|
},
|
|
"osDisk": {
|
|
"osType": "Windows",
|
|
"name": "[concat(parameters('machineName'),'-OsDisk')]",
|
|
"createOption": "FromImage",
|
|
"caching": "ReadWrite",
|
|
"managedDisk": {
|
|
"storageAccountType": "[parameters('diskType')]"
|
|
},
|
|
"diskSizeGB": 150
|
|
},
|
|
"dataDisks": []
|
|
},
|
|
"networkProfile": {
|
|
"networkInterfaces": [
|
|
{
|
|
"id": "[resourceId('Microsoft.Network/networkInterfaces', concat(toLower(parameters('machineName')), '-ni'))]"
|
|
}
|
|
]
|
|
},
|
|
"diagnosticsProfile": {
|
|
"bootDiagnostics": {
|
|
"enabled": false
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"condition": "[equals(parameters('RoleType'),'Passive')]",
|
|
"type": "Microsoft.Compute/virtualMachines/extensions",
|
|
"apiVersion": "2018-06-01",
|
|
"name": "[concat(parameters('machineName'),'/WorkFlow-Passive')]",
|
|
"location": "[parameters('location')]",
|
|
"dependsOn": [
|
|
"[concat('Microsoft.Compute/virtualMachines/',parameters('machineName'))]"
|
|
],
|
|
"properties": {
|
|
"publisher": "Microsoft.Powershell",
|
|
"type": "DSC",
|
|
"typeHandlerVersion": "2.21",
|
|
"autoUpgradeMinorVersion": true,
|
|
"settings": {
|
|
"modulesUrl": "[Uri(parameters('existingStorageUrl'),concat('scripts/DSCConfiguration.zip',parameters('existingSASKey')))]",
|
|
"configurationFunction": "PassiveConfiguration.ps1\\Passiveconfiguration",
|
|
"Properties": {
|
|
"DomainName": "[parameters('existingDomainFQDN')]",
|
|
"AdminCreds": {
|
|
"UserName": "[parameters('existingDomainAdminUsername')]",
|
|
"Password": "PrivateSettingsRef:DomainAdminPassword"
|
|
},
|
|
"Primaryname": "[parameters('existingPrimaryName')]"
|
|
}
|
|
},
|
|
"protectedSettings": {
|
|
"Items": {
|
|
"DomainAdminPassword": "[parameters('existingDomainAdminPassword')]"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"condition": "[equals(parameters('RoleType'),'MP')]",
|
|
"type": "Microsoft.Compute/virtualMachines/extensions",
|
|
"apiVersion": "2018-06-01",
|
|
"name": "[concat(parameters('machineName'),'/WorkFlow-MP')]",
|
|
"location": "[parameters('location')]",
|
|
"dependsOn": [
|
|
"[concat('Microsoft.Compute/virtualMachines/',parameters('machineName'))]"
|
|
],
|
|
"properties": {
|
|
"publisher": "Microsoft.Powershell",
|
|
"type": "DSC",
|
|
"typeHandlerVersion": "2.21",
|
|
"autoUpgradeMinorVersion": true,
|
|
"settings": {
|
|
"modulesUrl": "[Uri(parameters('existingStorageUrl'),concat('scripts/DSCConfiguration.zip',parameters('existingSASKey')))]",
|
|
"configurationFunction": "MPConfiguration.ps1\\MPconfiguration",
|
|
"Properties": {
|
|
"DomainName": "[parameters('existingDomainFQDN')]",
|
|
"AdminCreds": {
|
|
"UserName": "[parameters('existingDomainAdminUsername')]",
|
|
"Password": "PrivateSettingsRef:DomainAdminPassword"
|
|
},
|
|
"PrimaryName": "[parameters('existingPrimaryName')]"
|
|
}
|
|
},
|
|
"protectedSettings": {
|
|
"Items": {
|
|
"DomainAdminPassword": "[parameters('existingDomainAdminPassword')]"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"condition": "[equals(parameters('RoleType'),'DP')]",
|
|
"type": "Microsoft.Compute/virtualMachines/extensions",
|
|
"apiVersion": "2018-06-01",
|
|
"name": "[concat(parameters('machineName'),'/WorkFlow-DP')]",
|
|
"location": "[parameters('location')]",
|
|
"dependsOn": [
|
|
"[concat('Microsoft.Compute/virtualMachines/',parameters('machineName'))]"
|
|
],
|
|
"properties": {
|
|
"publisher": "Microsoft.Powershell",
|
|
"type": "DSC",
|
|
"typeHandlerVersion": "2.21",
|
|
"autoUpgradeMinorVersion": true,
|
|
"settings": {
|
|
"modulesUrl": "[Uri(parameters('existingStorageUrl'),concat('scripts/DSCConfiguration.zip',parameters('existingSASKey')))]",
|
|
"configurationFunction": "DPConfiguration.ps1\\DPconfiguration",
|
|
"Properties": {
|
|
"DomainName": "[parameters('existingDomainFQDN')]",
|
|
"AdminCreds": {
|
|
"UserName": "[parameters('existingDomainAdminUsername')]",
|
|
"Password": "PrivateSettingsRef:DomainAdminPassword"
|
|
},
|
|
"Primaryname": "[parameters('existingPrimaryName')]"
|
|
}
|
|
},
|
|
"protectedSettings": {
|
|
"Items": {
|
|
"DomainAdminPassword": "[parameters('existingDomainAdminPassword')]"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"condition": "[equals(parameters('RoleType'),'SUP')]",
|
|
"type": "Microsoft.Compute/virtualMachines/extensions",
|
|
"apiVersion": "2018-06-01",
|
|
"name": "[concat(parameters('machineName'),'/WorkFlow-SUP')]",
|
|
"location": "[parameters('location')]",
|
|
"dependsOn": [
|
|
"[concat('Microsoft.Compute/virtualMachines/',parameters('machineName'))]"
|
|
],
|
|
"properties": {
|
|
"publisher": "Microsoft.Powershell",
|
|
"type": "DSC",
|
|
"typeHandlerVersion": "2.21",
|
|
"autoUpgradeMinorVersion": true,
|
|
"settings": {
|
|
"modulesUrl": "[Uri(parameters('existingStorageUrl'),concat('scripts/DSCConfiguration.zip',parameters('existingSASKey')))]",
|
|
"configurationFunction": "SUPConfiguration.ps1\\SUPconfiguration",
|
|
"Properties": {
|
|
"DomainName": "[parameters('existingDomainFQDN')]",
|
|
"AdminCreds": {
|
|
"UserName": "[parameters('existingDomainAdminUsername')]",
|
|
"Password": "PrivateSettingsRef:DomainAdminPassword"
|
|
},
|
|
"Primaryname": "[parameters('existingPrimaryName')]"
|
|
}
|
|
},
|
|
"protectedSettings": {
|
|
"Items": {
|
|
"DomainAdminPassword": "[parameters('existingDomainAdminPassword')]"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"condition": "[equals(parameters('RoleType'),'General')]",
|
|
"type": "Microsoft.Compute/virtualMachines/extensions",
|
|
"apiVersion": "2018-06-01",
|
|
"name": "[concat(parameters('machineName'),'/WorkFlow-General')]",
|
|
"location": "[parameters('location')]",
|
|
"dependsOn": [
|
|
"[concat('Microsoft.Compute/virtualMachines/',parameters('machineName'))]"
|
|
],
|
|
"properties": {
|
|
"publisher": "Microsoft.Powershell",
|
|
"type": "DSC",
|
|
"typeHandlerVersion": "2.21",
|
|
"autoUpgradeMinorVersion": true,
|
|
"settings": {
|
|
"modulesUrl": "[Uri(parameters('existingStorageUrl'),concat('scripts/DSCConfiguration.zip',parameters('existingSASKey')))]",
|
|
"configurationFunction": "GeneralConfiguration.ps1\\Generalconfiguration",
|
|
"Properties": {
|
|
"DomainName": "[parameters('existingDomainFQDN')]",
|
|
"AdminCreds": {
|
|
"UserName": "[parameters('existingDomainAdminUsername')]",
|
|
"Password": "PrivateSettingsRef:DomainAdminPassword"
|
|
},
|
|
"Primaryname": "[parameters('existingPrimaryName')]"
|
|
}
|
|
},
|
|
"protectedSettings": {
|
|
"Items": {
|
|
"DomainAdminPassword": "[parameters('existingDomainAdminPassword')]"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "Microsoft.Network/networkInterfaces",
|
|
"apiVersion": "2018-08-01",
|
|
"name": "[concat(toLower(parameters('machineName')), '-ni')]",
|
|
"location": "[parameters('location')]",
|
|
"dependsOn": [
|
|
"[concat('Microsoft.Network/networkSecurityGroups/', parameters('machineName'), '-nsg')]"
|
|
],
|
|
"properties": {
|
|
"ipConfigurations": [
|
|
{
|
|
"name": "ipconfig1",
|
|
"properties": {
|
|
"subnet": {
|
|
"id": "[variables('networkSettings').subnetRef]"
|
|
},
|
|
"privateIPAllocationMethod": "[variables('networkSettings').privateIPAllocationMethod]",
|
|
"privateIPAddressVersion": "[variables('networkSettings').privateIPAddressVersion]"
|
|
}
|
|
}
|
|
],
|
|
"networkSecurityGroup": {
|
|
"id": "[resourceId(resourceGroup().name, 'Microsoft.Network/networkSecurityGroups', concat(parameters('machineName'), '-nsg'))]"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "Microsoft.Network/networkSecurityGroups",
|
|
"apiVersion": "2018-08-01",
|
|
"name": "[concat(parameters('machineName'), '-nsg')]",
|
|
"location": "[parameters('location')]",
|
|
"properties": {
|
|
"securityRules": [
|
|
{
|
|
"name": "[variables('securityGroupRule').name]",
|
|
"properties": {
|
|
"priority": "[variables('securityGroupRule').priority]",
|
|
"sourceAddressPrefix": "[variables('securityGroupRule').sourceAddressPrefix]",
|
|
"protocol": "[variables('securityGroupRule').protocol]",
|
|
"destinationPortRange": "[variables('securityGroupRule').destinationPortRange]",
|
|
"access": "[variables('securityGroupRule').access]",
|
|
"direction": "[variables('securityGroupRule').direction]",
|
|
"sourcePortRange": "[variables('securityGroupRule').sourcePortRange]",
|
|
"destinationAddressPrefix": "[variables('securityGroupRule').destinationAddressPrefix]"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"outputs": {
|
|
|
|
}
|
|
}
|