嘟嘟社区

Azure B1s如何使用脚本快速部署呢?


默认的2008r2 被隐藏了,开不了。这个模板可用,但是怎么用呢?有没有大神有教程?
  1. {
  2.     "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  3.     "contentVersion": "1.0.0.0",
  4.     "parameters": {
  5.         "location": {
  6.             "type": "string"
  7.         },
  8.         "networkInterfaceName": {
  9.             "type": "string"
  10.         },
  11.         "networkSecurityGroupName": {
  12.             "type": "string"
  13.         },
  14.         "networkSecurityGroupRules": {
  15.             "type": "array"
  16.         },
  17.         "subnetName": {
  18.             "type": "string"
  19.         },
  20.         "virtualNetworkName": {
  21.             "type": "string"
  22.         },
  23.         "addressPrefixes": {
  24.             "type": "array"
  25.         },
  26.         "subnets": {
  27.             "type": "array"
  28.         },
  29.         "publicIpAddressName": {
  30.             "type": "string"
  31.         },
  32.         "publicIpAddressType": {
  33.             "type": "string"
  34.         },
  35.         "publicIpAddressSku": {
  36.             "type": "string"
  37.         },
  38.         "virtualMachineName": {
  39.             "type": "string"
  40.         },
  41.         "virtualMachineRG": {
  42.             "type": "string"
  43.         },
  44.         "osDiskType": {
  45.             "type": "string"
  46.         },
  47.         "virtualMachineSize": {
  48.             "type": "string"
  49.         },
  50.         "adminUsername": {
  51.             "type": "string"
  52.         },
  53.         "adminPassword": {
  54.             "type": "secureString"
  55.         }
  56.     },
  57.     "variables": {
  58.         "nsgId": "[resourceId(resourceGroup().name, ‘Microsoft.Network/networkSecurityGroups’, parameters(‘networkSecurityGroupName’))]",
  59.         "vnetId": "[resourceId(resourceGroup().name,’Microsoft.Network/virtualNetworks’, parameters(‘virtualNetworkName’))]",
  60.         "subnetRef": "[concat(variables(‘vnetId’), ‘/subnets/’, parameters(‘subnetName’))]"
  61.     },
  62.     "resources": [
  63.         {
  64.             "name": "[parameters(‘networkInterfaceName’)]",
  65.             "type": "Microsoft.Network/networkInterfaces",
  66.             "apiVersion": "2019-07-01",
  67.             "location": "[parameters(‘location’)]",
  68.             "dependsOn": [
  69.                 "[concat(‘Microsoft.Network/networkSecurityGroups/’, parameters(‘networkSecurityGroupName’))]",
  70.                 "[concat(‘Microsoft.Network/virtualNetworks/’, parameters(‘virtualNetworkName’))]",
  71.                 "[concat(‘Microsoft.Network/publicIpAddresses/’, parameters(‘publicIpAddressName’))]"
  72.             ],
  73.             "properties": {
  74.                 "ipConfigurations": [
  75.                     {
  76.                         "name": "ipconfig1",
  77.                         "properties": {
  78.                             "subnet": {
  79.                                 "id": "[variables(‘subnetRef’)]"
  80.                             },
  81.                             "privateIPAllocationMethod": "Dynamic",
  82.                             "publicIpAddress": {
  83.                                 "id": "[resourceId(resourceGroup().name, ‘Microsoft.Network/publicIpAddresses’, parameters(‘publicIpAddressName’))]"
  84.                             }
  85.                         }
  86.                     }
  87.                 ],
  88.                 "networkSecurityGroup": {
  89.                     "id": "[variables(‘nsgId’)]"
  90.                 }
  91.             }
  92.         },
  93.         {
  94.             "name": "[parameters(‘networkSecurityGroupName’)]",
  95.             "type": "Microsoft.Network/networkSecurityGroups",
  96.             "apiVersion": "2019-02-01",
  97.             "location": "[parameters(‘location’)]",
  98.             "properties": {
  99.                 "securityRules": "[parameters(‘networkSecurityGroupRules’)]"
  100.             }
  101.         },
  102.         {
  103.             "name": "[parameters(‘virtualNetworkName’)]",
  104.             "type": "Microsoft.Network/virtualNetworks",
  105.             "apiVersion": "2019-09-01",
  106.             "location": "[parameters(‘location’)]",
  107.             "properties": {
  108.                 "addressSpace": {
  109.                     "addressPrefixes": "[parameters(‘addressPrefixes’)]"
  110.                 },
  111.                 "subnets": "[parameters(‘subnets’)]"
  112.             }
  113.         },
  114.         {
  115.             "name": "[parameters(‘publicIpAddressName’)]",
  116.             "type": "Microsoft.Network/publicIpAddresses",
  117.             "apiVersion": "2019-02-01",
  118.             "location": "[parameters(‘location’)]",
  119.             "properties": {
  120.                 "publicIpAllocationMethod": "[parameters(‘publicIpAddressType’)]"
  121.             },
  122.             "sku": {
  123.                 "name": "[parameters(‘publicIpAddressSku’)]"
  124.             }
  125.         },
  126.         {
  127.             "name": "[parameters(‘virtualMachineName’)]",
  128.             "type": "Microsoft.Compute/virtualMachines",
  129.             "apiVersion": "2019-07-01",
  130.             "location": "[parameters(‘location’)]",
  131.             "dependsOn": [
  132.                 "[concat(‘Microsoft.Network/networkInterfaces/’, parameters(‘networkInterfaceName’))]"
  133.             ],
  134.             "properties": {
  135.                 "hardwareProfile": {
  136.                     "vmSize": "[parameters(‘virtualMachineSize’)]"
  137.                 },
  138.                 "storageProfile": {
  139.                     "osDisk": {
  140.                         "createOption": "fromImage",
  141.                         "managedDisk": {
  142.                             "storageAccountType": "[parameters(‘osDiskType’)]"
  143.                         },
  144.                         "diskSizeGB": 64
  145.                     },
  146.                     "imageReference": {
  147.                         "publisher": "microsoftwindowsserver",
  148.                         "offer": "windowsserver",
  149.                         "sku": "2008-R2-SP1-smalldisk",
  150.                         "version": "latest"
  151.                     }
  152.                 },
  153.                 "networkProfile": {
  154.                     "networkInterfaces": [
  155.                         {
  156.                             "id": "[resourceId(‘Microsoft.Network/networkInterfaces’, parameters(‘networkInterfaceName’))]"
  157.                         }
  158.                     ]
  159.                 },
  160.                 "osProfile": {
  161.                     "computerName": "[parameters(‘virtualMachineName’)]",
  162.                     "adminUsername": "[parameters(‘adminUsername’)]",
  163.                     "adminPassword": "[parameters(‘adminPassword’)]",
  164.                     "windowsConfiguration": {
  165.                         "enableAutomaticUpdates": true,
  166.                         "provisionVmAgent": true
  167.                     }
  168.                 }
  169.             }
  170.         }
  171.     ],
  172.     "outputs": {
  173.         "adminUsername": {
  174.             "type": "string",
  175.             "value": "[parameters(‘adminUsername’)]"
  176.         }
  177.     }
  178. }

复制代码