-
Notifications
You must be signed in to change notification settings - Fork 22
Template Image
Dmitry Tretyakov edited this page Apr 13, 2018
·
1 revision
This image type allows creating new TeamCity cloud build agents by using custom Azure Resource Manager template.
It has the only one requirement - to specify vmName parameter which will be set on build agent start.
The template to create a new virtual machine could look like that:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"vmName": {
"type": "string",
"metadata": {
"description": "This is the Virtual Machine name."
}
}
},
"variables": {
"location": "[resourceGroup().location]",
"nicName": "[concat(parameters('vmName'), '-net')]",
"subnetRef": "..."
},
"resources": [
{
"apiVersion": "2016-09-01",
"type": "Microsoft.Network/networkInterfaces",
"name": "[variables('nicName')]",
"location": "[variables('location')]",
"properties": {
"ipConfigurations": [
{
"name": "[concat(parameters('vmName'), '-config')]",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "[variables('subnetRef')]"
}
}
}
]
}
},
{
"apiVersion": "2016-04-30-preview",
"type": "Microsoft.Compute/virtualMachines",
"name": "[parameters('vmName')]",
"location": "[variables('location')]",
"dependsOn": [
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
],
"properties": {
"hardwareProfile": {
"vmSize": "Standard_A2"
},
"osProfile": {
"computerName": "[parameters('vmName')]",
"adminUsername": "...",
"adminPassword": "..."
},
"storageProfile": {
"osDisk": {
"name": "[concat(parameters('vmName'), '-os')]",
"osType": "...",
"caching": "ReadWrite",
"createOption": "FromImage"
},
"imageReference": {
"id": "..."
}
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]"
}
]
}
}
}
]
}