Module 4
Managing Azure VMs
Module Overview
• Configuring Azure VMs
• Managing disks of Azure VMs
• Managing and monitoring Azure VMs
• Managing classic Azure VMs
Lesson 1: Configuring Azure VMs
• Demonstration: Preparing the lab environment for
the remainder of this module
• Connecting to an Azure VM
• Demonstration: Connecting to a Linux Azure VM
via SSH
• Scaling Azure VMs
• Configuring security of Azure VMs
Demonstration: Preparing the lab environment
for the remainder of this module
In this demonstration, you will learn how to
prepare the lab environment for the remainder of
this module
Note: To prepare the lab environment for this module, you
must complete this tasks
Connecting to an Azure VM
• Windows VMs:
• RDP:
• User-based authentication
• Generates .rdp file from the Azure portal or via Azure PowerShell
• WinRM:
• Generates a certificate and uploads it to Azure Key Vault
• References the URL of the certificate in the VM configuration
• Linux VMs:
• SSH:
• User based or certificate-based authentication
• Use an SSH client
• Remote Desktop:
• xfce4 – desktop environment
• xrdp – RDP server
• When using SSH key to authenticate, assign a password to the admin user
Demonstration: Connecting to a Linux Azure VM
via SSH
In this demonstration, you will see how to connect
to a Linux Azure VM via SSH
Scaling Azure VMs
• Scale sets provide VM autoscaling:
• With managed disks:
• Up to 1000 VMs when using VM Marketplace image
• Up to 100 VMs when using custom images
• With unmanaged disks:
• Up to 100 VMs when using VM Marketplace image
• Up to 40 VMs when using custom images (overprovision = $true)
• Up to 20 VMs when using custom images (overprovision = $false)
• 5 fault domains and 5 update domains
• Stateless workloads
• Implement by using:
• Microsoft.Compute resource provider
• Microsoft.Insights resource provider
Vertical scaling of Azure VMs
• Vertical scaling:
• Current configuration must comply with constraints of
the target VM size:
• Hardware characteristics
• Maximum number of network adapters or disks
• Requires temporary downtime:
• Restart if resizing within the same cluster
• Stop (deallocate) if resizing requires cluster change
• Horizontal scaling:
• Azure Resource Manager: VM Scale Sets
• Classic: preprovisioned VMs
Configuring security of Azure VMs
• Network security groups
• Restrict access to individual IP addresses
• Combine with OS-level protection
• Azure Key Vault
• Store secrets and keys
• Use Azure AD authentication to control access
• Azure Drive Encryption
• Encrypt OS and data volumes on Windows and Linux VMs
• Integrate with Azure Key Vault
• Encrypt by using existing keys
Configuring VM security
Keys/secrets are protected
in customer key vault
OS and data disks are
protected in customer Azure
storage account Resource
Manager/
Windows
Encrypt
PowerShell
config
cmdlets/
Azure CLI
VM Encrypt
Azure config
Storage
Customer
Lesson 2: Managing disks of Azure VMs
• Managing VM disks
• Azure VM disk mobility
• Managing disk volumes in Azure VMs
• Demonstration: Configuring Azure VM disks
Managing VM disks
• Attach an OS or data disk:
• Unmanaged disks:
• New (empty)
• Existing blob
• Managed disks:
• New (empty)
• Existing blob
• Snapshot
• Detach a data disk
• Modify disk settings:
• Host caching mode
• Disk size (up to 4 TBs)
• Storage account type (standard unmanaged disks only)
• Performance tier (managed disks only)
Azure VM disk mobility
• Azure virtual disk files:
• .vhd format (.vhdx not supported)
• Fixed type (dynamic not supported)
• 4-TB maximum size (use multi-disk volumes if larger size is needed)
• Azure virtual disk mobility:
• Upload and download:
• Add-AzureRmVHD and Save-AzureRmVHD
• az storage blob upload and az storage blob download
• Attach and detach:
• Add-AzureRmVmDataDisk and Remove-AzureRmVMDataDisk
• azure vm disk attach-new and azure vm disk detach
• Import/Export service (for larger disk sizes)
• AzCopy and Azure portal
• Azure virtual disk files copy and snapshot:
• Managed and unmanaged disks (full snapshots only)
Managing disk volumes in Azure VMs
• OS multi-disk management tools:
• Server Manager (Storage Spaces)
• Windows PowerShell (Storage Spaces)
• LVM (Linux)
• mdadm (Linux)
• Multidisk volumes considerations:
• Aggregate I/O throughput
• Support for volumes larger than 4-TB disk size limit
• Maximum number of data disks depends on VM size
Demonstration: Configuring Azure VM disks
In this demonstration, you will see how to attach
data disks to an Azure VM and create a multidisk
volume
Lesson 3: Managing and monitoring Azure VMs
• Overview of VM Agent and VM extensions
• What is the VM Agent Custom Script extension?
• What is the VM Agent DSC extension?
• Monitoring Azure VMs
• Demonstration: Configuring Azure Resource
Manager Azure VMs with DSC
Overview of VM Agent and VM extensions
• VM Agent:
• Recommended but optional for Azure VMs
• Mandatory for Linux
• VM Extensions:
• Azure VM Access Extension
• Chef Client and Puppet Enterprise Agent
• Custom Script extension for Windows and Linux
• DSC extension for Windows and Linux
• Azure Diagnostics extension for Windows and Linux
• Docker extension
• Microsoft Antimalware extension and many others
What is the VM Agent Custom Script extension?
• Custom Script VM Agent extension enables to
run:
• Windows PowerShell scripts
• Linux shell scripts
• Implement by:
• Azure portal
• Azure PowerShell
• Set-AzureRmVMCustomScriptExtension
• Set-AzureRMVMExtension
• Azure CLI
• az vm extension set
• Azure Resource Manager templates
What is the VM Agent DSC extension?
• Leverages Windows DSC and DSC for Linux:
• Windows Management Framework–based (Windows)
• Open Management Infrastructure–based (Linux)
• Implemented as VM Agent extensions:
• DSC extension for Windows Azure VMs
• Azure DSCForLinux extension for Linux Azure VMs
• Deployment support:
• Azure portal
• Windows PowerShell
• Azure CLI
• Azure Resource Manager templates
Monitoring Azure VMs
• Metrics:
• Available for VMs running Windows and Linux
• Displayed in the Azure portal
• Diagnostics:
• Implemented as a VM extension
• Stored in Azure Storage (tables and blobs)
• Windows – basic metrics, performance counters, logs, ETW, crash
dumps, Application Insights data, boot diagnostics
• Linux – basic metrics and boot diagnostics
• Alerts:
• Based on metric, condition, threshold, and time period
• Can trigger
• Email notification
• Webhook
• Azure Automation runbook
• Azure Logic App
Demonstration: Configuring Azure Resource
Manager Azure VMs with DSC
In this demonstration, you will see how to apply
DSC to an Azure VM running the Windows OS
Lesson 4: Managing classic Azure VMs
• Configuring classic Azure VMs
• Managing and configuring classic VM storage
• Monitoring and managing classic VMs
Configuring classic Azure VMs
PIP
Direct
Azure
communications
VMs
Endpoint Static IP
communications
Private IP
Cloud Service
Managing and configuring classic VM storage
• No support for managed disks
• Support for storing disks in:
• Classic storage accounts
• No support for a number of newer Azure Storage features (e.g.
Storage Service Encryption)
• Azure Resource Manager storage accounts
• Support for default storage account
• Disk provisioning via:
• Azure classic portal
• Azure portal
• Azure PowerShell
• Azure CLI 1.0
Monitoring and managing classic VMs
• Monitoring:
• Available for Windows and Linux classic VMs
• No support for boot diagnostics
• Management and OS configuration:
• Available for Windows and Linux classic VMs
• Support for DSC extension
• Support for Custom Script extension
Lab: Managing Azure VMs
• Exercise 1: Implementing DSC
• Exercise 2: Implementing Storage Spaces–based
volumes
Logon Information
Virtual machine: 20533D-MIA-CL1
User name: Student
Password: Pa55w.rd
Estimated Time: 60 minutes
Lab Scenario
Now that you have validated basic deployment
options of Azure VMs, you need to start testing
more advanced configuration scenarios. Your plan
is to step through a sample configuration a two-
tier A. Datum ResDev application. As part of your
tests, you will install IIS by using the VM DSC
extension on the front-end tier. You will also set
up a multi-disk volume by using Storage Spaces in
a Windows Azure VM in the back-end tier.
Lab Review
• Why would you use Storage Spaces in an Azure
VM considering that Azure already provides highly
available storage built into a storage account?
Module Review and Takeaways
• Review Question