Skip to content
Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
183 lines (183 sloc) 6.14 KB
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"existingVirtualNetworkName": {
"type": "string",
"metadata": {
"description": "Name of the existing VNET"
}
},
"existingSubnetName": {
"type": "string",
"metadata": {
"description": "Name of the existing subnet in the existing VNET you want to use"
}
},
"existingVirtualNetworkResourceGroup": {
"metadata": {
"description": "Name of the existing VNET resource group"
},
"type": "string"
},
"storageType": {
"type": "string",
"defaultValue": "Standard_LRS",
"metadata": {
"description": "Which type of storage you want to use for the OS Disk"
}
},
"vmName": {
"type": "string",
"metadata": {
"description": "Local name for the VM can be whatever you want"
}
},
"vmAdminUserName": {
"type": "string",
"metadata": {
"description": "VM admin user name"
}
},
"vmAdminPassword": {
"type": "securestring",
"metadata": {
"description": "VM admin password. The supplied password must be between 8-123 characters long and must satisfy at least 3 of password complexity requirements from the following: 1) Contains an uppercase character 2) Contains a lowercase character 3) Contains a numeric digit 4) Contains a special character."
}
},
"vmSize": {
"type": "string",
"metadata": {
"description": "Desired Size of the VM. Any valid option accepted but if you choose premium storage type you must choose a DS class VM size."
},
"defaultValue": "Standard_DS2"
},
"vmVisualStudioVersion": {
"type": "string",
"defaultValue": "VS-2017-Comm-v152-WS2016",
"metadata": {
"description": "Which version of Visual Studio you would like to deploy"
}
},
"vstsAccount": {
"type": "string",
"metadata": {
"description": "The Visual Studio Team Services account name, that is, the first part of your VSTSAccount.visualstudio.com"
}
},
"personalAccessToken": {
"type": "securestring",
"metadata": {
"description": "The personal access token to connect to VSTS"
}
},
"poolName": {
"type": "string",
"defaultValue": "Default",
"metadata": {
"description": "The Visual Studio Team Services build agent pool for this build agent to join. Use 'Default' if you don't have a separate pool."
}
}
},
"variables": {
"vmImagePublisher": "MicrosoftVisualStudio",
"vmImageOffer": "VisualStudio",
"vmOSDiskName": "VMOSDisk",
"vnetID": "[resourceId(parameters('existingVirtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', parameters('existingVirtualNetworkName'))]",
"subnetRef": "[concat(variables('vnetID'),'/subnets/',parameters('existingSubnetName'))]",
"vmNicName": "[concat(parameters('vmName'), 'NetworkInterface')]",
"networkApi": "2017-03-01",
"computeApi": "2017-03-30",
"extensionsApi": "2015-06-15"
},
"resources": [
{
"name": "[variables('vmNicName')]",
"type": "Microsoft.Network/networkInterfaces",
"location": "[resourceGroup().location]",
"apiVersion": "[variables('networkApi')]",
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "[variables('subnetRef')]"
}
}
}
]
}
},
{
"name": "[parameters('vmName')]",
"type": "Microsoft.Compute/virtualMachines",
"location": "[resourceGroup().location]",
"apiVersion": "[variables('computeApi')]",
"dependsOn": [
"[concat('Microsoft.Network/networkInterfaces/', variables('vmNicName'))]"
],
"properties": {
"hardwareProfile": {
"vmSize": "[parameters('vmSize')]"
},
"osProfile": {
"computerName": "[parameters('vmName')]",
"adminUsername": "[parameters('vmAdminUserName')]",
"adminPassword": "[parameters('vmAdminPassword')]"
},
"storageProfile": {
"imageReference": {
"publisher": "[variables('vmImagePublisher')]",
"offer": "[variables('vmImageOffer')]",
"sku": "[parameters('vmVisualStudioVersion')]",
"version": "latest"
},
"osDisk": {
"caching": "ReadWrite",
"createOption": "FromImage",
"name": "[variables('vmOSDiskName')]",
"managedDisk": {
"storageAccountType": "[parameters('storageType')]"
}
}
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces', variables('vmNicName'))]"
}
]
}
},
"resources": [
{
"name": "CustomScript",
"type": "extensions",
"location": "[resourceGroup().location]",
"apiVersion": "[variables('extensionsApi')]",
"dependsOn": [
"[concat('Microsoft.Compute/virtualMachines/', parameters('vmName'))]"
],
"properties": {
"publisher": "Microsoft.Compute",
"type": "CustomScriptExtension",
"typeHandlerVersion": "1.8",
"autoUpgradeMinorVersion": true,
"settings": {
"fileUris": [
"https://raw.githubusercontent.com/mariuszdotnet/vsts-hosted-agents/master/installvstsagent.ps1"
]
},
"protectedSettings": {
"commandToExecute": "[concat('powershell.exe -ExecutionPolicy Unrestricted -Command .\\installvstsagent.ps1 -vstsAccount ', parameters('vstsAccount'), ' -personalAccessToken ', parameters('personalAccessToken'), ' -AgentName ', parameters('vmName'), ' -PoolName ', parameters('poolName'))]"
}
}
}
]
}
],
"outputs": {
}
}
You can’t perform that action at this time.