Step 1 : Create VM
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 |
Already have a Windows Server license | No |
Setting | Value |
---|---|
OS disk type | Standard HDD |
Enable Ultra Disk compatibility | No |
Setting | Value |
---|---|
Name | az104-08-rg01-vnet |
Address range | 10.80.0.0/20 |
Subnet name | subnet0 |
Subnet range | 10.80.0.0/24 |
Setting | Value |
---|---|
Public IP | None |
NIC network security group | None |
Accelerated networking | Off |
Place this virtual machine behind an existing load balancing solution? | No |
Setting | Value |
---|---|
Boot diagnostics | Enable with custom storage account |
Diagnostics storage account | Create new |
Create storage account | Enter a globally unique name all in lower case > Click OK |
Step 2 : On the deployment blade, click Template. Review the template representing the deployment in progress and click Deploy. On the Custom deployment blade, specify the following settings
Setting | Value |
---|---|
Resource group | az104-08-rg01 |
Network Interface Name | az104-08-vm1-nic1 |
Virtual Machine Name | az104-08-vm1 |
Virtual Machine Computer Name | az104-08-vm1 |
Admin Username | Student |
Admin Password | Pa55w.rd1234 |
Zone | 2 |
Step 3: Configure Azure virtual machines by using virtual machine extensions
We will install Windows Server Web Server role on the two Azure virtual machines you deployed in the previous task by using the Custom Script virtual machine extension.
In the Azure portal, search for and select Storage accounts and, on the Storage accounts blade, click the entry representing the diagnostics storage account you created in the previous task.
On the storage account blade, click Containers and then click + Container.
Setting | Value |
---|---|
Name | scripts |
Public access level | Private (no anonymous access) |
Upload file from https://github.com/MicrosoftLearning/AZ-104-MicrosoftAzureAdministrator/tree/master/Allfiles/Labs/08/az104-08-install_IIS.ps1
In the Azure portal, search for and select Virtual machines and, on the Virtual machines blade, click az104-08-vm0. On the az104-08-vm0 virtual machine blade, in the Settings section, click Extensions, and the click + Add. On the New resource blade, click Custom Script Extension and then click Create.
On the Storage accounts blade, click the name of the storage account into which you uploaded the az104-08-install_IIS.ps1 script, on the Containers blade, click scripts, on the scripts blade, click az104-08-install_IIS.ps1, and then click Select.
On the az104-08-vm1 blade, in the Settings section, click Export template. On the az104-08-vm1 - Export template blade, click Deploy. On the Custom deployment blade, click Edit template. On the Edit template blade, in the section displaying the content of the template, insert the following code
{ "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)" } } },
On the Run Command Script blade, type the following and click Run to access the web site hosted on az104-08-vm0:
You can also connect to az104-08-vm0 and run
Invoke-WebRequest -URI http://10.80.0.5
to access the web site hosted on az104-08-vm1.Step 3 : Scale compute and storage for Azure virtual machines
We will scale compute for Azure virtual machines by changing their size and scale their storage by attaching and configuring their data disks.
On the az104-08-vm0 virtual machine blade, click Size and set the virtual machine size to Standard DS1_v2 and click Resize
On the az104-08-vm0 virtual machine blade, click Disks, Under Data disks click + Create and attach a new disk.
Setting | Value |
---|---|
Disk name | az104-08-vm0-datadisk-0 |
Source type | None |
Account type | Premium SSD |
Size | 1024 GiB |
Setting | Value |
---|---|
Disk name | az104-08-vm0-datadisk-1 |
Source type | None |
Account type | Premium SSD |
Size | 1024 GiB |
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
Also it can be resized in the following process
On the az104-08-vm1 - Export template blade, click Deploy. On the Custom deployment blade, click Edit template. On the Edit template blade, in the section displaying the content of the template, replace the line 30
"vmSize": "Standard_D2s_v3"
with the following line):"vmSize": "Standard_DS1_v2"
On the Edit template blade, in the section displaying the content of the template, replace line 49 (
"dataDisks": [ ]
line) with the following code :"dataDisks": [ { "lun": 0, "name": "az104-08-vm1-datadisk0", "diskSizeGB": "1024", "caching": "ReadOnly", "createOption": "Empty" }, { "lun": 1, "name": "az104-08-vm1-datadisk1", "diskSizeGB": "1024", "caching": "ReadOnly", "createOption": "Empty" } ]
Also we can deploy zone-resilient Azure virtual machine scale sets by using the Azure portal
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-rg02 |
Virtual machine scale set name | az10408vmss0 |
Region | select one of the regions that support availability zones and where you can provision Azure virtual machines 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_v3 |
Username | Student |
Password | Pa55w.rd1234 |
Already have a Windows Server license? | No |
Scale compute and storage for Azure virtual machine scale sets
On the az10408vmss0 - Scaling blade, select the Custom autoscale option and configure autoscale with the following settings (leave others with their default values):
Setting | Value |
---|---|
Scale mode | Scale based on a metric |
Click the + Add a rule link and, on the Scale rule blade, specify the following settings (leave others with their default values):
Setting | Value |
---|---|
Metric source | Current resource (az10480vmss0) |
Time aggregation | Average |
Metric namespace | Virtual Machine Host |
Metric name | Network In Total |
Operator | Greater than |
Metric threshold to trigger scale action | 10 |
Duration (in minutes) | 1 |
Time grain statistic | Average |
Operation | Increase count by |
Instance count | 1 |
Cool down (minutes) | 5 |
Command for clean up : Get-AzResourceGroup -Name 'az104-08*' | Remove-AzResourceGroup -Force -AsJobSetting Value Instance limits Minimum 1 Instance limits Maximum 3 Instance limits Default 1
No comments:
Post a Comment