280 строки
9.4 KiB
JSON
280 строки
9.4 KiB
JSON
{
|
|
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
|
"contentVersion": "1.0.0.0",
|
|
"apiProfile": "2018-03-01-hybrid",
|
|
"parameters": {
|
|
"adminUsername": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "Username for the Virtual Machine."
|
|
},
|
|
"defaultValue": "localadmin"
|
|
},
|
|
"adminPassword": {
|
|
"type": "securestring",
|
|
"defaultValue": "[concat('Subscription#',substring(resourcegroup().id,15,36))]",
|
|
"metadata": {
|
|
"description": "Password for the Virtual Machine.Default value is 'Subscription#<subscription id>'"
|
|
}
|
|
},
|
|
"imagePublisher": {
|
|
"type": "string",
|
|
"defaultValue": "Canonical",
|
|
"metadata": {
|
|
"description": "Maps to the publisher in the Azure Stack Platform Image Repository manifest file Eg: Canonical, Suse, OpenLogic "
|
|
}
|
|
},
|
|
"imageOffer": {
|
|
"type": "string",
|
|
"defaultValue": "UbuntuServer",
|
|
"metadata": {
|
|
"description": "Maps to the Offer in the Azure Stack Platform Image Repository manifest file Eg: UbuntuServer, SlesServer, CentOS "
|
|
}
|
|
},
|
|
"imageSku": {
|
|
"type": "string",
|
|
"defaultValue": "16.04-LTS",
|
|
"metadata": {
|
|
"description": "Maps to the sku in the Azure Stack Platform Image Repository manifest file Eg: 16.04-LTS, 14.04.5-LTS."
|
|
}
|
|
},
|
|
"dataDiskSizeGB": {
|
|
"defaultValue": 1,
|
|
"type": "Int",
|
|
"metadata": {
|
|
"description": "Size of the data disk (GB) to be attached to the VMs."
|
|
}
|
|
},
|
|
"vmSize": {
|
|
"type": "string",
|
|
"defaultValue": "Standard_A1",
|
|
"metadata": {
|
|
"description": "The size of the Virtual Machine."
|
|
}
|
|
},
|
|
"_artifactsLocation": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "The base URI where artifacts required by this template are located. When the template is deployed using the accompanying scripts, a private location in the subscription will be used and this value will be automatically generated."
|
|
},
|
|
"defaultValue": "https://raw.githubusercontent.com/Azure/azurestack-quickstart-templates/master/201-vm-linux-comprehensive-with-managed-disks/"
|
|
}
|
|
},
|
|
"variables": {
|
|
"dnsNameForPublicIP": "[concat('dns', resourceGroup().name)]",
|
|
"location": "[resourceGroup().location]",
|
|
"OSDiskName": "osdisk",
|
|
"nicName": "myVnic",
|
|
"addressPrefix": "10.0.0.0/24",
|
|
"subnetName": "mySubnet",
|
|
"subnetPrefix": "10.0.0.0/24",
|
|
"storageAccountName": "[concat('sa', resourceGroup().name)]",
|
|
"storageAccountType": "Standard_LRS",
|
|
"publicIPAddressName": "myPublicIP",
|
|
"publicIPAddressType": "Dynamic",
|
|
"vmStorageAccountContainerName": "vhds",
|
|
"vmName": "[concat('vm', resourceGroup().name)]",
|
|
"virtualNetworkName": "myVnet",
|
|
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]",
|
|
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]",
|
|
"networkSecurityGroupName": "[tolower(concat('nsg',uniquestring(resourceGroup().id)))]",
|
|
"scriptName": "script"
|
|
},
|
|
"resources": [
|
|
{
|
|
"type": "Microsoft.Storage/storageAccounts",
|
|
"name": "[toLower(variables('storageAccountName'))]",
|
|
"location": "[variables('location')]",
|
|
"properties": {
|
|
"accountType": "[variables('storageAccountType')]"
|
|
}
|
|
},
|
|
{
|
|
"type": "Microsoft.Network/networkSecurityGroups",
|
|
"name": "[variables('networkSecurityGroupName')]",
|
|
"location": "[resourceGroup().location]",
|
|
"properties": {
|
|
"securityRules": [
|
|
{
|
|
"name": "ssh",
|
|
"properties": {
|
|
"description": "Allow RDP",
|
|
"protocol": "Tcp",
|
|
"sourcePortRange": "*",
|
|
"destinationPortRange": "22",
|
|
"sourceAddressPrefix": "*",
|
|
"destinationAddressPrefix": "*",
|
|
"access": "Allow",
|
|
"priority": 200,
|
|
"direction": "Inbound"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"type": "Microsoft.Network/publicIPAddresses",
|
|
"name": "[variables('publicIPAddressName')]",
|
|
"location": "[variables('location')]",
|
|
"properties": {
|
|
"publicIPAllocationMethod": "[variables('publicIPAddressType')]",
|
|
"dnsSettings": {
|
|
"domainNameLabel": "[variables('dnsNameForPublicIP')]"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "Microsoft.Network/virtualNetworks",
|
|
"name": "[variables('virtualNetworkName')]",
|
|
"location": "[variables('location')]",
|
|
"properties": {
|
|
"addressSpace": {
|
|
"addressPrefixes": [
|
|
"[variables('addressPrefix')]"
|
|
]
|
|
},
|
|
"subnets": [
|
|
{
|
|
"name": "[variables('subnetName')]",
|
|
"properties": {
|
|
"addressPrefix": "[variables('subnetPrefix')]"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"type": "Microsoft.Network/networkInterfaces",
|
|
"name": "[variables('nicName')]",
|
|
"location": "[variables('location')]",
|
|
"dependsOn": [
|
|
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]",
|
|
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]",
|
|
"[variables('networkSecurityGroupName')]"
|
|
],
|
|
"properties": {
|
|
"networkSecurityGroup": {
|
|
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]"
|
|
},
|
|
"ipConfigurations": [
|
|
{
|
|
"name": "ipconfig1",
|
|
"properties": {
|
|
"privateIPAllocationMethod": "Dynamic",
|
|
"publicIPAddress": {
|
|
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]"
|
|
},
|
|
"subnet": {
|
|
"id": "[variables('subnetRef')]"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"type": "Microsoft.Compute/virtualMachines",
|
|
"name": "[variables('vmName')]",
|
|
"location": "[variables('location')]",
|
|
"dependsOn": [
|
|
"[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]",
|
|
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
|
|
],
|
|
"properties": {
|
|
"hardwareProfile": {
|
|
"vmSize": "[parameters('vmSize')]"
|
|
},
|
|
"osProfile": {
|
|
"computerName": "[variables('vmName')]",
|
|
"adminUsername": "[parameters('adminUsername')]",
|
|
"adminPassword": "[parameters('adminPassword')]"
|
|
},
|
|
"storageProfile": {
|
|
"imageReference": {
|
|
"publisher": "[parameters('imagePublisher')]",
|
|
"offer": "[parameters('imageOffer')]",
|
|
"sku": "[parameters('imageSku')]",
|
|
"version": "latest"
|
|
},
|
|
"osDisk": {
|
|
"name": "osdisk",
|
|
"caching": "ReadWrite",
|
|
"createOption": "FromImage"
|
|
},
|
|
"dataDisks": [
|
|
{
|
|
"diskSizeGB": "[parameters('dataDiskSizeGB')]",
|
|
"lun": 1,
|
|
"createOption": "Empty"
|
|
}
|
|
]
|
|
},
|
|
"networkProfile": {
|
|
"networkInterfaces": [
|
|
{
|
|
"id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]"
|
|
}
|
|
]
|
|
},
|
|
"diagnosticsProfile": {
|
|
"bootDiagnostics": {
|
|
"enabled": "true",
|
|
"storageUri": "[reference(concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).primaryEndpoints.blob]"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "Microsoft.Compute/virtualMachines/extensions",
|
|
"name": "[concat(variables('vmName'),'/LinuxCustomScriptExtension')]",
|
|
"location": "[resourceGroup().location]",
|
|
"dependsOn": [
|
|
"[concat('Microsoft.Compute/virtualMachines/', variables('vmName'))]"
|
|
],
|
|
"properties": {
|
|
"publisher": "Microsoft.Azure.Extensions",
|
|
"type": "CustomScript",
|
|
"typeHandlerVersion": "2.0",
|
|
"autoUpgradeMinorVersion": "true",
|
|
"settings": {
|
|
"fileUris": ["[concat(parameters('_artifactsLocation'), variables('scriptName'), '.sh')]"],
|
|
"commandToExecute": "[concat('sh ', variables('scriptName'), '.sh')]"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "Microsoft.Compute/virtualMachines/extensions",
|
|
"name": "[concat(variables('vmName'),'/installospatching')]",
|
|
"location": "[resourceGroup().location]",
|
|
"dependsOn": [
|
|
"[concat('Microsoft.Compute/virtualMachines/', variables('vmName'),'/extensions/LinuxCustomScriptExtension')]"
|
|
],
|
|
"properties": {
|
|
"publisher": "Microsoft.OSTCExtensions",
|
|
"type": "OSPatchingForLinux",
|
|
"typeHandlerVersion": "2.0",
|
|
"autoUpgradeMinorVersion": true,
|
|
"settings": {
|
|
"disabled": false,
|
|
"stop": false,
|
|
"rebootAfterPatch": "Auto",
|
|
"category": "ImportantAndRecommended",
|
|
"installDuration": "01:00",
|
|
"oneoff": true,
|
|
"intervalOfWeeks": "1",
|
|
"dayOfWeek": "Sunday",
|
|
"startTime": "03:00",
|
|
"vmStatusTest": {
|
|
"local": false,
|
|
"idleTestScript": "",
|
|
"healthyTestScript": ""
|
|
}
|
|
}
|
|
}
|
|
}
|
|
],
|
|
|
|
"outputs": {
|
|
}
|
|
}
|