AzureStack-QuickStart-Templ.../mysql-standalone-server-win.../azuredeploy.json

293 строки
10 KiB
JSON

{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"vmName": {
"type": "string",
"metadata": {
"description": "The name of the Virtual Machine. Limit 15 characters. (Reference: https://support.microsoft.com/en-us/kb/909264)"
}
},
"vmTimeZone": {
"type": "string",
"defaultValue": "Pacific Standard Time",
"metadata": {
"description": "The time zone to be set for the Virtual Machine."
}
},
"vmSize": {
"type": "string",
"defaultValue": "Standard_A1",
"allowedValues": [
"Standard_A0",
"Standard_A1",
"Standard_A2",
"Standard_A3",
"Standard_A4"
],
"metadata": {
"description": "The size of the Virtual Machine. (Reference: https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-size-specs/)"
}
},
"windowsOSVersion": {
"type": "string",
"defaultValue": "2016-Datacenter",
"allowedValues": [
"2016-Datacenter"
],
"metadata": {
"description": "The Windows Operating System version for the Virtual Machine. This will pick a fully patched image of this given Windows version. Allowed values: 2016-Datacenter."
}
},
"adminUsername": {
"type": "string",
"metadata": {
"description": "The local Administrator username on the Virtual Machine. Limit 64 characters."
}
},
"adminPassword": {
"type": "securestring",
"metadata": {
"description": "The local Administrator password on the Virtual Machine. Limit 64 characters."
}
},
"mySqlServicePort": {
"type": "int",
"defaultValue": 3306,
"metadata": {
"description": "MySql service port"
}
},
"mySqlVersion": {
"type": "string",
"defaultValue": "5.7",
"allowedValues": [
"5.5",
"5.6",
"5.7"
],
"metadata": {
"description": "MySql Version"
}
}
},
"variables": {
"vhdStorageContainerName": "vhds",
"vhdStorageName": "[tolower(concat(substring(padleft(replace(replace(parameters('vmName'), '-', ''),'_',''), 9, '0'),0, 9), 'st', uniqueString(resourceGroup().id)))]",
"vhdStorageType": "Standard_LRS",
"publicIPAddressName": "[concat(parameters('vmName'), '-PublicIP')]",
"publicIPAddressType": "Static",
"subnetSecurityGroupName": "[concat(parameters('vmName'), '-SSG')]",
"subnetSecurityGroupId": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('subnetSecurityGroupName'))]",
"nicName": "[concat(parameters('vmName'), '-NIC')]",
"addressPrefix": "10.0.0.0/16",
"subnetName": "Subnet",
"subnetPrefix": "10.0.0.0/24",
"virtualNetworkName": "[concat(parameters('vmName'), '-VNET')]",
"vnetId": "[resourceId('Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]",
"subnetRef": "[concat(variables('vnetId'), '/subnets/', variables('subnetName'))]",
"imagePublisher": "MicrosoftWindowsServer",
"imageOffer": "WindowsServer",
"dnsNameForPublicIP": "[tolower(parameters('vmName'))]",
"OSDiskName": "[concat('osdisk-', parameters('vmName'))]",
"assetLocation": "https://raw.githubusercontent.com/Azure/AzureStack-QuickStart-Templates/master/mysql-standalone-server-windows/",
"cseBlobNameScript": "MySql.Setup.CustomScriptExtension.ps1",
"mySqlInstallationZipPath": {
"5.7": "https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.17-winx64.zip",
"5.6": "https://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.35-winx64.zip",
"5.5": "https://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.54-winx64.zip"
},
"mySqlInstallationZip": "[variables('mySqlInstallationZipPath')[parameters('mySqlVersion')]]"
},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"name": "[variables('vhdStorageName')]",
"apiVersion": "2015-05-01-preview",
"location": "[resourceGroup().location]",
"tags": {
"displayName": "StorageAccount"
},
"properties": {
"accountType": "[variables('vhdStorageType')]"
}
},
{
"type": "Microsoft.Network/publicIPAddresses",
"name": "[variables('publicIPAddressName')]",
"apiVersion": "2015-05-01-preview",
"location": "[resourceGroup().location]",
"tags": {
"displayName": "PublicIPAddress"
},
"properties": {
"publicIPAllocationMethod": "[variables('publicIPAddressType')]",
"dnsSettings": {
"domainNameLabel": "[variables('dnsNameForPublicIP')]"
}
}
},
{
"type": "Microsoft.Network/networkSecurityGroups",
"name": "[variables('subnetSecurityGroupName')]",
"apiVersion": "2015-05-01-preview",
"location": "[resourceGroup().location]",
"properties": {
"securityRules": [
{
"name": "AllowInbound",
"properties": {
"protocol": "*",
"sourcePortRange": "*",
"destinationPortRange": "*",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 101,
"direction": "Inbound"
}
}
]
}
},
{
"type": "Microsoft.Network/virtualNetworks",
"name": "[variables('virtualNetworkName')]",
"apiVersion": "2015-05-01-preview",
"location": "[resourceGroup().location]",
"tags": {
"displayName": "VirtualNetwork"
},
"dependsOn": [
"[concat('Microsoft.Network/networkSecurityGroups/', variables('subnetSecurityGroupName'))]"
],
"properties": {
"addressSpace": {
"addressPrefixes": [
"[variables('addressPrefix')]"
]
},
"subnets": [
{
"name": "[variables('subnetName')]",
"properties": {
"addressPrefix": "[variables('subnetPrefix')]",
"networkSecurityGroup": {
"id": "[variables('subnetSecurityGroupId')]"
}
}
}
]
}
},
{
"type": "Microsoft.Network/networkInterfaces",
"name": "[variables('nicName')]",
"apiVersion": "2015-05-01-preview",
"location": "[resourceGroup().location]",
"tags": {
"displayName": "NetworkInterface"
},
"dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]",
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
],
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIPAddressName'))]"
},
"subnet": {
"id": "[variables('subnetRef')]"
}
}
}
]
}
},
{
"type": "Microsoft.Compute/virtualMachines",
"name": "[parameters('vmName')]",
"apiVersion": "2015-06-15",
"location": "[resourceGroup().location]",
"tags": {
"displayName": "VirtualMachine"
},
"dependsOn": [
"[concat('Microsoft.Storage/storageAccounts/', variables('vhdStorageName'))]",
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
],
"properties": {
"hardwareProfile": {
"vmSize": "[parameters('vmSize')]"
},
"osProfile": {
"computerName": "[parameters('vmName')]",
"adminUsername": "[parameters('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]",
"windowsConfiguration": {
"timeZone": "[parameters('vmTimeZone')]"
}
},
"storageProfile": {
"imageReference": {
"publisher": "[variables('imagePublisher')]",
"offer": "[variables('imageOffer')]",
"sku": "[parameters('windowsOSVersion')]",
"version": "latest"
},
"osDisk": {
"name": "osdisk",
"vhd": {
"uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('vhdStorageName')),providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).primaryEndpoints.blob ,variables('vhdStorageContainerName'),'/', variables('OSDiskName'), '.vhd')]"
},
"caching": "ReadWrite",
"createOption": "FromImage"
}
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]"
}
]
}
}
},
{
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat(parameters('vmName'), '/', 'PowerShellExec')]",
"apiVersion": "2015-06-15",
"location": "[resourceGroup().location]",
"dependsOn": [
"[concat('Microsoft.Compute/virtualMachines/', parameters('vmName'))]"
],
"properties": {
"publisher": "Microsoft.Compute",
"type": "CustomScriptExtension",
"typeHandlerVersion": "1.4",
"autoUpgradeMinorVersion": true,
"settings": {
"fileUris": [
"[concat(variables('assetLocation'), '/', variables('cseBlobNameScript'))]"
],
"commandToExecute": "[concat('powershell.exe -NoLogo -NoProfile -ExecutionPolicy Unrestricted -File \"', variables('cseBlobNameScript'), '\" -MySqlVersion \"', parameters('mySqlVersion'), '\" -MySqlPort \"', parameters('mySqlServicePort'), '\" -MySqlInstallationPackageUri \"', variables('mySqlInstallationZip'), '\" -MySqlAdminUserName \"', parameters('adminUsername'), '\" -MySqlAdminPassword \"', parameters('adminPassword'), '\"')]"
}
}
}
],
"outputs": {
}
}