201 строка
7.8 KiB
JSON
201 строка
7.8 KiB
JSON
{
|
|
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/deploymentTemplate.json#",
|
|
"contentVersion": "1.0.0.0",
|
|
"apiProfile": "2018-03-01-hybrid",
|
|
"parameters": {
|
|
"vmName": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "Name of the Virtual Machine to be created"
|
|
},
|
|
"defaultValue": "[substring(concat('WinVM-', uniqueString(resourceGroup().id)),0,12)]"
|
|
},
|
|
"adminUsername": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "Username for the Virtual Machine local administrator"
|
|
},
|
|
"defaultValue": "vmadmin"
|
|
},
|
|
"adminPassword": {
|
|
"type": "securestring",
|
|
"metadata": {
|
|
"description": "Password for the Virtual Machine local administrator. Default value is subscription id"
|
|
},
|
|
"defaultValue": "[concat('Subscription#',substring(resourcegroup().id,15,36))]"
|
|
},
|
|
"dcResourceGroupName": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "Name of the resource group that cointains the domain controller"
|
|
},
|
|
"defaultValue": "[resourceGroup().name]"
|
|
},
|
|
"dcVNetName": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "Name of the extisting VNet that contains the domain controller"
|
|
},
|
|
"defaultValue": "[concat('ADVNET',resourceGroup().name)]"
|
|
},
|
|
"dcSubnetName": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "Name of the existing subnet that contains the domain controller"
|
|
},
|
|
"defaultValue": "[concat('ADStaticSubnet',resourceGroup().name)]"
|
|
},
|
|
"domainToJoin": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "FQDN of the AD domain to join"
|
|
},
|
|
"defaultValue": "contoso.com"
|
|
},
|
|
"ouToJoin": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "Specifies an organizational unit (OU) for the domain account. Enter the full distinguished name of the OU in quotation marks. Example: 'OU=testOU; DC=domain; DC=Domain; DC=com'. This value can be empty"
|
|
},
|
|
"defaultValue": ""
|
|
},
|
|
"domainJoinOptions": {
|
|
"type": "int",
|
|
"metadata": {
|
|
"description": "Set of bit flags that define the join options. Default value of 3 is a combination of NETSETUP_JOIN_DOMAIN (0x00000001) & NETSETUP_ACCT_CREATE (0x00000002) i.e. will join the domain and create the account on the domain. For more information see https://msdn.microsoft.com/en-us/library/aa392154(v=vs.85).aspx"
|
|
},
|
|
"defaultValue": 3
|
|
},
|
|
"domainUserName": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "Username of the domain account to be used for joining the domain"
|
|
},
|
|
"defaultValue": "vmadmin"
|
|
},
|
|
"domainPassword": {
|
|
"type": "securestring",
|
|
"metadata": {
|
|
"description": "Password of the domain account to be used for joining the domain"
|
|
},
|
|
"defaultValue": "[concat('Subscription#',subscription().subscriptionId)]"
|
|
}
|
|
},
|
|
"variables": {
|
|
"vmExtensionName": "JsonADDomainExtension",
|
|
"vmDiskStorageAccountType": "Standard_LRS",
|
|
"vmSize": "Standard_A2",
|
|
"imagePublisher": "MicrosoftWindowsServer",
|
|
"imageOffer": "WindowsServer",
|
|
"imageSKU": "2016-Datacenter",
|
|
"imageVersion": "latest",
|
|
"OSDiskName": "[concat(parameters('vmName'),'-OSDisk')]",
|
|
"publicIPAddressName": "[concat(parameters('vmName'),'-pip')]",
|
|
"nicName": "[concat(parameters('vmName'),'-nic')]",
|
|
"vnetID": "[resourceId(parameters('dcResourceGroupName'), 'Microsoft.Network/virtualNetworks', parameters('dcVNetName'))]",
|
|
"subnetRef": "[concat(variables('vnetID'),'/subnets/', parameters('dcSubnetName'))]"
|
|
},
|
|
"resources": [
|
|
{
|
|
"type": "Microsoft.Network/publicIPAddresses",
|
|
"name": "[variables('publicIPAddressName')]",
|
|
"location": "[resourceGroup().location]",
|
|
"properties": {
|
|
"publicIPAllocationMethod": "Dynamic",
|
|
"dnsSettings": {
|
|
"domainNameLabel": "[toLower(parameters('vmName'))]"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "Microsoft.Network/networkInterfaces",
|
|
"name": "[variables('nicName')]",
|
|
"location": "[resourceGroup().location]",
|
|
"dependsOn": [
|
|
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]"
|
|
],
|
|
"properties": {
|
|
"ipConfigurations": [
|
|
{
|
|
"name": "ipconfig1",
|
|
"properties": {
|
|
"privateIPAllocationMethod": "Dynamic",
|
|
"publicIPAddress": {
|
|
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]"
|
|
},
|
|
"subnet": {
|
|
"id": "[variables('subnetRef')]"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"type": "Microsoft.Compute/virtualMachines",
|
|
"name": "[parameters('vmName')]",
|
|
"location": "[resourceGroup().location]",
|
|
"dependsOn": [
|
|
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
|
|
],
|
|
"properties": {
|
|
"hardwareProfile": {
|
|
"vmSize": "[variables('vmSize')]"
|
|
},
|
|
"osProfile": {
|
|
"computerName": "[parameters('vmName')]",
|
|
"adminUsername": "[parameters('adminUsername')]",
|
|
"adminPassword": "[parameters('adminPassword')]"
|
|
},
|
|
"storageProfile": {
|
|
"imageReference": {
|
|
"publisher": "[variables('imagePublisher')]",
|
|
"offer": "[variables('imageOffer')]",
|
|
"sku": "[variables('imageSKU')]",
|
|
"version": "[variables('imageVersion')]"
|
|
},
|
|
"osDisk": {
|
|
"name": "[variables('OSDiskName')]",
|
|
"managedDisk": {
|
|
"storageAccountType": "[variables('vmDiskStorageAccountType')]"
|
|
},
|
|
"caching": "ReadWrite",
|
|
"createOption": "FromImage"
|
|
}
|
|
},
|
|
"networkProfile": {
|
|
"networkInterfaces": [
|
|
{
|
|
"id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "Microsoft.Compute/virtualMachines/extensions",
|
|
"name": "[concat(parameters('vmName'),'/', variables('vmExtensionName'))]",
|
|
"location": "[resourceGroup().location]",
|
|
"dependsOn": [
|
|
"[concat('Microsoft.Compute/virtualMachines/', parameters('vmName'))]"
|
|
],
|
|
"properties": {
|
|
"publisher": "Microsoft.Compute",
|
|
"type": "JsonADDomainExtension",
|
|
"typeHandlerVersion": "1.3",
|
|
"autoUpgradeMinorVersion": true,
|
|
"settings": {
|
|
"Name": "[parameters('domainToJoin')]",
|
|
"OUPath": "[parameters('ouToJoin')]",
|
|
"User": "[concat(parameters('domainToJoin'), '\\', parameters('domainUserName'))]",
|
|
"Restart": "true",
|
|
"Options": "[parameters('domainJoinOptions')]"
|
|
},
|
|
"protectedsettings": {
|
|
"Password": "[parameters('domainPassword')]"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|