Created
September 24, 2017 16:11
-
-
Save jacqinthebox/5ecd6f69457806e9550694653ebcc0b5 to your computer and use it in GitHub Desktop.
ARM Template with copyindex #arm #azure
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", | |
| "contentVersion": "1.0.0.0", | |
| "parameters": { | |
| "Hostheader": { | |
| "type": "string", | |
| "defaultValue": "servicebus.customername.org", | |
| "metadata": { | |
| "description": "Add the hostheader for the BizTalk Webservice" | |
| } | |
| }, | |
| "NumberOfBizTalkServers": { | |
| "type": "int", | |
| "defaultValue": 1, | |
| "metadata": { | |
| "description": "Add the number of BizTalk servers" | |
| } | |
| }, | |
| "BtsVmSize": { | |
| "type": "string", | |
| "defaultValue": "Standard_F2s", | |
| "allowedValues": [ | |
| "Standard_F2s", | |
| "Standard_F4s" | |
| ] | |
| }, | |
| "StorageType": { | |
| "type": "string", | |
| "defaultValue": "Premium_LRS" | |
| }, | |
| "BootDiagnosticsStorageType": { | |
| "type": "string", | |
| "defaultValue": "Standard_LRS" | |
| }, | |
| "StorageName": { | |
| "type": "string", | |
| "defaultValue": "btsteststorage", | |
| "metadata": { | |
| "description": "Should be unique, lowercase and max 24 chars" | |
| } | |
| }, | |
| "virtualNetworkSubnet": { | |
| "type": "string", | |
| "defaultValue": "TestBackendSubnet" | |
| }, | |
| "virtualNetworkName": { | |
| "type": "string", | |
| "defaultValue": "rit-01-vn" | |
| }, | |
| "virtualNetworkResourceGroup": { | |
| "type": "string", | |
| "defaultValue": "core-networking-rg" | |
| }, | |
| "FQDN": { | |
| "type": "string", | |
| "minLength": 1, | |
| "metadata": { | |
| "description": "This the FQDN from the domain that will be joined" | |
| } | |
| }, | |
| "BtsNode1Name": { | |
| "type": "string", | |
| "minLength": 1 | |
| }, | |
| "SqlName": { | |
| "type": "string", | |
| "minLength": 1 | |
| }, | |
| "BtsNode1Ip": { | |
| "type": "string", | |
| "minLength": 1, | |
| "metadata": { | |
| "description": "IP adress WITHOUT the last digit. E.g. 192.168.0.25 (if you want the IP to be 192.168.0.251)" | |
| } | |
| }, | |
| "SqlIp": { | |
| "type": "string", | |
| "minLength": 1 | |
| }, | |
| "AdminUserName": { | |
| "type": "string", | |
| "minLength": 1 | |
| }, | |
| "AdminPassword": { | |
| "type": "securestring" | |
| }, | |
| "WindowsOSVersion": { | |
| "type": "string", | |
| "defaultValue": "2016-Datacenter" | |
| }, | |
| "DomainAdminUserName": { | |
| "type": "string", | |
| "minLength": 1, | |
| "metadata": { | |
| "description": "username of the domain admin that can join the server to the domain" | |
| } | |
| }, | |
| "DomainPassword": { | |
| "type": "securestring", | |
| "metadata": { | |
| "description": "password of the domain admin that can join the server to the domain" | |
| } | |
| }, | |
| "_artifactsLocation": { | |
| "type": "string", | |
| "metadata": { | |
| "description": "Auto-generated container in staging storage account to receive post-build staging folder upload" | |
| } | |
| }, | |
| "_artifactsLocationSasToken": { | |
| "type": "securestring", | |
| "metadata": { | |
| "description": "Auto-generated token to access _artifactsLocation" | |
| } | |
| } | |
| }, | |
| "variables": { | |
| "Backslash": "\\", | |
| "storageName": "[parameters('StorageName')]", | |
| "diagnosticsStorageName": "[concat('diag', uniqueString(resourceGroup().id))]", | |
| "ImagePublisher": "MicrosoftWindowsServer", | |
| "ImageOffer": "WindowsServer", | |
| "BtsNode1OSDiskName": "[concat(parameters('BtsNode1Name'),'-OSDisk')]", | |
| "SqlOSDiskName": "SqlOSDisk", | |
| "BtsVmSize": "Standard_F2s", | |
| "SqlVmSize": "Standard_DS2_v2", | |
| "VnetID": "[resourceId(parameters('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', parameters('virtualNetworkName'))]", | |
| "SubnetRef": "[concat(variables('VnetID'), '/subnets/', parameters('virtualNetworkSubnet'))]", | |
| "StorageAccountContainerName": "vhds", | |
| "BtsNode1NicName": "[concat(parameters('BtsNode1Name'),'-nic')]", | |
| "SqlNicName": "[concat(parameters('SqlName'), '-nic')]", | |
| "BizTalkConfigurationArchiveFolder": "DSC", | |
| "BizTalkConfigurationArchiveFileName": "BizTalkConfiguration.zip", | |
| "SqlConfigurationArchiveFolder": "DSC", | |
| "SqlConfigurationArchiveFileName": "SqlConfiguration.zip", | |
| "PrepareServerScriptFolder": "CustomScripts", | |
| "PrepareServerScriptFileName": "PrepareServer.ps1" | |
| }, | |
| "resources": [ | |
| { | |
| "name": "[variables('storageName')]", | |
| "type": "Microsoft.Storage/storageAccounts", | |
| "location": "[resourceGroup().location]", | |
| "apiVersion": "2016-01-01", | |
| "sku": { | |
| "name": "[parameters('storageType')]" | |
| }, | |
| "dependsOn": [], | |
| "tags": { | |
| "displayName": "StorageName" | |
| }, | |
| "kind": "Storage" | |
| }, | |
| { | |
| "name": "[variables('diagnosticsstorageName')]", | |
| "type": "Microsoft.Storage/storageAccounts", | |
| "location": "[resourceGroup().location]", | |
| "apiVersion": "2016-01-01", | |
| "sku": { | |
| "name": "[parameters('BootDiagnosticsstorageType')]" | |
| }, | |
| "dependsOn": [], | |
| "tags": { | |
| "displayName": "DiagnosticsStorageName" | |
| }, | |
| "kind": "Storage" | |
| }, | |
| { | |
| "name": "[concat(variables('BtsNode1NicName'),copyIndex(1))]", | |
| "type": "Microsoft.Network/networkInterfaces", | |
| "location": "westeurope", | |
| "apiVersion": "2016-03-30", | |
| "dependsOn": [], | |
| "tags": { | |
| "displayName": "[concat(variables('BtsNode1NicName'),copyIndex(1))]" | |
| }, | |
| "copy": { | |
| "name": "BizTalkServerNicCopy", | |
| "count": "[parameters('NumberOfBizTalkServers')]" | |
| }, | |
| "properties": { | |
| "ipConfigurations": [ | |
| { | |
| "name": "ipconfig1", | |
| "properties": { | |
| "privateIPAllocationMethod": "Static", | |
| "privateIPAddress": "[concat(parameters('BtsNode1Ip'),copyIndex(1))]", | |
| "subnet": { | |
| "id": "[variables('SubnetRef')]" | |
| } | |
| } | |
| } | |
| ] | |
| } | |
| }, | |
| { | |
| "name": "[variables('SqlNicName')]", | |
| "type": "Microsoft.Network/networkInterfaces", | |
| "location": "westeurope", | |
| "apiVersion": "2016-03-30", | |
| "dependsOn": [], | |
| "tags": { | |
| "displayName": "SqlNic" | |
| }, | |
| "properties": { | |
| "ipConfigurations": [ | |
| { | |
| "name": "ipconfig1", | |
| "properties": { | |
| "privateIPAllocationMethod": "Static", | |
| "privateIPAddress": "[parameters('SqlIp')]", | |
| "subnet": { | |
| "id": "[variables('SubnetRef')]" | |
| } | |
| } | |
| } | |
| ] | |
| } | |
| }, | |
| { | |
| "name": "[parameters('SqlName')]", | |
| "type": "Microsoft.Compute/virtualMachines", | |
| "location": "[resourceGroup().location]", | |
| "apiVersion": "2015-06-15", | |
| "tags": { | |
| "displayName": "SqlServer" | |
| }, | |
| "dependsOn": [ | |
| "[resourceId('Microsoft.Storage/storageAccounts', variables('storageName'))]", | |
| "[resourceId('Microsoft.Network/networkInterfaces', variables('SqlNicName'))]" | |
| ], | |
| "properties": { | |
| "hardwareProfile": { | |
| "vmSize": "[variables('SqlVmSize')]" | |
| }, | |
| "osProfile": { | |
| "computerName": "[parameters('SqlName')]", | |
| "adminUsername": "[parameters('AdminUsername')]", | |
| "adminPassword": "[parameters('AdminPassword')]" | |
| }, | |
| "networkProfile": { | |
| "networkInterfaces": [ | |
| { | |
| "id": "[resourceId('Microsoft.Network/networkInterfaces', variables('SqlNicName'))]" | |
| } | |
| ] | |
| }, | |
| "diagnosticsProfile": { | |
| "bootDiagnostics": { | |
| "enabled": "true", | |
| "storageUri": "[concat('https://',variables('diagnosticsStorageName'),'.blob.core.windows.net/')]" | |
| } | |
| }, | |
| "storageProfile": { | |
| "imageReference": { | |
| "publisher": "[variables('ImagePublisher')]", | |
| "offer": "[variables('ImageOffer')]", | |
| "sku": "[parameters('WindowsOSVersion')]", | |
| "version": "latest" | |
| }, | |
| "osDisk": { | |
| "name": "SqlOSDisk", | |
| "vhd": { | |
| "uri": "[concat(reference(resourceId('Microsoft.Storage/storageAccounts', variables('storageName')), '2016-01-01').primaryEndpoints.blob, variables('StorageAccountContainerName'), '/', variables('SqlOSDiskName'), '.vhd')]" | |
| }, | |
| "caching": "ReadWrite", | |
| "createOption": "FromImage" | |
| }, | |
| "dataDisks": [ | |
| { | |
| "vhd": { | |
| "uri": "[concat(reference(resourceId('Microsoft.Storage/storageAccounts/', variables('storageName'))).primaryEndpoints.blob,'vhds/', 'USERDB.vhd')]" | |
| }, | |
| "name": "[concat(parameters('SqlName'),'-userdb')]", | |
| "caching": "ReadOnly", | |
| "diskSizeGB": "128", | |
| "lun": 0, | |
| "createOption": "Empty" | |
| }, | |
| { | |
| "vhd": { | |
| "uri": "[concat(reference(resourceId('Microsoft.Storage/storageAccounts/', variables('storageName'))).primaryEndpoints.blob,'vhds/', 'USERLOG.vhd')]" | |
| }, | |
| "name": "[concat(parameters('SqlName'),'-userlog')]", | |
| "caching": "None", | |
| "diskSizeGB": "128", | |
| "lun": 1, | |
| "createOption": "Empty" | |
| }, | |
| { | |
| "vhd": { | |
| "uri": "[concat(reference(resourceId('Microsoft.Storage/storageAccounts/', variables('storageName'))).primaryEndpoints.blob,'vhds/', 'TEMPDB.vhd')]" | |
| }, | |
| "name": "[concat(parameters('SqlName'),'-tempdb')]", | |
| "caching": "ReadOnly", | |
| "diskSizeGB": "64", | |
| "lun": 2, | |
| "createOption": "Empty" | |
| } | |
| ] | |
| } | |
| }, | |
| "resources": [ | |
| { | |
| "name": "PrepareServer", | |
| "type": "extensions", | |
| "location": "[resourceGroup().location]", | |
| "apiVersion": "2016-03-30", | |
| "dependsOn": [ | |
| "[resourceId('Microsoft.Compute/virtualMachines', parameters('SqlName'))]" | |
| ], | |
| "tags": { | |
| "displayName": "PrepareServer" | |
| }, | |
| "properties": { | |
| "publisher": "Microsoft.Compute", | |
| "type": "CustomScriptExtension", | |
| "typeHandlerVersion": "1.4", | |
| "autoUpgradeMinorVersion": true, | |
| "settings": { | |
| "fileUris": [ | |
| "[concat(parameters('_artifactsLocation'), '/', variables('PrepareServerScriptFolder'), '/', variables('PrepareServerScriptFileName'), parameters('_artifactsLocationSasToken'))]" | |
| ], | |
| "commandToExecute": "[concat('powershell -ExecutionPolicy Unrestricted -File ', variables('PrepareServerScriptFolder'), '/', variables('PrepareServerScriptFileName'))]" | |
| } | |
| } | |
| }, | |
| { | |
| "apiVersion": "2015-06-15", | |
| "type": "extensions", | |
| "name": "SqlDomainJoin", | |
| "location": "[resourceGroup().location]", | |
| "dependsOn": [ | |
| "[resourceId('Microsoft.Compute/virtualMachines', parameters('SqlName'))]" | |
| ], | |
| "properties": { | |
| "publisher": "Microsoft.Compute", | |
| "type": "JsonADDomainExtension", | |
| "typeHandlerVersion": "1.3", | |
| "autoUpgradeMinorVersion": true, | |
| "settings": { | |
| "Name": "[parameters('FQDN')]", | |
| "Options": "3", | |
| "Restart": "true", | |
| "User": "[concat(parameters('FQDN'),variables('Backslash'),parameters('DomainAdminUserName'))]" | |
| }, | |
| "protectedSettings": { | |
| "Password": "[parameters('DomainPassword')]" | |
| } | |
| } | |
| }, | |
| { | |
| "name": "Microsoft.Powershell.DSC", | |
| "type": "extensions", | |
| "location": "[resourceGroup().location]", | |
| "apiVersion": "2016-03-30", | |
| "dependsOn": [ | |
| "[resourceId('Microsoft.Compute/virtualMachines', parameters('SqlName'))]" | |
| ], | |
| "tags": { | |
| "displayName": "SqlConfiguration" | |
| }, | |
| "properties": { | |
| "publisher": "Microsoft.Powershell", | |
| "type": "DSC", | |
| "typeHandlerVersion": "2.9", | |
| "autoUpgradeMinorVersion": true, | |
| "settings": { | |
| "configuration": { | |
| "url": "[concat(parameters('_artifactsLocation'), '/', variables('SqlConfigurationArchiveFolder'), '/', variables('SqlConfigurationArchiveFileName'))]", | |
| "script": "SqlConfiguration.ps1", | |
| "function": "Main" | |
| } | |
| }, | |
| "protectedSettings": { | |
| "configurationUrlSasToken": "[parameters('_artifactsLocationSasToken')]" | |
| } | |
| } | |
| } | |
| ] | |
| }, | |
| { | |
| "name": "[concat(parameters('BtsNode1Name'),copyIndex(1))]", | |
| "copy": { | |
| "name": "BizTalkServerCopy", | |
| "count": "[parameters('NumberOfBizTalkServers')]" | |
| }, | |
| "type": "Microsoft.Compute/virtualMachines", | |
| "location": "[resourceGroup().location]", | |
| "apiVersion": "2015-06-15", | |
| "dependsOn": [ | |
| "[resourceId('Microsoft.Storage/storageAccounts', variables('storageName'))]", | |
| "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('BtsNode1NicName'), copyIndex(1)))]" | |
| ], | |
| "tags": { | |
| "displayName": "[concat(parameters('BtsNode1Name'),copyIndex(1))]" | |
| }, | |
| "properties": { | |
| "hardwareProfile": { | |
| "VmSize": "[variables('BtsVmSize')]" | |
| }, | |
| "osProfile": { | |
| "computerName": "[parameters('BtsNode1Name')]", | |
| "adminUsername": "[parameters('AdminUsername')]", | |
| "adminPassword": "[parameters('AdminPassword')]" | |
| }, | |
| "storageProfile": { | |
| "imageReference": { | |
| "publisher": "[variables('ImagePublisher')]", | |
| "offer": "[variables('ImageOffer')]", | |
| "sku": "[parameters('WindowsOSVersion')]", | |
| "version": "latest" | |
| }, | |
| "osDisk": { | |
| "name": "[variables('BtsNode1OsDiskName')]", | |
| "vhd": { | |
| "uri": "[concat(reference(resourceId('Microsoft.Storage/storageAccounts', variables('storageName')), '2016-01-01').primaryEndpoints.blob, variables('StorageName'), '/', concat(variables('BtsNode1OSDiskName'),copyIndex(1)), '.vhd')]", | |
| }, | |
| "caching": "ReadWrite", | |
| "createOption": "FromImage" | |
| }, | |
| "dataDisks": [] | |
| }, | |
| "networkProfile": { | |
| "networkInterfaces": [ | |
| { | |
| "id": "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('BtsNode1NicName'), copyIndex(1)))]" | |
| } | |
| ] | |
| }, | |
| "diagnosticsProfile": { | |
| "bootDiagnostics": { | |
| "enabled": "true", | |
| "storageUri": "[concat('https://',variables('diagnosticsStorageName'),'.blob.core.windows.net/')]" | |
| } | |
| } | |
| }, | |
| "resources": [ | |
| { | |
| "name": "PrepareServer", | |
| "type": "extensions", | |
| "location": "[resourceGroup().location]", | |
| "apiVersion": "2016-03-30", | |
| "dependsOn": [ | |
| "[resourceId('Microsoft.Compute/virtualMachines', concat(parameters('BtsNode1Name'),copyIndex(1)))]" | |
| ], | |
| "tags": { | |
| "displayName": "PrepareServer" | |
| }, | |
| "properties": { | |
| "publisher": "Microsoft.Compute", | |
| "type": "CustomScriptExtension", | |
| "typeHandlerVersion": "1.4", | |
| "autoUpgradeMinorVersion": true, | |
| "settings": { | |
| "fileUris": [ | |
| "[concat(parameters('_artifactsLocation'), '/', variables('PrepareServerScriptFolder'), '/', variables('PrepareServerScriptFileName'), parameters('_artifactsLocationSasToken'))]" | |
| ], | |
| "commandToExecute": "[concat('powershell -ExecutionPolicy Unrestricted -File ', variables('PrepareServerScriptFolder'), '/', variables('PrepareServerScriptFileName'))]" | |
| } | |
| } | |
| }, | |
| { | |
| "apiVersion": "2015-06-15", | |
| "type": "extensions", | |
| "name": "BizTalkServerDomainJoin", | |
| "location": "[resourceGroup().location]", | |
| "dependsOn": [ | |
| "[resourceId('Microsoft.Compute/virtualMachines', concat(parameters('BtsNode1Name'),copyIndex(1)))]" | |
| ], | |
| "properties": { | |
| "publisher": "Microsoft.Compute", | |
| "type": "JsonADDomainExtension", | |
| "typeHandlerVersion": "1.3", | |
| "autoUpgradeMinorVersion": true, | |
| "settings": { | |
| "Name": "[parameters('FQDN')]", | |
| "Options": "3", | |
| "Restart": "true", | |
| "User": "[concat(parameters('FQDN'),variables('Backslash'),parameters('DomainAdminUserName'))]" | |
| }, | |
| "protectedSettings": { | |
| "Password": "[parameters('DomainPassword')]" | |
| } | |
| } | |
| }, | |
| { | |
| "name": "Microsoft.Powershell.DSC", | |
| "type": "extensions", | |
| "location": "[resourceGroup().location]", | |
| "apiVersion": "2016-03-30", | |
| "dependsOn": [ | |
| "[resourceId('Microsoft.Compute/virtualMachines', concat(parameters('BtsNode1Name'),copyIndex(1)))]" | |
| ], | |
| "tags": { | |
| "displayName": "BizTalkConfiguration" | |
| }, | |
| "properties": { | |
| "publisher": "Microsoft.Powershell", | |
| "type": "DSC", | |
| "typeHandlerVersion": "2.9", | |
| "autoUpgradeMinorVersion": true, | |
| "settings": { | |
| "configuration": { | |
| "url": "[concat(parameters('_artifactsLocation'), '/', variables('BizTalkConfigurationArchiveFolder'), '/', variables('BizTalkConfigurationArchiveFileName'))]", | |
| "script": "BizTalkConfiguration.ps1", | |
| "function": "Main" | |
| }, | |
| "configurationArguments": { | |
| "Hostheader": "[parameters('Hostheader')]" | |
| } | |
| }, | |
| "protectedSettings": { | |
| "configurationUrlSasToken": "[parameters('_artifactsLocationSasToken')]" | |
| } | |
| } | |
| } | |
| ] | |
| } | |
| ], | |
| "outputs": {} | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment