170 lines
7.3 KiB
JSON
170 lines
7.3 KiB
JSON
|
{
|
||
|
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json",
|
||
|
"contentVersion": "1.0.0.0",
|
||
|
"parameters": {
|
||
|
"storageAccountKey" : {
|
||
|
"type" : "secureString"
|
||
|
}
|
||
|
},
|
||
|
"variables": {
|
||
|
"virtualNetworkName": "jenkinsarm-vnet",
|
||
|
"subnetName": "jenkinsarm-snet",
|
||
|
"storageAccountName": "jenkinsarmst",
|
||
|
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]",
|
||
|
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]",
|
||
|
"addressPrefix": "10.0.0.0/16",
|
||
|
"subnetPrefix": "10.0.0.0/24",
|
||
|
"publicIPAddressType": "Dynamic",
|
||
|
"storageAccountContainerName": "vhds",
|
||
|
"storageAccountType": "Standard_LRS",
|
||
|
"startupScriptURI": "",
|
||
|
"startupScriptName": "",
|
||
|
"jenkinsServerURL": "",
|
||
|
"clientSecrets": []
|
||
|
},
|
||
|
"resources": [
|
||
|
{
|
||
|
"type": "Microsoft.Storage/storageAccounts",
|
||
|
"name": "[variables('storageAccountName')]",
|
||
|
"apiVersion": "2015-05-01-preview",
|
||
|
"location": "[variables('location')]",
|
||
|
"properties": {
|
||
|
"accountType": "[variables('storageAccountType')]"
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"apiVersion": "2015-05-01-preview",
|
||
|
"type": "Microsoft.Network/virtualNetworks",
|
||
|
"name": "[variables('virtualNetworkName')]",
|
||
|
"location": "[variables('location')]",
|
||
|
"properties": {
|
||
|
"addressSpace": {
|
||
|
"addressPrefixes": [
|
||
|
"[variables('addressPrefix')]"
|
||
|
]
|
||
|
},
|
||
|
"subnets": [{
|
||
|
"name": "[variables('subnetName')]",
|
||
|
"properties": {
|
||
|
"addressPrefix": "[variables('subnetPrefix')]"
|
||
|
}
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"apiVersion": "2015-05-01-preview",
|
||
|
"type": "Microsoft.Network/publicIPAddresses",
|
||
|
"name": "[concat(variables('vmName'), copyIndex(), 'IPName')]",
|
||
|
"location": "[variables('location')]",
|
||
|
"copy": {
|
||
|
"name": "vmcopy",
|
||
|
"count": "[parameters('count')]"
|
||
|
},
|
||
|
"properties": {
|
||
|
"publicIPAllocationMethod": "[variables('publicIPAddressType')]",
|
||
|
"dnsSettings": {
|
||
|
"domainNameLabel": "[concat(variables('vmName'), copyIndex())]"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"apiVersion": "2015-05-01-preview",
|
||
|
"type": "Microsoft.Network/networkInterfaces",
|
||
|
"name": "[concat(variables('vmName'), copyIndex(), 'NIC')]",
|
||
|
"location": "[variables('location')]",
|
||
|
"copy": {
|
||
|
"name": "vmcopy",
|
||
|
"count": "[parameters('count')]"
|
||
|
},
|
||
|
"dependsOn": [
|
||
|
"[concat('Microsoft.Network/publicIPAddresses/', variables('vmName'), copyIndex(), 'IPName')]",
|
||
|
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
|
||
|
],
|
||
|
"properties": {
|
||
|
"ipConfigurations": [{
|
||
|
"name": "ipconfig1",
|
||
|
"properties": {
|
||
|
"privateIPAllocationMethod": "Dynamic",
|
||
|
"publicIPAddress": {
|
||
|
"id": "[resourceId('Microsoft.Network/publicIPAddresses', concat(variables('vmName'), copyIndex(), 'IPName'))]"
|
||
|
},
|
||
|
"subnet": {
|
||
|
"id": "[variables('subnetRef')]"
|
||
|
}
|
||
|
}
|
||
|
}]
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"apiVersion": "2015-05-01-preview",
|
||
|
"type": "Microsoft.Compute/virtualMachines",
|
||
|
"name": "[concat(variables('vmName'), copyIndex())]",
|
||
|
"location": "[variables('location')]",
|
||
|
"copy": {
|
||
|
"name": "vmcopy",
|
||
|
"count": "[parameters('count')]"
|
||
|
},
|
||
|
"dependsOn": [
|
||
|
"[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]",
|
||
|
"[concat('Microsoft.Network/networkInterfaces/', variables('vmName'), copyIndex(), 'NIC')]"
|
||
|
],
|
||
|
"properties": {
|
||
|
"hardwareProfile": {
|
||
|
"vmSize": "[variables('vmSize')]"
|
||
|
},
|
||
|
"osProfile": {
|
||
|
"computername": "[concat(variables('vmName'), copyIndex())]",
|
||
|
"adminUsername": "[variables('adminUsername')]",
|
||
|
"adminPassword": "[variables('adminPassword')]"
|
||
|
},
|
||
|
"storageProfile": {
|
||
|
"osDisk": {
|
||
|
"name": "[concat(variables('vmName'), copyIndex())]",
|
||
|
"osType": "[variables('osType')]",
|
||
|
"caching": "ReadWrite",
|
||
|
"image": {
|
||
|
"uri": "[variables('image')]"
|
||
|
},
|
||
|
"createOption": "FromImage",
|
||
|
"vhd": {
|
||
|
"uri": "[concat('http://',variables('storageAccountName'),'.blob.core.windows.net/',variables('storageAccountContainerName'),'/', variables('vmName'), copyIndex(), 'OSDisk.vhd')]"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
"networkProfile": {
|
||
|
"networkInterfaces": [{
|
||
|
"id": "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('vmName'), copyIndex(), 'NIC'))]"
|
||
|
}]
|
||
|
}
|
||
|
},
|
||
|
"resources" : [
|
||
|
{
|
||
|
"type": "extensions",
|
||
|
"name": "[concat('customScript', variables('vmName'), copyIndex())]",
|
||
|
"apiVersion": "2015-05-01-preview",
|
||
|
"location": "[variables('location')]",
|
||
|
"dependsOn": [
|
||
|
"[concat('Microsoft.Compute/virtualMachines/', variables('vmName'), copyIndex())]"
|
||
|
],
|
||
|
"properties": {
|
||
|
"publisher": "Microsoft.Compute",
|
||
|
"type": "CustomScriptExtension",
|
||
|
"typeHandlerVersion": "1.7",
|
||
|
"autoUpgradeMinorVersion": true,
|
||
|
"settings": {
|
||
|
"fileUris": [
|
||
|
"[variables('startupScriptURI')]"
|
||
|
],
|
||
|
"commandToExecute": "[concat('powershell.exe -ExecutionPolicy Unrestricted -File ', variables('startupScriptName'),' ', variables('jenkinsServerURL'),' ', variables('vmName'),copyIndex(),' ', variables('clientSecrets')[copyIndex()])]"
|
||
|
},
|
||
|
"protectedSettings": {
|
||
|
"storageAccountName" : "[variables('storageAccountName')]",
|
||
|
"storageAccountKey" : "[parameters('storageAccountKey')]"
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
]
|
||
|
}
|