Docsity

Managing Virtual Machines on Azure: Creating, Configuring, and Scaling, Assignments of Computer Networks

Toggle sidebar
bg1
Lab 08 - Manage Virtual Machines
Task 1: Triển khai các máy ảo Azure có khả năng phục hồi vùng bằng cách
sử dụng cổng Azure và mẫu Trình quản lý tài nguyên Azure
1. Trên Azure portal, tìm và chọn ,Virtual machines, sau đó chọn add
2. Trên cửa sổ ,Create a virtual machine,điền thông tin như sau:
Setting Value
Subscription the name of the Azure subscription you will be using in this lab
Resource group the name of a new resource groupaz104-08-rg01
Virtual machine name az104-08-vm0
Region select one of the regions that support availability zones and where you can
provision Azure virtual machines
Availability options Availability zone
Availability zone 1
Image Windows Server 2019 Datacenter - Gen1
Azure Spot instance No
Size Standard D2s v3
Username Student
Password Pa55w.rd1234
Public inbound ports None
Would you like to use an existing Windows
Server license?
No
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Managing Virtual Machines on Azure: Creating, Configuring, and Scaling and more Assignments Computer Networks in PDF only on Docsity!

Lab 08 - Manage Virtual Machines

Task 1: Triển khai các máy ảo Azure có khả năng phục hồi vùng bằng cách sử dụng cổng Azure và mẫu Trình quản lý tài nguyên Azure

1. Trên Azure portal, tìm và chọn Virtual machines , sau đó chọn add

  1. Trên cửa sổ Create a virtual machine điền thông tin như sau: Setting Value Subscription the name of the Azure subscription you will be using in this lab Resource group the name of a new resource group az104-08-rg Virtual machine name az104-08-vm Region select one of the regions that support availability zones and where you can provision Azure virtual machines Availability options Availability zone Availability zone 1 Image Windows Server 2019 Datacenter - Gen Azure Spot instance No Size Standard D2s v Username Student Password Pa55w.rd Public inbound ports None Would you like to use an existing Windows Server license? No
  1. Chọn Next: Disks > , trên tab Disks chọn Create a virtual machine : Setting Value OS disk type Standard HDD Enable Ultra Disk compatibility No
  2. Chọn Next: Networking > chọn Create new dưới ô Virtual network.
  3. Điền thông tin như sau: Setting Value Name az104-08-rg01-vnet Address range 10.80.0.0/ Subnet name subnet Subnet range 10.80.0.0/
  4. Chọn OK và tiếp tục chọn Create a virtual machine điền thông tin như sau: Setting Value Public IP None NIC network security group None Accelerated networking Off Place this virtual machine behind an existing load balancing solution? No
  5. Chọn Next: ManagementCreate a virtual machine điền thông tin như sau:

Setting Value Name scripts Public access level Private (no anonymous access )

  1. Chọn scripts.
  2. Chọn Upload.
  3. Chọn file az104-08-install_IIS.ps1Upload.
  4. Tiếp tục tìm mục Virtual machines sau đó chọn az104-08-vm.
  5. Trong mục máy ảo az104-08-vm0SettingsExtensions+ Add.
  6. Trên mục New resource chọn Custom Script ExtensionCreate.
  7. Trên hộp thoại Install extension chọn Browse.
  8. Trên cửa sổ Storage accounts , chọn vị tri của Containersscripts , on chọn file az104-08-install_IIS.ps1Select.
  9. Quay lại cửa sổ Install extension chọn OK.
  10. Chọn lại máy ảo az104-08-vm.
  11. Trong mục Automation chọn Export template.
  12. Trong mục az104-08-vm1 - Export template chọn Deploy.
  13. Trên Custom deployment chọn Edit template.
  14. Trên cửa sổ Edit template tìm đến dòng 20 (điền giá trị bên dưới vào sau chỗ “resources”: [` ): { "type": "Microsoft.Compute/virtualMachines/extensions", "name": "az104-08-vm1/customScriptExtension", "apiVersion": "2018-06-01", "location": "[resourceGroup().location]", "dependsOn": [ "az104-08-vm1" ], "properties": { "publisher": "Microsoft.Compute", "type": "CustomScriptExtension", "typeHandlerVersion": "1.7", "autoUpgradeMinorVersion": true, "settings": { "commandToExecute": "powershell.exe Install- WindowsFeature -name Web-Server -IncludeManagementTools && powershell.exe remove-item 'C:\inetpub\wwwroot\iisstart.htm' && powershell.exe Add- Content -Path 'C:\inetpub\wwwroot\iisstart.htm' -Value $('Hello World from ' + $env:computername)" } } },
  1. Chọn Save và quay lại Custom template chọn I agree to the terms and conditions stated above and  Purchase.
  2. Quay lại máy ảo az104-08-vm1 trong mục Operations chọn Run command , và  RunPowerShellScript.
  3. Trên cửa sổ Command Script blade, điền lệnh sau để kiểm tra kết nối tới az104-08-vm0 : Invoke-WebRequest -URI http://10.80.0.4 -UseBasicParsing Task 3: Quy mô tính toán và lưu trữ cho máy ảo Azure
  4. Tìm đến máy ảo az104-08-vm.
  5. Trên máy ảo az104-08-vm0 Chọn Size Và Resize sang Standard DS1_v
  6. Chọn mục Disks dưới mục Data disks chọn + Create and attach a new disk.
  7. Điền thông tin như bên dưới: Setting Value Disk name az104-08-vm0-datadisk- Source type None Account type Premium SSD Size 1024 GiB
  8. Quay lại cửa sổ az104-08-vm0 - Disks làm tiếp các bước như trên:
  9. Điền thông tin: Setting Value Disk name az104-08-vm0-datadisk- Source type None

"caching": "ReadOnly", "createOption": "Empty" } ]

  1. Chọn Save và quay lại Custom templateI agree to the terms and conditions stated abovePurchase.
  2. Quay lại mục máy ảo az104-08-vm1RunPowerShellScript.
  3. Điền nội dung như bên dưới: New-StoragePool -FriendlyName storagepool1 - StorageSubsystemFriendlyName "Windows Storage*" -PhysicalDisks (Get- PhysicalDisk -CanPool $true) New-VirtualDisk -StoragePoolFriendlyName storagepool1 -FriendlyName virtualdisk1 -Size 2046GB -ResiliencySettingName Simple - ProvisioningType Fixed Initialize-Disk -VirtualDisk (Get-VirtualDisk -FriendlyName virtualdisk1) New-Partition -DiskNumber 4 -UseMaximumSize -DriveLetter Z Task 4: Đăng kí the Microsoft.Insights và Microsoft.AlertsManagement resource providers
  4. Chọn Azure Cloud Shell.
  5. Điền dòng lệnh như sau: Register-AzResourceProvider -ProviderNamespace Microsoft.Insights Register-AzResourceProvider -ProviderNamespace Microsoft.AlertsManagement Task 5: Triển khai bộ quy mô máy ảo Azure có khả năng phục hồi vùng bằng cách sử dụng cổng Azure
  6. Tìm Virtual machine scale sets và chọn + Add.
  7. Trên tab Basics điền thông tin như bên dưới và chọn Next : Disks > :

Setting Value Subscription the name of the Azure subscription you are using in this lab Resource group the name of a new resource group az104-08-rg Virtual machine scale set name az10408vmss Region select one of the regions that support availability zones and where you can pr different from the one you used to deploy virtual machines earlier in this lab Availability zone Zones 1, 2, 3 Image Windows Server 2016 Datacenter Azure Spot instance No Size Standard D2s_v Username Student Password Pa55w.rd Already have a Windows Server license? No

  1. Chọn các thông tin mặc định và chọn Next : Networking >.
  2. Trên tab Networking chọn Create virtual network ở dưới Virtual network và tại virtual network với các thông tin sau:

Setting Value Protocol TCP Action Allow Priority 1010 Name custom-allow-http

  1. Chọn Add sau đó quay lại Create network security group chọn OK.
  2. Quay lại mục Edit network interface , Trong mục Public IP address , chọn EnabledOK.
  3. Quay lại tab Networking điền thông tin như dưới và chọ Next : Scaling > : Setting Value Use a load balancer Yes Load balancing options Azure load balancer Select a load balancer (new) az10408vmss0-lb Select a backend pool (new) bepool
  4. Trong tab Scaling điền thông tin như bên dưới và chọn tiếp Next : Management > :

Setting Value Initial instance count 2 Scaling policy Manual

  1. Trên tab Management của mục Create a virtual machine scale set đang đứng , kiểm tra xem chức năng Boot diagnostics đã được enabled, chọn Create new , trong Create storage account , trong mục text box Name , nhập tên storage account hợp lệ , chọn OK , sau đó chọn Next : Health > :
  2. Trên tab Health , kiểm tra lại các thông tin đã thay đổi và chọn Next : Advanced >.
  3. Trên tab Advanced điền thông tin như bên dưới và chọn Review + create. Setting Value Spreading algorithm Fixed spreading (not recommended with zones)
  4. Trên tab Review + create , đảm bảo rằng quá trình xác thực đã được thông qua và nhấp vào Create. Task 6: Cấu hình Azure virtual machine scale sets bằng virtual machine extensions (mở rộng máy ảo)
  5. Tìm và chọn Storage accounts , tìm đên tk mình đã có.
  6. On the storage account blade, click Containers and then click + Container.
  7. On the New container blade, specify the following settings (leave others with their default values) and click Create :
  1. Trên mục Settings  chọn Instances , chọn Upgrade  yes
  2. Trong list of instances, click the entry representing the first instance and, on the scale set instance blade, Chú ý mục Location (Phải trong location mình đã chọn trc đó).
  3. Quay lại cửa sổ az10408vmss0 - Instances , nhấp vào chọn entry representing the second instance and, on the scale set instance blade, lưu ý mục Location (it should be one of the other two zones in the target Azure region into which you deployed the Azure virtual machine scale set).
  4. Quay lai cửa sổ az10408vmss0 - Instances và chọn Scaling.
  5. Trên cửa sổ az10408vmss0 - Scaling , chọn mục Custom autoscale và cấu hình autoscale Theo cấu hình bên dưới : Setting Value Scale mode Scale based on a metric
  6. Chọn mục + Add a rule và trên cửa sổ Scale rule điền thông tin như sau: Setting Value Metric source Current resource (az10480vmss Time aggregation Average Metric namespace Virtual Machine Host Metric name Network In Total Operator Greater than Metric threshold to trigger scale action 10

Setting Value Duration (in minutes) 1 Time grain statistic Average Operation Increase count by Instance count 1 Cool down (minutes) 5

  1. Chọn Add và quay lại cửa sổ az10408vmss0 - Scaling điền giá trị như bên dưới: Setting Value Instance limits Minimum 1 Instance limits Maximum 3 Instance limits Default 1
  2. Click Save.
  3. Tìm đến Azure Cloud Shell
  4. Chạy lệnh sau để xác định địa chỉ ip của bộ cân bằng tải trên az10408vmss. $rgName = 'az104-08-rg02' $lbpipName = 'az10408vmss0-ip' $pip = (Get-AzPublicIpAddress -ResourceGroupName $rgName -Name $lbpipName).IpAddress

Set-Location -Path $HOME Get-Content -Path ./az104-08-configure_VMSS_disks.ps 23.hãy chạy phần sau để trích xuất tập lệnh và định cấu hình các đĩa : ./az104-08-configure_VMSS_disks.ps

  1. Trên mục Settings của az10408vmss0 chọn Instances , chọn checkbox  UpgradeYes.