Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
316 lines (316 sloc) 11 KB
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"dnsLabelPrefix": {
"type": "string",
"metadata": {
"description": "Unique DNS Name for the Storage Account where the Virtual Machine's disks will be placed."
}
},
"adminUsername": {
"type": "string",
"metadata": {
"description": "Username for the Virtual Machine."
}
},
"adminPassword": {
"type": "securestring",
"metadata": {
"description": "Password for the Virtual Machine."
}
},
"vmSize": {
"type": "string",
"defaultValue": "Standard_A2",
"allowedValues": [
"Standard_A1",
"Standard_A2"
],
"metadata": {
"description": "Size of VM"
}
},
"_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"
}
},
"DeployLocation": {
"type": "string",
"defaultValue": "Azure",
"allowedValues": [ "Azure", "AzureStack" ],
"metadata": {
"description": "Deploy to Azure or AzureStack"
}
},
"FileContainerURL": {
"type": "string",
"metadata": {
"description": "URL of container with install files"
}
},
"FileContainerSASToken": {
"type": "securestring",
"metadata": {
"description": "SAS Token for install file container"
}
}
},
"variables": {
"storageAccountName": "[concat(uniquestring(resourceGroup().id), 'tfsvm')]",
"sizeOfDataDiskInGB": "100",
"addressPrefix": "10.0.0.0/16",
"subnet1Name": "Subnet-1",
"subnet1Prefix": "10.0.0.0/24",
"vmStorageAccountContainerName": "vhds",
"imagePublisher": "MicrosoftWindowsServer",
"imageOffer": "WindowsServer",
"imageSKU": "2012-R2-Datacenter",
"imageVersion": "latest",
"publicIPAddressName": "myPublicIP",
"publicIPAddressType": "Dynamic",
"publicIPAddressDNS": "[concat(toLower(parameters('dnsLabelPrefix')),uniqueString(resourceGroup().id))]",
"storageAccountType": "Standard_LRS",
"virtualNetworkName": "tfsvnet",
"vmName": "tfsvm",
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]",
"nicName": "tfsnic",
"subnet1Ref": "[concat(variables('vnetID'),'/subnets/',variables('subnet1Name'))]",
"apiVersion": "2015-06-15",
"InstallTFSScriptScriptFolder": "CustomScripts",
"InstallTFSScriptScriptFileName": "InstallTFSScript.ps1",
"TfsSecurityGroup": "tfssg",
"TfsAvailabilitySetName": "TfsAvailabilitySet",
"DeployAzure": {
"apiVersion": "2015-06-15"
},
"DeployAzureStack": {
"apiVersion": "2015-06-15"
},
"DeployLocation": "[variables(concat('Deploy',parameters('DeployLocation')))]"
},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"name": "[variables('storageAccountName')]",
"apiVersion": "[variables('DeployLocation').apiVersion]",
"location": "[resourceGroup().location]",
"properties": {
"accountType": "[variables('storageAccountType')]"
}
},
{
"apiVersion": "[variables('DeployLocation').apiVersion]",
"type": "Microsoft.Network/publicIPAddresses",
"name": "[variables('publicIPAddressName')]",
"location": "[resourceGroup().location]",
"properties": {
"publicIPAllocationMethod": "[variables('publicIPAddressType')]",
"dnsSettings": {
"domainNameLabel": "[variables('publicIPAddressDNS')]"
}
}
},
{
"apiVersion": "[variables('DeployLocation').apiVersion]",
"type": "Microsoft.Network/virtualNetworks",
"name": "[variables('virtualNetworkName')]",
"location": "[resourceGroup().location]",
"properties": {
"addressSpace": {
"addressPrefixes": [
"[variables('addressPrefix')]"
]
},
"subnets": [
{
"name": "[variables('subnet1Name')]",
"properties": {
"addressPrefix": "[variables('subnet1Prefix')]"
}
}
]
}
},
{
"type": "Microsoft.Network/networkSecurityGroups",
"name": "[variables('TfsSecurityGroup')]",
"apiVersion": "[variables('DeployLocation').apiVersion]",
"location": "[resourceGroup().location]",
"properties": {
"securityRules": [
{
"name": "default-allow-rdp",
"properties": {
"protocol": "Tcp",
"sourcePortRange": "*",
"destinationPortRange": "3389",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 1000,
"direction": "Inbound"
}
},
{
"name": "allow-http-tfs",
"properties": {
"protocol": "Tcp",
"sourcePortRange": "*",
"destinationPortRange": "8080",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 900,
"direction": "Inbound"
}
}
]
},
"resources": [],
"dependsOn": []
},
{
"apiVersion": "[variables('DeployLocation').apiVersion]",
"type": "Microsoft.Network/networkInterfaces",
"name": "[variables('nicName')]",
"location": "[resourceGroup().location]",
"dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]",
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]",
"[resourceId('Microsoft.Network/networkSecurityGroups', variables('TfsSecurityGroup'))]"
],
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]"
},
"subnet": {
"id": "[variables('subnet1Ref')]"
}
}
}
],
"networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('TfsSecurityGroup'))]"
}
}
},
{
"apiVersion": "[variables('DeployLocation').apiVersion]",
"type": "Microsoft.Compute/virtualMachines",
"name": "[variables('vmName')]",
"location": "[resourceGroup().location]",
"dependsOn": [
"[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]",
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]",
"[concat('Microsoft.Compute/availabilitySets/',variables('TfsAvailabilitySetName'))]"
],
"properties": {
"hardwareProfile": {
"vmSize": "[parameters('vmSize')]"
},
"availabilitySet": {
"id": "[resourceId('Microsoft.Compute/availabilitySets/',variables('TfsAvailabilitySetName'))]"
},
"osProfile": {
"computerName": "[variables('vmName')]",
"adminUsername": "[parameters('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]"
},
"storageProfile": {
"imageReference": {
"publisher": "[variables('imagePublisher')]",
"offer": "[variables('imageOffer')]",
"sku": "[variables('imageSKU')]",
"version": "[variables('imageVersion')]"
},
"dataDisks": [
{
"name": "datadisk1",
"diskSizeGB": "[variables('sizeOfDataDiskInGB')]",
"lun": 0,
"vhd": {
"uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName')), variables('apiVersion')).primaryEndpoints.blob, variables('vmStorageAccountContainerName'),'/',variables('vmName'),'dataDisk1.vhd')]"
},
"createOption": "Empty"
}
],
"osDisk": {
"name": "osdisk1",
"vhd": {
"uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName')), variables('apiVersion')).primaryEndpoints.blob, variables('vmStorageAccountContainerName'),'/','osDisk1.vhd')]"
},
"caching": "ReadWrite",
"createOption": "FromImage"
}
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]"
}
]
},
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": "true",
"storageUri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName')), variables('apiVersion')).primaryEndpoints.blob)]"
}
}
},
"resources": [
{
"name": "InstallTFSScript",
"type": "extensions",
"location": "[resourceGroup().location]",
"apiVersion": "[variables('DeployLocation').apiVersion]",
"dependsOn": [
"[resourceId('Microsoft.Compute/virtualMachines', variables('vmName'))]"
],
"tags": {
"displayName": "InstallTFSScript"
},
"properties": {
"publisher": "Microsoft.Compute",
"type": "CustomScriptExtension",
"typeHandlerVersion": "1.4",
"autoUpgradeMinorVersion": true,
"settings": {
"fileUris": [
"[concat(parameters('_artifactsLocation'), '/', variables('InstallTFSScriptScriptFolder'), '/', variables('InstallTFSScriptScriptFileName'), parameters('_artifactsLocationSasToken'))]"
],
"commandToExecute": "[concat('powershell -ExecutionPolicy Unrestricted -File ', variables('InstallTFSScriptScriptFolder'), '/', variables('InstallTFSScriptScriptFileName'),' -FileContainerURL ', parameters('FileContainerURL'),' -FileContainerSASToken \"', parameters('FileContainerSASToken'),'\"')]"
}
}
}
]
},
{
"name": "[variables('TfsAvailabilitySetName')]",
"type": "Microsoft.Compute/availabilitySets",
"location": "[resourceGroup().location]",
"apiVersion": "[variables('DeployLocation').apiVersion]",
"dependsOn": [],
"tags": {
"displayName": "TfsAvailabilitySet"
},
"properties": {
"platformUpdateDomainCount": 1,
"platformFaultDomainCount": 1
}
}
]
}