Review, Day 1
• Overview of key Cloud architecture concepts
• Implementing and Managing Storage
• Managing Azure Subscriptions and Resources (Was all about logging)
Day 2
• Deploying and Managing Virtual Machines (VMs)
• Configuring and Managing Virtual Networks
• Implementing Advanced Virtual Networking
Additional Materials
• I:\
• http://ddls.to/az300
General Feedback
• Comments, questions, suggestions, insults etc?
• Does the Hands-on kind of approach work for you?
• Anything you’d like to change?
• Running list of questions.
AZ-300t01
Module 3:
Deploying and
Managing Virtual
Machines (VMs)
Module content
• Creating Virtual Machines in the Azure Portal
• Creating Virtual Machines (PowerShell)
• Creating Virtual Machines using ARM Templates
• Deploying Custom Images
• Deploying Linux Virtual Machines
• Backup and Restore
Creating Virtual Machines (Portal)
High level steps:
1. Select a Marketplace image.
2. Provide required information, including:
VM name
Administrative credentials
Virtual network and subnet
Storage type
3. Provide optional information, including:
Availability settings
VM extensions
4. Provision the machine.
Practice: Create a Windows Virtual Machine
chapter 83 at position 0
• Create a virtual machine
• Connect to a virtual machine
• Install a Web Server
• Test the IIS welcome page.
• Access the page over the public web.
Do this one? Use the VM we created earlier and add IIS.
(#mw) Demo-Add IIS to VM
Virtual Machine Example (Part 1)
A sample provisioning (steps 1-3):
1. Set the credentials of the administrator account:
$cred = Get-Credential
2. Create the initial configuration for the virtual machine:
$vm = New-AzureRmVMConfig -VMName myVM -VMSize Standard_D1
3. Add the operating system information to the virtual machine configuration:
$vm = Set-AzureRmVMOperatingSystem `
-VM $vm `
-Windows `
-ComputerName myVM `
-Credential $cred `
-ProvisionVMAgent -EnableAutoUpdate
Virtual Machine Example (Part 2)
A sample provisioning (steps 4-7):
4. Add the image information to the virtual machine configuration:
$vm = Set-AzureRmVMSourceImage -VM $vm -PublisherName MicrosoftWindowsServer `
-Offer WindowsServer -Skus 2016-Datacenter -Version latest
5. Add the operating system disk settings to the virtual machine configuration:
$vm = Set-AzureRmVMOSDisk -VM $vm -Name myOsDisk -DiskSizeInGB 128 `
-CreateOption FromImage -Caching ReadWrite
6. Add the network interface card to the virtual machine configuration:
$vm = Add-AzureRmVMNetworkInterface `
-VM $vm -Id $nic.Id
7. Create the virtual machine:
New-AzureRmVM `
-Location EastUS `
-VM $vm `
-ResourceGroupName myResourceGroupVM
Moving Virtual Machines Between Resource Groups
Supported by using the Azure Portal, PowerShell, CLI, and REST API
Azure PowerShell-based example:
1. Identify ResourceId of all of the dependent resources:
Get-AzureRMResource -ResourceGroupName <sourceResourceGroupName> | Format-table -Property ResourceId
2. Create a comma separated list of the ResourceIds and use the list as input of the Move-AzureRMResource
cmdlet:
Move-AzureRmResource -DestinationResourceGroupName "<myDestinationResourceGroup>" `
-ResourceId <myResourceId,myResourceId,myResourceId>
3. For cross-subscriptions moves, include the -DestinationSubscriptionId parameter.
Move-AzureRmResource -DestinationSubscriptionId "<myDestinationSubscriptionID>" `
-DestinationResourceGroupName "<myDestinationResourceGroup>" `
-ResourceId <myResourceId,myResourceId,myResourceId>
Resource Manager Templates
JSON-formatted documents that follow ARM-specific syntax:
ARM Process
1. Obtain a template:
Consider leveraging QuickStart Templates github pretty page
2. Provide the template parameters:
Interactively
Via a parameters file.
3. Deploy the template by using:
The Azure portal
Azure PowerShell
Azure CLI
Virtual Machines (Custom Images)
Images are VHD files containing a generalized operating system:
Can be used to provision Azure VMs
Can be created by using on-premises VMs:
On-premises:
Provision a Hyper-V Generation 1 VM using disks in the VHD format
Generalize the VM operating system (for Windows OS, run sysprep)
In Azure:
Create an Azure Storage account and a container
Upload the VM VHD files to the container (e.g. by using the Add-AzureRmVhd cmdlet)
Linux Virtual Machines
Azure supports many Linux distributions including:
CentOS by OpenLogic
Core OS
Debian
Oracle Linux
Red Hat Enterprise Linux
Ubuntu.
Azure Marketplace hosts hundreds of community-built images
Created with Bitnami
Certified for Azure
Linux VMs support the same deployment options as Windows VMs
Linux VMs support open-source DevOps tools, e.g. Puppet and Chef
(#mw) Demo-DeployAndConnectLinux
Connecting to Linux VMs
Linux supports two methods of authentication:
Username and SSH-RSA 2048-bit key pair:
Can be generated by using ssh-keygen (Linux) or PuTTYGen (Windows)
Private key should be stored securely on the source computer
Public key resides on the target VM
Username and password
Overview: Virtual Machine Backups
Protection of Azure VMs is available by using:
Azure Backup:
• Supports application-consistent backups of Windows and Linux VMs
• Creates recovery points stored in geo-redundant recovery vaults
• Allows for restoring the whole VM or just specific files
Azure Site Recovery:
• Protects VMs from outages affecting entire region
• Allows recovery with a single click in matter of minutes
• Replicates to an Azure region of your choice
Managed Snapshots:
• Read-only full copies of managed disks
• Exist independently of the source disk
• Can be used to create new managed disks for rebuilding a VM
• Accrue charges based on the used portion of the disk
Backup Virtual Machines
Follows a three-step process:
1. Create a Recovery Services vault with either geo-redundant (default) or locally redundant storage.
2. Define the backup policy by specifying frequency of recovery points and their retention period.
3. Initiate backup of Azure VM (which utilizes the backup VM agent)
Backup VM Agent:
Present by default on Marketplace VM images (via a VM extension)
Needs to be included in custom VM images
Restore Virtual Machine
You can trigger the restore operation from the Azure portal:
Azure Backup creates a restore job
The portal displays restore progress
Monitoring
The Azure VM Overview blade in the Azure
portal shows:
• CPU
• Network
• Disk bytes
• Disk operations
The Azure VM Monitoring section in the Azure portal shows:
• Metrics
• Diagnostic settings
• Advisor recommendations
(#mw)
For some of the options on this page you’ll need to
have a log analytics workspace and it says that it can
take 20-30 minutes to have the options enabled.
Diagnostic Settings
On Windows VMs, diagnostics settings include:
• Performance counters
• Logs
• Crash dumps
• Agent
• Sinks (deliver diagnostics to other services, such as Application Insights)
On Linux VMs, diagnostics settings include:
• Metrics
• Syslog
• Agent
Advisor Recommendations
Personalized cloud service for optimizing Azure deployments:
Analyzes resource configuration and usage telemetry
Offers recommendations grouped in four categories:
• High availability: To ensure and improve the continuity of your business-critical applications.
• Security: To detect threats and vulnerabilities that might lead to security breaches.
• Performance: To improve the speed of your applications.
• Cost: To optimize and reduce your overall Azure spending.
Azure Advisor
Module content
• Creating Virtual Machines in the Azure Portal
• Creating Virtual Machines (PowerShell)
• Creating Virtual Machines using ARM Templates
• Deploying Custom Images
• Deploying Linux Virtual Machines
• Backup and Restore
**IMPORTANT.** When using Cloudshell
* Run commands as single lines
* In cloudshell click the upload button and then ManageFileShare.
* Upload your files here.
* From the CloudShell Command prompt
* cd \
* cd home
* dir (with this you can see a subdirectory matching your-account-name)
* cd your-account-name
* run script commands from here
Online Lab:
(AZ300T01-Module3: Implementing Custom Azure VM Images)
After completing this lab, you will be able to:
• Install and configure HashiCorp Packer
• Create a custom VM image
• Deploy an Azure VM based on a custom image