216 lines
6.1 KiB
JSON
216 lines
6.1 KiB
JSON
{
|
|
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
|
"contentVersion": "1.0.0.0",
|
|
"parameters": {
|
|
"networkInterfaceName": {
|
|
"type": "string"
|
|
},
|
|
"networkSecurityGroupName": {
|
|
"type": "string"
|
|
},
|
|
"virtualNetworkName": {
|
|
"type": "string"
|
|
},
|
|
"publicIPAddressName": {
|
|
"type": "string"
|
|
},
|
|
"virtualMachineName": {
|
|
"type": "string"
|
|
},
|
|
"diskName": {
|
|
"type": "string"
|
|
},
|
|
"imageName": {
|
|
"type": "string"
|
|
},
|
|
"location": {
|
|
"type": "string"
|
|
},
|
|
"imagePath": {
|
|
"type": "string"
|
|
},
|
|
"adminUsername": {
|
|
"type": "string"
|
|
},
|
|
"adminPublicKey": {
|
|
"type": "secureString"
|
|
}
|
|
},
|
|
"variables": {
|
|
"nsgId": "[resourceId(resourceGroup().name, 'Microsoft.Network/networkSecurityGroups', parameters('networkSecurityGroupName'))]",
|
|
"vnetId": "[resourceId(resourceGroup().name,'Microsoft.Network/virtualNetworks', parameters('virtualNetworkName'))]",
|
|
"subnetRef": "[concat(variables('vnetId'), '/subnets/default')]"
|
|
},
|
|
"resources": [
|
|
{
|
|
"name": "[parameters('networkInterfaceName')]",
|
|
"type": "Microsoft.Network/networkInterfaces",
|
|
"apiVersion": "2019-07-01",
|
|
"location": "[parameters('location')]",
|
|
"tags": {
|
|
"gitlab-ci-test": "true"
|
|
},
|
|
"dependsOn": [
|
|
"[concat('Microsoft.Network/networkSecurityGroups/', parameters('networkSecurityGroupName'))]",
|
|
"[concat('Microsoft.Network/virtualNetworks/', parameters('virtualNetworkName'))]",
|
|
"[concat('Microsoft.Network/publicIpAddresses/', parameters('publicIPAddressName'))]"
|
|
],
|
|
"properties": {
|
|
"ipConfigurations": [
|
|
{
|
|
"name": "ipconfig1",
|
|
"properties": {
|
|
"subnet": {
|
|
"id": "[variables('subnetRef')]"
|
|
},
|
|
"privateIPAllocationMethod": "Dynamic",
|
|
"publicIpAddress": {
|
|
"id": "[resourceId(resourceGroup().name, 'Microsoft.Network/publicIpAddresses', parameters('publicIPAddressName'))]"
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"networkSecurityGroup": {
|
|
"id": "[variables('nsgId')]"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "[parameters('networkSecurityGroupName')]",
|
|
"type": "Microsoft.Network/networkSecurityGroups",
|
|
"apiVersion": "2019-02-01",
|
|
"location": "[parameters('location')]",
|
|
"tags": {
|
|
"gitlab-ci-test": "true"
|
|
},
|
|
"properties": {
|
|
"securityRules": [
|
|
{
|
|
"name": "SSH",
|
|
"properties": {
|
|
"priority": 300,
|
|
"protocol": "TCP",
|
|
"access": "Allow",
|
|
"direction": "Inbound",
|
|
"sourceAddressPrefix": "*",
|
|
"sourcePortRange": "*",
|
|
"destinationAddressPrefix": "*",
|
|
"destinationPortRange": "22"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"name": "[parameters('virtualNetworkName')]",
|
|
"type": "Microsoft.Network/virtualNetworks",
|
|
"apiVersion": "2019-09-01",
|
|
"location": "[parameters('location')]",
|
|
"tags": {
|
|
"gitlab-ci-test": "true"
|
|
},
|
|
"properties": {
|
|
"addressSpace": {
|
|
"addressPrefixes": [
|
|
"10.0.5.0/24"
|
|
]
|
|
},
|
|
"subnets": [
|
|
{
|
|
"name": "default",
|
|
"properties": {
|
|
"addressPrefix": "10.0.5.0/24"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"name": "[parameters('publicIPAddressName')]",
|
|
"type": "Microsoft.Network/publicIpAddresses",
|
|
"apiVersion": "2019-02-01",
|
|
"location": "[parameters('location')]",
|
|
"tags": {
|
|
"gitlab-ci-test": "true"
|
|
},
|
|
"properties": {
|
|
"publicIpAllocationMethod": "Dynamic"
|
|
},
|
|
"sku": {
|
|
"name": "Basic"
|
|
}
|
|
},
|
|
{
|
|
"name": "[parameters('imageName')]",
|
|
"type": "Microsoft.Compute/images",
|
|
"apiVersion": "2019-07-01",
|
|
"location": "[parameters('location')]",
|
|
"tags": {
|
|
"gitlab-ci-test": "true"
|
|
},
|
|
"properties": {
|
|
"hyperVGeneration": "V2",
|
|
"storageProfile": {
|
|
"osDisk": {
|
|
"osType": "Linux",
|
|
"blobUri": "[parameters('imagePath')]",
|
|
"osState": "Generalized"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "[parameters('virtualMachineName')]",
|
|
"type": "Microsoft.Compute/virtualMachines",
|
|
"apiVersion": "2019-07-01",
|
|
"location": "[parameters('location')]",
|
|
"tags": {
|
|
"gitlab-ci-test": "true"
|
|
},
|
|
"dependsOn": [
|
|
"[concat('Microsoft.Network/networkInterfaces/', parameters('networkInterfaceName'))]",
|
|
"[concat('Microsoft.Compute/images/', parameters('imageName'))]"
|
|
],
|
|
"properties": {
|
|
"hardwareProfile": {
|
|
"vmSize": "Standard_B1s"
|
|
},
|
|
"storageProfile": {
|
|
"imageReference": {
|
|
"id": "[resourceId(resourceGroup().name, 'Microsoft.Compute/images', parameters('imageName'))]"
|
|
},
|
|
"osDisk": {
|
|
"caching": "ReadWrite",
|
|
"managedDisk": {
|
|
"storageAccountType": "Standard_LRS"
|
|
},
|
|
"name": "[parameters('diskName')]",
|
|
"createOption": "FromImage"
|
|
}
|
|
},
|
|
"networkProfile": {
|
|
"networkInterfaces": [
|
|
{
|
|
"id": "[resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaceName'))]"
|
|
}
|
|
]
|
|
},
|
|
"osProfile": {
|
|
"computerName": "[parameters('virtualMachineName')]",
|
|
"adminUsername": "[parameters('adminUsername')]",
|
|
"linuxConfiguration": {
|
|
"disablePasswordAuthentication": true,
|
|
"ssh": {
|
|
"publicKeys": [
|
|
{
|
|
"path": "[concat('/home/', parameters('adminUsername'), '/.ssh/authorized_keys')]",
|
|
"keyData": "[parameters('adminPublicKey')]"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|