218 строки
8.3 KiB
JSON
218 строки
8.3 KiB
JSON
{
|
|
"$schema": "https://schema.management.azure.com/schemas/2015-01-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('simplewinvm',resourceGroup().Name),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",
|
|
"storageAccountName": "[toLower(concat(resourceGroup().name,'sa'))]",
|
|
"storageAccountType": "Standard_LRS",
|
|
"vmStorageAccountContainerName": "vhds",
|
|
"vmSize": "Standard_A2",
|
|
"imagePublisher": "MicrosoftWindowsServer",
|
|
"imageOffer": "WindowsServer",
|
|
"imageSKU": "2016-Datacenter",
|
|
"imageVersion": "latest",
|
|
"OSDiskName": "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.Storage/storageAccounts",
|
|
"name": "[variables('storageAccountName')]",
|
|
"location": "[resourceGroup().location]",
|
|
"sku": {
|
|
"name": "[variables('storageAccountType')]"
|
|
},
|
|
"kind": "Storage"
|
|
},
|
|
{
|
|
"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.Storage/storageAccounts/', variables('storageAccountName'))]",
|
|
"[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')]",
|
|
"vhd": {
|
|
"uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).primaryEndpoints.blob, variables('vmStorageAccountContainerName'),'/',variables('OSDiskName'),'.vhd')]"
|
|
},
|
|
"caching": "ReadWrite",
|
|
"createOption": "FromImage"
|
|
}
|
|
},
|
|
"networkProfile": {
|
|
"networkInterfaces": [
|
|
{
|
|
"id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]"
|
|
}
|
|
]
|
|
},
|
|
"diagnosticsProfile": {
|
|
"bootDiagnostics": {
|
|
"enabled": "true",
|
|
"storageUri": "[reference(concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).primaryEndpoints.blob]"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"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')]"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
} |