Adding managed disk templates (#370)
This commit is contained in:
Родитель
49ad89662e
Коммит
8a6ba2d7b3
|
@ -0,0 +1,242 @@
|
|||
{
|
||||
|
||||
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"adminUsername": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "Username for the Virtual Machine. Default value is localadmin"
|
||||
},
|
||||
"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: 12.SP1, 6.7 , 7.2"
|
||||
}
|
||||
},
|
||||
|
||||
"vmSize": {
|
||||
"type": "string",
|
||||
"defaultValue": "Standard_A1",
|
||||
"metadata": {
|
||||
"description": "The size of the Virtual Machine."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"variables": {
|
||||
"dnsNameForPublicIP": "[tolower(concat('dns', uniquestring(resourceGroup().id)))]",
|
||||
"location": "[resourceGroup().location]",
|
||||
"OSDiskName": "osdisk",
|
||||
"nicName": "[tolower(concat('nic',uniquestring(resourceGroup().id)))]",
|
||||
"addressPrefix": "10.0.0.0/24",
|
||||
"subnetName": "[tolower(concat('subnet',uniquestring(resourceGroup().id)))]",
|
||||
"subnetPrefix": "10.0.0.0/24",
|
||||
"storageAccountName": "[concat('sa', uniquestring(resourceGroup().id))]",
|
||||
"storageAccountType": "Standard_LRS",
|
||||
"vmStorageAccountContainerName": "vhds",
|
||||
"vmName": "[substring(concat('simplelinuxvm',resourceGroup().Name),0,14)]",
|
||||
"virtualNetworkName": "[tolower(concat('vnet',uniquestring(resourceGroup().id)))]",
|
||||
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]",
|
||||
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]",
|
||||
"networkSecurityGroupName": "[tolower(concat('nsg',uniquestring(resourceGroup().id)))]"
|
||||
},
|
||||
|
||||
"resources": [
|
||||
{
|
||||
"type": "Microsoft.Storage/storageAccounts",
|
||||
"name": "[toLower(variables('storageAccountName'))]",
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"location": "[variables('location')]",
|
||||
"properties": {
|
||||
"accountType": "[variables('storageAccountType')]"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"apiVersion": "2017-10-01",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"apiVersion": "2017-10-01",
|
||||
"type": "Microsoft.Network/virtualNetworks",
|
||||
"name": "[variables('virtualNetworkName')]",
|
||||
"location": "[variables('location')]",
|
||||
"properties": {
|
||||
"addressSpace": {
|
||||
"addressPrefixes": [
|
||||
"[variables('addressPrefix')]"
|
||||
]
|
||||
},
|
||||
|
||||
"subnets": [
|
||||
{
|
||||
"name": "[variables('subnetName')]",
|
||||
"properties": {
|
||||
"addressPrefix": "[variables('subnetPrefix')]"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"apiVersion": "2017-10-01",
|
||||
"type": "Microsoft.Network/networkInterfaces",
|
||||
"name": "[variables('nicName')]",
|
||||
"location": "[variables('location')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]",
|
||||
"[variables('networkSecurityGroupName')]"
|
||||
],
|
||||
|
||||
"properties": {
|
||||
"networkSecurityGroup": {
|
||||
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]"
|
||||
},
|
||||
|
||||
"ipConfigurations": [
|
||||
{
|
||||
"name": "ipconfig1",
|
||||
"properties": {
|
||||
"privateIPAllocationMethod": "Dynamic",
|
||||
"subnet": {
|
||||
"id": "[variables('subnetRef')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.Compute/disks",
|
||||
"sku": {
|
||||
"name": "Standard_LRS"
|
||||
},
|
||||
"name": "[concat(variables('vmName'),'-datadisk1')]",
|
||||
"apiVersion": "2017-03-30",
|
||||
"location": "[resourceGroup().location]",
|
||||
"properties": {
|
||||
"creationData": {
|
||||
"createOption": "Empty"
|
||||
},
|
||||
"diskSizeGB": 10
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2017-03-30",
|
||||
"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",
|
||||
"createOption": "FromImage"
|
||||
},
|
||||
"dataDisks": [
|
||||
{
|
||||
"lun": 1,
|
||||
"name": "[concat(variables('vmName'),'-datadisk1')]",
|
||||
"createOption": "attach",
|
||||
"managedDisk": {
|
||||
"id": "[resourceId('Microsoft.Compute/disks/', concat(variables('vmName'),'-datadisk1'))]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"diskSizeGB": 10,
|
||||
"lun": 2,
|
||||
"createOption": "Empty"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"networkProfile": {
|
||||
"networkInterfaces": [
|
||||
{
|
||||
"id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"diagnosticsProfile": {
|
||||
"bootDiagnostics": {
|
||||
"enabled": "true",
|
||||
"storageUri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).primaryEndpoints.blob)]"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,220 @@
|
|||
{
|
||||
|
||||
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"adminUsername": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "Username for the Virtual Machine. Default value is localadmin"
|
||||
},
|
||||
"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: 12.SP1, 6.7 , 7.2"
|
||||
}
|
||||
},
|
||||
|
||||
"vmSize": {
|
||||
"type": "string",
|
||||
"defaultValue": "Standard_A1",
|
||||
"metadata": {
|
||||
"description": "The size of the Virtual Machine."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"variables": {
|
||||
"dnsNameForPublicIP": "[tolower(concat('dns', uniquestring(resourceGroup().id)))]",
|
||||
"location": "[resourceGroup().location]",
|
||||
"OSDiskName": "osdisk",
|
||||
"nicName": "[tolower(concat('nic',uniquestring(resourceGroup().id)))]",
|
||||
"addressPrefix": "10.0.0.0/24",
|
||||
"subnetName": "[tolower(concat('subnet',uniquestring(resourceGroup().id)))]",
|
||||
"subnetPrefix": "10.0.0.0/24",
|
||||
"storageAccountName": "[concat('sa', uniquestring(resourceGroup().id))]",
|
||||
"storageAccountType": "Standard_LRS",
|
||||
"vmStorageAccountContainerName": "vhds",
|
||||
"vmName": "[substring(concat('simplelinuxvm',resourceGroup().Name),0,14)]",
|
||||
"virtualNetworkName": "[tolower(concat('vnet',uniquestring(resourceGroup().id)))]",
|
||||
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]",
|
||||
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]",
|
||||
"networkSecurityGroupName": "[tolower(concat('nsg',uniquestring(resourceGroup().id)))]"
|
||||
},
|
||||
|
||||
"resources": [
|
||||
{
|
||||
"type": "Microsoft.Storage/storageAccounts",
|
||||
"name": "[toLower(variables('storageAccountName'))]",
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"location": "[variables('location')]",
|
||||
"properties": {
|
||||
"accountType": "[variables('storageAccountType')]"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"apiVersion": "2017-10-01",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"apiVersion": "2017-10-01",
|
||||
"type": "Microsoft.Network/virtualNetworks",
|
||||
"name": "[variables('virtualNetworkName')]",
|
||||
"location": "[variables('location')]",
|
||||
"properties": {
|
||||
"addressSpace": {
|
||||
"addressPrefixes": [
|
||||
"[variables('addressPrefix')]"
|
||||
]
|
||||
},
|
||||
|
||||
"subnets": [
|
||||
{
|
||||
"name": "[variables('subnetName')]",
|
||||
"properties": {
|
||||
"addressPrefix": "[variables('subnetPrefix')]"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"apiVersion": "2017-10-01",
|
||||
"type": "Microsoft.Network/networkInterfaces",
|
||||
"name": "[variables('nicName')]",
|
||||
"location": "[variables('location')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]",
|
||||
"[variables('networkSecurityGroupName')]"
|
||||
],
|
||||
|
||||
"properties": {
|
||||
"networkSecurityGroup": {
|
||||
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]"
|
||||
},
|
||||
|
||||
"ipConfigurations": [
|
||||
{
|
||||
"name": "ipconfig1",
|
||||
"properties": {
|
||||
"privateIPAllocationMethod": "Dynamic",
|
||||
"subnet": {
|
||||
"id": "[variables('subnetRef')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"apiVersion": "2017-03-30",
|
||||
"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",
|
||||
"createOption": "FromImage"
|
||||
},
|
||||
"dataDisks": [
|
||||
{
|
||||
"diskSizeGB": 10,
|
||||
"lun": 1,
|
||||
"createOption": "Empty"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"networkProfile": {
|
||||
"networkInterfaces": [
|
||||
{
|
||||
"id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"diagnosticsProfile": {
|
||||
"bootDiagnostics": {
|
||||
"enabled": "true",
|
||||
"storageUri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).primaryEndpoints.blob)]"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,202 @@
|
|||
{
|
||||
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"vmName": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "Name of the VM."
|
||||
},
|
||||
"defaultValue": "[substring(concat('simplewinvm',resourceGroup().Name),0,12)]"
|
||||
},
|
||||
"adminUsername": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "Username for the Virtual Machine."
|
||||
},
|
||||
"defaultValue": "vmadmin1"
|
||||
},
|
||||
"adminPassword": {
|
||||
"type": "securestring",
|
||||
"metadata": {
|
||||
"description": "The password for the Administrator account of the new VMs. Default value is subscription id"
|
||||
},
|
||||
"defaultValue": "[concat('Subscription#',substring(resourcegroup().id,15,36))]"
|
||||
},
|
||||
"windowsOSVersion": {
|
||||
"type": "string",
|
||||
"defaultValue": "2016-Datacenter",
|
||||
"allowedValues": [
|
||||
"2008-R2-SP1",
|
||||
"2012-Datacenter",
|
||||
"2012-R2-Datacenter",
|
||||
"2016-Datacenter"
|
||||
],
|
||||
"metadata": {
|
||||
"description": "The Windows version for the VM. This will pick a fully patched image of this given Windows version. Allowed values: 2008-R2-SP1, 2012-Datacenter, 2012-R2-Datacenter."
|
||||
}
|
||||
}
|
||||
},
|
||||
"variables": {
|
||||
"location": "[resourceGroup().location]",
|
||||
"imagePublisher": "MicrosoftWindowsServer",
|
||||
"imageOffer": "WindowsServer",
|
||||
"OSDiskName": "osdisk",
|
||||
"nicName": "[replace(replace(tolower(concat('nic',resourceGroup().name)), '-', ''), '.','')]",
|
||||
"addressPrefix": "10.0.0.0/24",
|
||||
"subnetName": "[replace(replace(tolower(concat('subnet',resourceGroup().name)), '-', ''), '.','')]",
|
||||
"subnetPrefix": "10.0.0.0/24",
|
||||
"vmSize": "Standard_A1",
|
||||
"virtualNetworkName": "[replace(replace(tolower(concat('vnet',resourceGroup().name)), '-', ''), '.','')]",
|
||||
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]",
|
||||
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]",
|
||||
"networkSecurityGroupName": "[replace(replace(tolower(concat('nsg',resourceGroup().name)), '-', ''), '.','')]"
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"apiVersion": "2015-06-15",
|
||||
"type": "Microsoft.Network/networkSecurityGroups",
|
||||
"name": "[variables('networkSecurityGroupName')]",
|
||||
"location": "[variables('location')]",
|
||||
"tags": {
|
||||
"displayName": "NetworkSecurityGroup"
|
||||
},
|
||||
"properties": {
|
||||
"securityRules": [
|
||||
{
|
||||
"name": "rule1",
|
||||
"properties": {
|
||||
"protocol": "*",
|
||||
"sourcePortRange": "*",
|
||||
"destinationPortRange": "*",
|
||||
"sourceAddressPrefix": "*",
|
||||
"destinationAddressPrefix": "*",
|
||||
"access": "Allow",
|
||||
"priority": 101,
|
||||
"direction": "Inbound"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-06-15",
|
||||
"type": "Microsoft.Network/virtualNetworks",
|
||||
"name": "[variables('virtualNetworkName')]",
|
||||
"location": "[variables('location')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/networkSecurityGroups/', variables('networkSecurityGroupName'))]"
|
||||
],
|
||||
"properties": {
|
||||
"addressSpace": {
|
||||
"addressPrefixes": [
|
||||
"[variables('addressPrefix')]"
|
||||
]
|
||||
},
|
||||
"subnets": [
|
||||
{
|
||||
"name": "[variables('subnetName')]",
|
||||
"properties": {
|
||||
"addressPrefix": "[variables('subnetPrefix')]",
|
||||
"networkSecurityGroup": {
|
||||
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-06-15",
|
||||
"type": "Microsoft.Network/networkInterfaces",
|
||||
"name": "[variables('nicName')]",
|
||||
"location": "[variables('location')]",
|
||||
"dependsOn": [
|
||||
|
||||
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
|
||||
],
|
||||
"properties": {
|
||||
"ipConfigurations": [
|
||||
{
|
||||
"name": "ipconfig1",
|
||||
"properties": {
|
||||
"privateIPAllocationMethod": "Dynamic",
|
||||
"subnet": {
|
||||
"id": "[variables('subnetRef')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.Compute/disks",
|
||||
"sku": {
|
||||
"name": "Standard_LRS"
|
||||
},
|
||||
"name": "[concat(parameters('vmName'),'-datadisk1')]",
|
||||
"apiVersion": "2017-03-30",
|
||||
"location": "[resourceGroup().location]",
|
||||
"properties": {
|
||||
"creationData": {
|
||||
"createOption": "Empty"
|
||||
},
|
||||
"diskSizeGB": 10
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2017-03-30",
|
||||
"type": "Microsoft.Compute/virtualMachines",
|
||||
"name": "[parameters('vmName')]",
|
||||
"location": "[variables('location')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]",
|
||||
"[resourceId('Microsoft.Compute/disks/', concat(parameters('vmName'),'-datadisk1'))]"
|
||||
],
|
||||
"properties": {
|
||||
"hardwareProfile": {
|
||||
"vmSize": "[variables('vmSize')]"
|
||||
},
|
||||
"osProfile": {
|
||||
"computerName": "[parameters('vmName')]",
|
||||
"adminUsername": "[parameters('adminUsername')]",
|
||||
"adminPassword": "[parameters('adminPassword')]"
|
||||
},
|
||||
"storageProfile": {
|
||||
"imageReference": {
|
||||
"publisher": "[variables('imagePublisher')]",
|
||||
"offer": "[variables('imageOffer')]",
|
||||
"sku": "[parameters('windowsOSVersion')]",
|
||||
"version": "latest"
|
||||
},
|
||||
"osDisk": {
|
||||
"name": "osdisk",
|
||||
"createOption": "FromImage"
|
||||
},
|
||||
"dataDisks": [
|
||||
{
|
||||
"lun": 1,
|
||||
"name": "[concat(parameters('vmName'),'-datadisk1')]",
|
||||
"createOption": "attach",
|
||||
"managedDisk": {
|
||||
"id": "[resourceId('Microsoft.Compute/disks/', concat(parameters('vmName'),'-datadisk1'))]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"diskSizeGB": 10,
|
||||
"lun": 2,
|
||||
"createOption": "Empty"
|
||||
}
|
||||
]
|
||||
},
|
||||
"networkProfile": {
|
||||
"networkInterfaces": [
|
||||
{
|
||||
"id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
{
|
||||
|
||||
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||
|
||||
"contentVersion": "1.0.0.0",
|
||||
|
||||
"parameters": {
|
||||
|
||||
"vmName": {
|
||||
|
||||
"type": "string",
|
||||
|
||||
"metadata": {
|
||||
|
||||
"description": "Name of the existing VM to apply the custom script to"
|
||||
|
||||
},
|
||||
|
||||
"defaultvalue": "[substring(concat('simplewinvm',resourceGroup().Name),0,12)]"
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
"variables": {
|
||||
|
||||
},
|
||||
|
||||
"resources": [
|
||||
|
||||
{
|
||||
|
||||
"type": "Microsoft.Compute/virtualMachines/extensions",
|
||||
|
||||
"name": "[concat(parameters('vmName'),'/CustomScriptExtension')]",
|
||||
|
||||
"apiVersion": "2017-03-30",
|
||||
|
||||
"location": "[resourceGroup().location]",
|
||||
|
||||
"properties": {
|
||||
|
||||
"publisher": "Microsoft.Compute",
|
||||
|
||||
"type": "CustomScriptExtension",
|
||||
|
||||
"typeHandlerVersion": "1.8",
|
||||
|
||||
"autoUpgradeMinorVersion": true,
|
||||
|
||||
"settings": {
|
||||
|
||||
"commandToExecute": "md c:\\users\\public\\documents\\test"
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
],
|
||||
|
||||
"outputs": {}
|
||||
|
||||
}
|
|
@ -0,0 +1,298 @@
|
|||
{
|
||||
|
||||
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
|
||||
|
||||
"contentVersion": "1.0.0.0",
|
||||
|
||||
"parameters": {
|
||||
"vmSku": {
|
||||
"defaultValue": "Standard_A1",
|
||||
"type": "String",
|
||||
"metadata": {
|
||||
"description": "Size of VMs in the VM Scale Set."
|
||||
}
|
||||
},
|
||||
|
||||
"vmssName": {
|
||||
"type": "String",
|
||||
"defaultValue": "[substring(concat('vmss', uniquestring(replace(resourceGroup().Id,'-',''))), 0, 8)]",
|
||||
"metadata": {
|
||||
"description": "String used as a base for naming resources. Must be 3-10 characters in length and globally unique across Azure Stack. A hash is prepended to this string for some resources, and resource-specific information is appended."
|
||||
}
|
||||
},
|
||||
|
||||
"instanceCount": {
|
||||
"defaultValue": 2,
|
||||
"maxValue": 20,
|
||||
"type": "Int",
|
||||
"metadata": {
|
||||
"description": "Number of VM instances (20 or less)."
|
||||
}
|
||||
},
|
||||
|
||||
"adminUsername": {
|
||||
"type": "String",
|
||||
"defaultValue": "azureuser",
|
||||
"metadata": {
|
||||
"description": "Admin username on all VMs."
|
||||
}
|
||||
},
|
||||
|
||||
"adminPassword": {
|
||||
"type": "SecureString",
|
||||
"defaultValue": "[concat('Subscription#', subscription().subscriptionId)]",
|
||||
"metadata": {
|
||||
"description": "Admin password on all VMs."
|
||||
}
|
||||
},
|
||||
|
||||
"osImagePublisher": {
|
||||
"type": "string",
|
||||
"defaultValue": "Canonical",
|
||||
"metadata": {
|
||||
"description": "Maps to the publisher in the Azure Stack Platform Image Repository manifest file."
|
||||
}
|
||||
},
|
||||
|
||||
"osImageOffer": {
|
||||
"type": "string",
|
||||
"defaultValue": "UbuntuServer",
|
||||
"metadata": {
|
||||
"description": "Maps to the Offer in the Azure Stack Platform Image Repository manifest file."
|
||||
}
|
||||
},
|
||||
|
||||
"osImageSku": {
|
||||
"type": "string",
|
||||
"defaultValue": "16.04-LTS",
|
||||
"metadata": {
|
||||
"description": "Maps to the sku in the Azure Stack Platform Image Repository."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"variables": {
|
||||
"location": "[resourceGroup().location]",
|
||||
"vnetName": "[toLower(concat('vnet', uniqueString(resourceGroup().id)))]",
|
||||
"subnetName": "[toLower(concat('subnet', uniqueString(resourceGroup().id)))]",
|
||||
"storageAccountName": "[toLower(concat('SA', uniqueString(resourceGroup().id)))]",
|
||||
"storageAccountContainerName": "[toLower(concat('SC', uniqueString(resourceGroup().id)))]",
|
||||
"storageAccountType": "Standard_LRS",
|
||||
"OSDiskName": "osdisk",
|
||||
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks', variables('vnetName'))]",
|
||||
"subnetRef": "[concat(variables('vnetID'),'/subnets/', variables('subnetName'))]",
|
||||
"publicIPAddressName": "[toLower(concat('pip', uniqueString(resourceGroup().id)))]",
|
||||
"vmssDomainName": "[toLower(concat('pubdns', uniqueString(resourceGroup().id)))]",
|
||||
"loadBalancerName": "[concat('LB', uniqueString(resourceGroup().id))]",
|
||||
"loadBalancerFrontEndName": "[concat('LBFrontEnd', uniqueString(resourceGroup().id))]",
|
||||
"loadBalancerBackEndName": "[concat('LBBackEnd', uniqueString(resourceGroup().id))]",
|
||||
"loadBalancerProbeName": "[concat('LBHttpProbe', uniqueString(resourceGroup().id))]",
|
||||
"loadBalancerNatPoolName": "[concat('LBNatPool', uniqueString(resourceGroup().id))]"
|
||||
},
|
||||
|
||||
"resources": [
|
||||
{
|
||||
"type": "Microsoft.Storage/storageAccounts",
|
||||
"name": "[variables('storageAccountName')]",
|
||||
"apiVersion": "2015-06-15",
|
||||
"location": "[variables('location')]",
|
||||
"properties": {
|
||||
"accountType": "[variables('storageAccountType')]"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"type": "Microsoft.Network/virtualNetworks",
|
||||
"name": "[variables('vnetName')]",
|
||||
"apiVersion": "2015-06-15",
|
||||
"location": "[variables('location')]",
|
||||
"properties": {
|
||||
"addressSpace": {
|
||||
"addressPrefixes": [
|
||||
"10.0.0.0/16"
|
||||
]
|
||||
},
|
||||
|
||||
"subnets": [
|
||||
{
|
||||
"name": "[variables('subnetName')]",
|
||||
"properties": {
|
||||
"addressPrefix": "10.0.0.0/24"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"type": "Microsoft.Network/publicIPAddresses",
|
||||
"name": "[variables('publicIPAddressName')]",
|
||||
"apiVersion": "2015-06-15",
|
||||
"location": "[variables('location')]",
|
||||
"properties": {
|
||||
"publicIPAllocationMethod": "Dynamic",
|
||||
"dnsSettings": {
|
||||
"domainNameLabel": "[variables('vmssDomainName')]"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"type": "Microsoft.Network/loadBalancers",
|
||||
"name": "[variables('loadBalancerName')]",
|
||||
"apiVersion": "2015-06-15",
|
||||
"location": "[variables('location')]",
|
||||
"properties": {
|
||||
"frontendIPConfigurations": [ {
|
||||
|
||||
"name": "[variables('loadBalancerFrontEndName')]",
|
||||
"properties": {
|
||||
"publicIPAddress": {
|
||||
"id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIPAddressName'))]"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
"backendAddressPools": [
|
||||
{
|
||||
"name": "[variables('loadBalancerBackendName')]"
|
||||
}
|
||||
],
|
||||
|
||||
"loadBalancingRules": [
|
||||
{
|
||||
"name": "roundRobinLBRule",
|
||||
"properties": {
|
||||
"frontendIPConfiguration": {
|
||||
"id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName')), '/frontendIPConfigurations/', variables('loadBalancerFrontEndName'))]"
|
||||
},
|
||||
|
||||
"backendAddressPool": {
|
||||
"id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName')), '/backendAddressPools/', variables('loadBalancerBackendName'))]"
|
||||
},
|
||||
|
||||
"protocol": "tcp",
|
||||
"frontendPort": 80,
|
||||
"backendPort": 80,
|
||||
"enableFloatingIP": false,
|
||||
"idleTimeoutInMinutes": 5,
|
||||
"probe": {
|
||||
"id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName')), '/probes/', variables('loadBalancerProbeName'))]"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
"probes": [
|
||||
{
|
||||
"name": "[variables('loadBalancerProbeName')]",
|
||||
"properties": {
|
||||
"protocol": "tcp",
|
||||
"port": 80,
|
||||
"intervalInSeconds": "5",
|
||||
"numberOfProbes": "2"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
"inboundNatPools": [
|
||||
{
|
||||
"name": "[variables('loadBalancerNatPoolName')]",
|
||||
"properties": {
|
||||
"frontendIPConfiguration": {
|
||||
"id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName')), '/frontendIPConfigurations/', variables('loadBalancerFrontEndName'))]"
|
||||
},
|
||||
"protocol": "tcp",
|
||||
"frontendPortRangeStart": "50000",
|
||||
"frontendPortRangeEnd": "50019",
|
||||
"backendPort": "22"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]"
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"type": "Microsoft.Compute/virtualMachineScaleSets",
|
||||
"sku": {
|
||||
"name": "[parameters('vmSku')]",
|
||||
"tier": "Standard",
|
||||
"capacity": "[parameters('instanceCount')]"
|
||||
},
|
||||
|
||||
"name": "[parameters('vmssName')]",
|
||||
"apiVersion": "2017-03-30",
|
||||
"location": "[variables('location')]",
|
||||
"properties": {
|
||||
"upgradePolicy": {
|
||||
"mode": "Manual"
|
||||
},
|
||||
|
||||
"virtualMachineProfile": {
|
||||
"storageProfile": {
|
||||
"osDisk": {
|
||||
"createOption": "FromImage"
|
||||
},
|
||||
|
||||
"imageReference": {
|
||||
"publisher": "[parameters('osImagePublisher')]",
|
||||
"offer": "[parameters('osImageOffer')]",
|
||||
"sku": "[parameters('osImageSku')]",
|
||||
"version": "latest"
|
||||
}
|
||||
},
|
||||
|
||||
"osProfile": {
|
||||
"computerNamePrefix": "[parameters('vmssName')]",
|
||||
"adminUsername": "[parameters('adminUsername')]",
|
||||
"adminPassword": "[parameters('adminPassword')]"
|
||||
},
|
||||
|
||||
"networkProfile": {
|
||||
"networkInterfaceConfigurations": [
|
||||
{
|
||||
"name": "nic",
|
||||
"properties": {
|
||||
"primary": "true",
|
||||
"ipConfigurations": [
|
||||
{
|
||||
"name": "ipconfig",
|
||||
"properties": {
|
||||
"subnet": {
|
||||
"id": "[variables('subnetRef')]"
|
||||
},
|
||||
|
||||
"loadBalancerBackendAddressPools": [
|
||||
{
|
||||
"id": "[concat('/subscriptions/', subscription().subscriptionId,'/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Network/loadBalancers/', variables('loadBalancerName'), '/backendAddressPools/', variables('loadBalancerBackEndName'))]"
|
||||
}
|
||||
],
|
||||
|
||||
"loadBalancerInboundNatPools": [
|
||||
{
|
||||
"id": "[concat('/subscriptions/', subscription().subscriptionId,'/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Network/loadBalancers/', variables('loadBalancerName'), '/inboundNatPools/', variables('loadBalancerNatPoolName'))]"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]",
|
||||
"[concat('Microsoft.Network/virtualNetworks/', variables('vnetName'))]",
|
||||
"[resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName'))]"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,421 @@
|
|||
{
|
||||
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
|
||||
"parameters": {
|
||||
"adminUsername": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "The name of the Administrator of the new VMs"
|
||||
},
|
||||
"defaultValue": "vmadmin"
|
||||
},
|
||||
|
||||
"adminPassword": {
|
||||
"type": "securestring",
|
||||
"metadata": {
|
||||
"description": "The password for the Administrator account of the new VMs. Default value is subscription id"
|
||||
},
|
||||
"defaultValue": "[concat('Subscription#',substring(resourcegroup().id,15,36))]"
|
||||
},
|
||||
|
||||
"numberOfInstances": {
|
||||
"type": "int",
|
||||
"defaultValue": 3,
|
||||
"allowedValues": [
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
8,
|
||||
10,
|
||||
15,
|
||||
20,
|
||||
25
|
||||
],
|
||||
|
||||
"metadata": {
|
||||
"description": "Number of VMs to deploy"
|
||||
}
|
||||
},
|
||||
|
||||
"dataDiskSIze": {
|
||||
"type": "int",
|
||||
"defaultValue": 1,
|
||||
"allowedValues": [
|
||||
1,
|
||||
2,
|
||||
10,
|
||||
100,
|
||||
500,
|
||||
750,
|
||||
1000
|
||||
],
|
||||
|
||||
"metadata": {
|
||||
"description": "Size of the Data Disk"
|
||||
}
|
||||
},
|
||||
|
||||
"vmNamePrefix": {
|
||||
"type": "string",
|
||||
"defaultValue": "vmset-",
|
||||
"metadata": {
|
||||
"description": "VM name prefix"
|
||||
}
|
||||
},
|
||||
|
||||
"vmSize": {
|
||||
"allowedValues": [
|
||||
"Standard_A1",
|
||||
"Standard_A2",
|
||||
"Standard_A3",
|
||||
"Standard_A4",
|
||||
"Standard_D1",
|
||||
"Standard_D2",
|
||||
"Standard_D3",
|
||||
"Standard_D4"
|
||||
],
|
||||
"defaultValue": "Standard_A1",
|
||||
"metadata": {
|
||||
"description": "This is the size of your VM"
|
||||
},
|
||||
"type": "string"
|
||||
},
|
||||
|
||||
"dnsPrefix": {
|
||||
"type": "string",
|
||||
"defaultValue": "vmdns",
|
||||
"metadata": {
|
||||
"description": "dns name prefix"
|
||||
}
|
||||
},
|
||||
|
||||
"osImagePublisher": {
|
||||
"type": "string",
|
||||
"defaultValue": "Canonical",
|
||||
"metadata": {
|
||||
"description": "Maps to the publisher in the Azure Stack Platform Image Repository manifest file."
|
||||
}
|
||||
},
|
||||
|
||||
"osImageOffer": {
|
||||
"type": "string",
|
||||
"defaultValue": "UbuntuServer",
|
||||
"metadata": {
|
||||
"description": "Maps to the Offer in the Azure Stack Platform Image Repository manifest file."
|
||||
}
|
||||
},
|
||||
|
||||
"osImageSku": {
|
||||
"type": "string",
|
||||
"defaultValue": "16.04-LTS",
|
||||
"metadata": {
|
||||
"description": "Maps to the sku in the Azure Stack Platform Image Repository."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"variables": {
|
||||
"availabilitySetName": "[toLower(concat('aSet-', resourceGroup().name))]",
|
||||
"storageAccountType": "Standard_LRS",
|
||||
"vmSize": "[parameters('vmSize')]",
|
||||
"dnsPrefix": "[parameters('dnsPrefix')]",
|
||||
"osImageVersion": "latest",
|
||||
"dataDiskSize": "[parameters('dataDiskSize')]",
|
||||
"addressPrefix": "10.0.0.0/16",
|
||||
"virtualNetworkName": "[tolower(concat('vNet-',resourceGroup().name))]",
|
||||
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]",
|
||||
"NICPrefix": "vnic-",
|
||||
"subnetPrefix": "10.0.0.0/24",
|
||||
"subnetName": "vmstaticsubnet",
|
||||
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]",
|
||||
"storageName": "[concat('sa', uniquestring(resourceGroup().id))]",
|
||||
"publicLBName": "[tolower(concat('external-lb-', resourceGroup().name))]",
|
||||
"publiclbID": "[resourceId('Microsoft.Network/loadBalancers',variables('publicLBName'))]",
|
||||
"lbFE": "[tolower(concat('external-lb-fe-',resourceGroup().name))]",
|
||||
"publiclbFEConfigID": "[concat(variables('publiclbID'),'/frontendIPConfigurations/',variables('lbFE'))]",
|
||||
"publicIPAddressName": "[tolower(concat('public-ip',resourceGroup().name))]",
|
||||
"rdpPort": 22,
|
||||
"nsgName": "[tolower(concat('vmnsg',resourceGroup().name))]",
|
||||
"nsgID": "[resourceId('Microsoft.Network/networkSecurityGroups',variables('nsgName'))]",
|
||||
"vmContainerName": "vhds"
|
||||
},
|
||||
|
||||
"resources": [
|
||||
{
|
||||
"type": "Microsoft.Storage/storageAccounts",
|
||||
"name": "[variables('storageName')]",
|
||||
"apiVersion": "2015-06-15",
|
||||
"location": "[resourceGroup().location]",
|
||||
"properties": {
|
||||
"accountType": "[variables('storageAccountType')]"
|
||||
},
|
||||
|
||||
"dependsOn": [
|
||||
"[variables('publiclbName')]"
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"type": "Microsoft.Network/networkSecurityGroups",
|
||||
"name": "[variables('nsgName')]",
|
||||
"apiVersion": "2015-06-15",
|
||||
"location": "[resourceGroup().location]",
|
||||
"properties": {
|
||||
"securityRules": [
|
||||
{
|
||||
"name": "rule1",
|
||||
"properties": {
|
||||
"protocol": "*",
|
||||
"sourcePortRange": "*",
|
||||
"destinationPortRange": "*",
|
||||
"sourceAddressPrefix": "*",
|
||||
"destinationAddressPrefix": "*",
|
||||
"access": "Allow",
|
||||
"priority": 101,
|
||||
"direction": "Inbound"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"type": "Microsoft.Compute/availabilitySets",
|
||||
"name": "[variables('availabilitySetName')]",
|
||||
"apiVersion": "2017-03-30",
|
||||
"location": "[resourceGroup().location]",
|
||||
"properties": {
|
||||
"platformFaultDomainCount": "3",
|
||||
"platformUpdateDomainCount": "5"
|
||||
},
|
||||
"sku": {
|
||||
"name": "Aligned"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"type": "Microsoft.Network/publicIPAddresses",
|
||||
"name": "[variables('publicIPAddressName')]",
|
||||
"apiVersion": "2015-06-15",
|
||||
"location": "[resourceGroup().location]",
|
||||
"properties": {
|
||||
"publicIPAllocationMethod": "Dynamic",
|
||||
"dnsSettings": {
|
||||
"domainNameLabel": "[variables('dnsPrefix')]"
|
||||
}
|
||||
},
|
||||
|
||||
"dependsOn": [
|
||||
"[variables('vnetID')]"
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"type": "Microsoft.Network/virtualNetworks",
|
||||
"name": "[variables('virtualNetworkName')]",
|
||||
"apiVersion": "2015-06-15",
|
||||
"location": "[resourceGroup().location]",
|
||||
"properties": {
|
||||
"addressSpace": {
|
||||
"addressPrefixes": [
|
||||
"[variables('addressPrefix')]"
|
||||
]
|
||||
},
|
||||
|
||||
"subnets": [
|
||||
{
|
||||
"name": "[variables('subnetName')]",
|
||||
"properties": {
|
||||
"addressPrefix": "[variables('subnetPrefix')]",
|
||||
"networkSecurityGroup": {
|
||||
"id": "[variables('nsgID')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"dependsOn": [
|
||||
"[variables('nsgID')]"
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"apiVersion": "2015-06-15",
|
||||
"name": "[variables('publiclbName')]",
|
||||
"type": "Microsoft.Network/loadBalancers",
|
||||
"location": "[resourceGroup().location]",
|
||||
"dependsOn": [
|
||||
"[variables('vnetID')]",
|
||||
"[variables('publicIPAddressName')]"
|
||||
],
|
||||
|
||||
"properties": {
|
||||
"frontendIPConfigurations": [
|
||||
{
|
||||
"name": "[variables('lbFE')]",
|
||||
"properties": {
|
||||
"publicIPAddress": {
|
||||
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
"backendAddressPools": [
|
||||
{
|
||||
"name": "LoadBalancerBackend"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
"apiVersion": "2015-06-15",
|
||||
"type": "Microsoft.Network/loadBalancers/inboundNatRules",
|
||||
"name": "[concat(variables('publicLBName'), '/ssh-VM', copyIndex())]",
|
||||
"location": "[resourceGroup().location]",
|
||||
"copy": {
|
||||
"name": "lbNatLoop",
|
||||
"count": "[parameters('numberOfInstances')]"
|
||||
},
|
||||
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/loadBalancers/', variables('publiclbName'))]"
|
||||
],
|
||||
|
||||
"properties": {
|
||||
"frontendIPConfiguration": {
|
||||
"id": "[variables('publiclbFEConfigID')]"
|
||||
},
|
||||
|
||||
"protocol": "tcp",
|
||||
"frontendPort": "[copyIndex(2200)]",
|
||||
"backendPort": 22,
|
||||
"enableFloatingIP": false
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"type": "Microsoft.Network/networkInterfaces",
|
||||
"name": "[concat(variables('NICPrefix'), parameters('vmNamePrefix'), copyIndex())]",
|
||||
"apiVersion": "2015-06-15",
|
||||
"location": "[resourceGroup().location]",
|
||||
"copy": {
|
||||
"name": "nicLoop",
|
||||
"count": "[parameters('numberOfInstances')]"
|
||||
},
|
||||
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]",
|
||||
"[concat('Microsoft.Network/loadBalancers/', variables('publicLBName'))]",
|
||||
"[concat('Microsoft.Network/loadBalancers/', variables('publicLBName'), '/inboundNatRules/', 'ssh-VM', copyIndex())]"
|
||||
],
|
||||
|
||||
"properties": {
|
||||
"ipConfigurations": [
|
||||
{
|
||||
"name": "ipconfig1",
|
||||
"properties": {
|
||||
"privateIPAllocationMethod": "Dynamic",
|
||||
"subnet": {
|
||||
"id": "[variables('subnetRef')]"
|
||||
},
|
||||
|
||||
"loadBalancerBackendAddressPools": [
|
||||
{
|
||||
"id": "[concat(variables('publiclbID'), '/backendAddressPools/LoadBalancerBackend')]"
|
||||
}
|
||||
],
|
||||
|
||||
"loadBalancerInboundNatRules": [
|
||||
{
|
||||
"id": "[concat(variables('publiclbID'), '/inboundNatRules/ssh-VM', copyIndex())]"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"type": "Microsoft.Compute/virtualMachines",
|
||||
"name": "[concat(parameters('vmNamePrefix'), copyIndex())]",
|
||||
"apiVersion": "2017-03-30",
|
||||
"location": "[resourceGroup().location]",
|
||||
|
||||
"copy": {
|
||||
"name": "virtualMachineLoop",
|
||||
"count": "[parameters('numberOfInstances')]"
|
||||
},
|
||||
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Storage/storageAccounts/',variables('storageName'))]",
|
||||
"[resourceId('Microsoft.Network/networkInterfaces', concat(variables('NICPrefix'), parameters('vmNamePrefix'), copyIndex()))]",
|
||||
"[concat('Microsoft.Compute/availabilitySets/', variables('availabilitySetName'))]"
|
||||
],
|
||||
|
||||
"properties": {
|
||||
|
||||
"availabilitySet": {
|
||||
"id": "[resourceId('Microsoft.Compute/availabilitySets',variables('availabilitySetName'))]"
|
||||
},
|
||||
|
||||
"hardwareProfile": {
|
||||
"vmSize": "[variables('vmSize')]"
|
||||
},
|
||||
|
||||
"osProfile": {
|
||||
"computerName": "[concat(parameters('vmNamePrefix'), copyIndex())]",
|
||||
"adminUsername": "[parameters('adminUsername')]",
|
||||
"adminPassword": "[parameters('adminPassword')]"
|
||||
},
|
||||
|
||||
"storageProfile": {
|
||||
"imageReference": {
|
||||
"publisher": "[parameters('osImagePublisher')]",
|
||||
"offer": "[parameters('osImageOffer')]",
|
||||
"sku": "[parameters('osImageSKU')]",
|
||||
"version": "[variables('osImageVersion')]"
|
||||
},
|
||||
|
||||
"osDisk": {
|
||||
"createOption": "FromImage"
|
||||
},
|
||||
|
||||
"dataDisks": [
|
||||
{
|
||||
"createOption": "Empty",
|
||||
"diskSizeGB": "[variables('dataDiskSize')]",
|
||||
"lun": 0
|
||||
},
|
||||
{
|
||||
"createOption": "Empty",
|
||||
"diskSizeGB": "[variables('dataDiskSize')]",
|
||||
"lun": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"networkProfile": {
|
||||
"networkInterfaces": [
|
||||
{
|
||||
"id": "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('NICPrefix'), parameters('vmNamePrefix'), copyIndex()))]"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"diagnosticsProfile": {
|
||||
"bootDiagnostics": {
|
||||
"enabled": "true",
|
||||
"storageUri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageName')),providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).primaryEndpoints.blob)]"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,426 @@
|
|||
{
|
||||
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
|
||||
"parameters": {
|
||||
"adminUsername": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "The name of the Administrator of the new VMs"
|
||||
},
|
||||
"defaultValue": "vmadmin"
|
||||
},
|
||||
|
||||
"adminPassword": {
|
||||
"type": "securestring",
|
||||
"metadata": {
|
||||
"description": "The password for the Administrator account of the new VMs. Default value is subscription id"
|
||||
},
|
||||
"defaultValue": "[concat('Subscription#',substring(resourcegroup().id,15,36))]"
|
||||
},
|
||||
|
||||
"numberOfInstances": {
|
||||
"type": "int",
|
||||
"defaultValue": 3,
|
||||
"allowedValues": [
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
8,
|
||||
10,
|
||||
15,
|
||||
20,
|
||||
25
|
||||
],
|
||||
|
||||
"metadata": {
|
||||
"description": "Number of VMs to deploy"
|
||||
}
|
||||
},
|
||||
|
||||
"dataDiskSIze": {
|
||||
"type": "int",
|
||||
"defaultValue": 1,
|
||||
"allowedValues": [
|
||||
1,
|
||||
2,
|
||||
10,
|
||||
100,
|
||||
500,
|
||||
750,
|
||||
1000
|
||||
],
|
||||
|
||||
"metadata": {
|
||||
"description": "Size of the Data Disk"
|
||||
}
|
||||
},
|
||||
|
||||
"vmNamePrefix": {
|
||||
"type": "string",
|
||||
"defaultValue": "vmset-",
|
||||
"metadata": {
|
||||
"description": "VM name prefix"
|
||||
}
|
||||
},
|
||||
|
||||
"vmSize": {
|
||||
"allowedValues": [
|
||||
"Standard_A1",
|
||||
"Standard_A2",
|
||||
"Standard_A3",
|
||||
"Standard_A4",
|
||||
"Standard_D1",
|
||||
"Standard_D2",
|
||||
"Standard_D3",
|
||||
"Standard_D4"
|
||||
],
|
||||
"defaultValue": "Standard_A1",
|
||||
"metadata": {
|
||||
"description": "This is the size of your VM"
|
||||
},
|
||||
"type": "string"
|
||||
},
|
||||
|
||||
"dnsPrefix": {
|
||||
"type": "string",
|
||||
"defaultValue": "vmdns",
|
||||
"metadata": {
|
||||
"description": "dns name prefix"
|
||||
}
|
||||
},
|
||||
|
||||
"osImagePublisher": {
|
||||
"type": "string",
|
||||
"defaultValue": "MicrosoftWindowsServer",
|
||||
"metadata": {
|
||||
"description": "Maps to the publisher in the Azure Stack Platform Image Repository manifest file."
|
||||
}
|
||||
},
|
||||
|
||||
"osImageOffer": {
|
||||
"type": "string",
|
||||
"defaultValue": "WindowsServer",
|
||||
"metadata": {
|
||||
"description": "Maps to the Offer in the Azure Stack Platform Image Repository manifest file."
|
||||
}
|
||||
},
|
||||
|
||||
"osImageSku": {
|
||||
"type": "string",
|
||||
"defaultValue": "2016-Datacenter",
|
||||
"allowedValues": [
|
||||
"2012-R2-Datacenter",
|
||||
"2016-Datacenter-Server-Core",
|
||||
"2016-Datacenter"
|
||||
],
|
||||
"metadata": {
|
||||
"description": "Maps to the sku in the Azure Stack Platform Image Repository."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"variables": {
|
||||
"availabilitySetName": "[toLower(concat('aSet-', resourceGroup().name))]",
|
||||
"storageAccountType": "Standard_LRS",
|
||||
"vmSize": "[parameters('vmSize')]",
|
||||
"dnsPrefix": "[parameters('dnsPrefix')]",
|
||||
"osImageVersion": "latest",
|
||||
"dataDiskSize": "[parameters('dataDiskSize')]",
|
||||
"addressPrefix": "10.0.0.0/16",
|
||||
"virtualNetworkName": "[tolower(concat('vNet-',resourceGroup().name))]",
|
||||
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]",
|
||||
"NICPrefix": "vnic-",
|
||||
"subnetPrefix": "10.0.0.0/24",
|
||||
"subnetName": "vmstaticsubnet",
|
||||
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]",
|
||||
"storageName": "[concat('sa', uniquestring(resourceGroup().id))]",
|
||||
"publicLBName": "[tolower(concat('external-lb-', resourceGroup().name))]",
|
||||
"publiclbID": "[resourceId('Microsoft.Network/loadBalancers',variables('publicLBName'))]",
|
||||
"lbFE": "[tolower(concat('external-lb-fe-',resourceGroup().name))]",
|
||||
"publiclbFEConfigID": "[concat(variables('publiclbID'),'/frontendIPConfigurations/',variables('lbFE'))]",
|
||||
"publicIPAddressName": "[tolower(concat('public-ip',resourceGroup().name))]",
|
||||
"rdpPort": 22,
|
||||
"nsgName": "[tolower(concat('vmnsg',resourceGroup().name))]",
|
||||
"nsgID": "[resourceId('Microsoft.Network/networkSecurityGroups',variables('nsgName'))]",
|
||||
"vmContainerName": "vhds"
|
||||
},
|
||||
|
||||
"resources": [
|
||||
{
|
||||
"type": "Microsoft.Storage/storageAccounts",
|
||||
"name": "[variables('storageName')]",
|
||||
"apiVersion": "2015-06-15",
|
||||
"location": "[resourceGroup().location]",
|
||||
"properties": {
|
||||
"accountType": "[variables('storageAccountType')]"
|
||||
},
|
||||
|
||||
"dependsOn": [
|
||||
"[variables('publiclbName')]"
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"type": "Microsoft.Network/networkSecurityGroups",
|
||||
"name": "[variables('nsgName')]",
|
||||
"apiVersion": "2015-06-15",
|
||||
"location": "[resourceGroup().location]",
|
||||
"properties": {
|
||||
"securityRules": [
|
||||
{
|
||||
"name": "rule1",
|
||||
"properties": {
|
||||
"protocol": "*",
|
||||
"sourcePortRange": "*",
|
||||
"destinationPortRange": "*",
|
||||
"sourceAddressPrefix": "*",
|
||||
"destinationAddressPrefix": "*",
|
||||
"access": "Allow",
|
||||
"priority": 101,
|
||||
"direction": "Inbound"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"type": "Microsoft.Compute/availabilitySets",
|
||||
"name": "[variables('availabilitySetName')]",
|
||||
"apiVersion": "2017-03-30",
|
||||
"location": "[resourceGroup().location]",
|
||||
"properties": {
|
||||
"platformFaultDomainCount": "3",
|
||||
"platformUpdateDomainCount": "5"
|
||||
},
|
||||
"sku": {
|
||||
"name": "Aligned"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"type": "Microsoft.Network/publicIPAddresses",
|
||||
"name": "[variables('publicIPAddressName')]",
|
||||
"apiVersion": "2015-06-15",
|
||||
"location": "[resourceGroup().location]",
|
||||
"properties": {
|
||||
"publicIPAllocationMethod": "Dynamic",
|
||||
"dnsSettings": {
|
||||
"domainNameLabel": "[variables('dnsPrefix')]"
|
||||
}
|
||||
},
|
||||
|
||||
"dependsOn": [
|
||||
"[variables('vnetID')]"
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"type": "Microsoft.Network/virtualNetworks",
|
||||
"name": "[variables('virtualNetworkName')]",
|
||||
"apiVersion": "2015-06-15",
|
||||
"location": "[resourceGroup().location]",
|
||||
"properties": {
|
||||
"addressSpace": {
|
||||
"addressPrefixes": [
|
||||
"[variables('addressPrefix')]"
|
||||
]
|
||||
},
|
||||
|
||||
"subnets": [
|
||||
{
|
||||
"name": "[variables('subnetName')]",
|
||||
"properties": {
|
||||
"addressPrefix": "[variables('subnetPrefix')]",
|
||||
"networkSecurityGroup": {
|
||||
"id": "[variables('nsgID')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"dependsOn": [
|
||||
"[variables('nsgID')]"
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"apiVersion": "2015-06-15",
|
||||
"name": "[variables('publiclbName')]",
|
||||
"type": "Microsoft.Network/loadBalancers",
|
||||
"location": "[resourceGroup().location]",
|
||||
"dependsOn": [
|
||||
"[variables('vnetID')]",
|
||||
"[variables('publicIPAddressName')]"
|
||||
],
|
||||
|
||||
"properties": {
|
||||
"frontendIPConfigurations": [
|
||||
{
|
||||
"name": "[variables('lbFE')]",
|
||||
"properties": {
|
||||
"publicIPAddress": {
|
||||
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
"backendAddressPools": [
|
||||
{
|
||||
"name": "LoadBalancerBackend"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
"apiVersion": "2015-06-15",
|
||||
"type": "Microsoft.Network/loadBalancers/inboundNatRules",
|
||||
"name": "[concat(variables('publicLBName'), '/ssh-VM', copyIndex())]",
|
||||
"location": "[resourceGroup().location]",
|
||||
"copy": {
|
||||
"name": "lbNatLoop",
|
||||
"count": "[parameters('numberOfInstances')]"
|
||||
},
|
||||
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/loadBalancers/', variables('publiclbName'))]"
|
||||
],
|
||||
|
||||
"properties": {
|
||||
"frontendIPConfiguration": {
|
||||
"id": "[variables('publiclbFEConfigID')]"
|
||||
},
|
||||
|
||||
"protocol": "tcp",
|
||||
"frontendPort": "[copyIndex(2200)]",
|
||||
"backendPort": 22,
|
||||
"enableFloatingIP": false
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"type": "Microsoft.Network/networkInterfaces",
|
||||
"name": "[concat(variables('NICPrefix'), parameters('vmNamePrefix'), copyIndex())]",
|
||||
"apiVersion": "2015-06-15",
|
||||
"location": "[resourceGroup().location]",
|
||||
"copy": {
|
||||
"name": "nicLoop",
|
||||
"count": "[parameters('numberOfInstances')]"
|
||||
},
|
||||
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]",
|
||||
"[concat('Microsoft.Network/loadBalancers/', variables('publicLBName'))]",
|
||||
"[concat('Microsoft.Network/loadBalancers/', variables('publicLBName'), '/inboundNatRules/', 'ssh-VM', copyIndex())]"
|
||||
],
|
||||
|
||||
"properties": {
|
||||
"ipConfigurations": [
|
||||
{
|
||||
"name": "ipconfig1",
|
||||
"properties": {
|
||||
"privateIPAllocationMethod": "Dynamic",
|
||||
"subnet": {
|
||||
"id": "[variables('subnetRef')]"
|
||||
},
|
||||
|
||||
"loadBalancerBackendAddressPools": [
|
||||
{
|
||||
"id": "[concat(variables('publiclbID'), '/backendAddressPools/LoadBalancerBackend')]"
|
||||
}
|
||||
],
|
||||
|
||||
"loadBalancerInboundNatRules": [
|
||||
{
|
||||
"id": "[concat(variables('publiclbID'), '/inboundNatRules/ssh-VM', copyIndex())]"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"type": "Microsoft.Compute/virtualMachines",
|
||||
"name": "[concat(parameters('vmNamePrefix'), copyIndex())]",
|
||||
"apiVersion": "2017-03-30",
|
||||
"location": "[resourceGroup().location]",
|
||||
|
||||
"copy": {
|
||||
"name": "virtualMachineLoop",
|
||||
"count": "[parameters('numberOfInstances')]"
|
||||
},
|
||||
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Storage/storageAccounts/',variables('storageName'))]",
|
||||
"[resourceId('Microsoft.Network/networkInterfaces', concat(variables('NICPrefix'), parameters('vmNamePrefix'), copyIndex()))]",
|
||||
"[concat('Microsoft.Compute/availabilitySets/', variables('availabilitySetName'))]"
|
||||
],
|
||||
|
||||
"properties": {
|
||||
|
||||
"availabilitySet": {
|
||||
"id": "[resourceId('Microsoft.Compute/availabilitySets',variables('availabilitySetName'))]"
|
||||
},
|
||||
|
||||
"hardwareProfile": {
|
||||
"vmSize": "[variables('vmSize')]"
|
||||
},
|
||||
|
||||
"osProfile": {
|
||||
"computerName": "[concat(parameters('vmNamePrefix'), copyIndex())]",
|
||||
"adminUsername": "[parameters('adminUsername')]",
|
||||
"adminPassword": "[parameters('adminPassword')]"
|
||||
},
|
||||
|
||||
"storageProfile": {
|
||||
"imageReference": {
|
||||
"publisher": "[parameters('osImagePublisher')]",
|
||||
"offer": "[parameters('osImageOffer')]",
|
||||
"sku": "[parameters('osImageSKU')]",
|
||||
"version": "[variables('osImageVersion')]"
|
||||
},
|
||||
|
||||
"osDisk": {
|
||||
"createOption": "FromImage"
|
||||
},
|
||||
|
||||
"dataDisks": [
|
||||
{
|
||||
"createOption": "Empty",
|
||||
"diskSizeGB": "[variables('dataDiskSize')]",
|
||||
"lun": 0
|
||||
},
|
||||
{
|
||||
"createOption": "Empty",
|
||||
"diskSizeGB": "[variables('dataDiskSize')]",
|
||||
"lun": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"networkProfile": {
|
||||
"networkInterfaces": [
|
||||
{
|
||||
"id": "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('NICPrefix'), parameters('vmNamePrefix'), copyIndex()))]"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"diagnosticsProfile": {
|
||||
"bootDiagnostics": {
|
||||
"enabled": "true",
|
||||
"storageUri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageName')),providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).primaryEndpoints.blob)]"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
{
|
||||
|
||||
"$schema":"http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
|
||||
"contentVersion":"1.0.0.0",
|
||||
"parameters":{
|
||||
"existingVMSSName":{
|
||||
"type":"string",
|
||||
"metadata":{
|
||||
"description":"Name of existing VM Scale Set"
|
||||
}
|
||||
},
|
||||
|
||||
"newCapacity":{
|
||||
"type":"int",
|
||||
"metadata":{
|
||||
"description":"Number of desired VM instances"
|
||||
}
|
||||
},
|
||||
|
||||
"vmSku": {
|
||||
"type": "string",
|
||||
"defaultValue": "Standard_A1",
|
||||
"metadata": {
|
||||
"description": "Size of VMs in the VM Scale Set."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"resources":[
|
||||
{
|
||||
"type":"Microsoft.Compute/virtualMachineScaleSets",
|
||||
"apiVersion":"2017-03-30",
|
||||
"name":"[parameters('existingVMSSName')]",
|
||||
"location":"[resourceGroup().location]",
|
||||
"sku":{
|
||||
"name":"[parameters('vmSku')]",
|
||||
"tier":"Standard",
|
||||
"capacity":"[parameters('newCapacity')]"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
Загрузка…
Ссылка в новой задаче