Automating the Cloud with PowerShell and Windows Azure

Wow! There was a ton of interest yesterday at the CincyPowerShell User Group on automating the provisioning and management of Virtual Machines in the cloud using PowerShell and the new Windows Azure PowerShell Module!  In this article, I’ve provided a copy of my presentation deck, session notes and a link for downloading the PowerShell snippets I demonstrated.

Hope you enjoy!

Automating the Cloud with PowerShell and Windows Azure

Download this deck for offline viewing.

Session Notes

Follow-along with the examples in my deck and session notes by activating a FREE, no-obligation 90-Day Trial Subscription for Windows Azure Virtual Machines and Virtual Networks.  Your free trial subscription includes 750 monthly compute hours, 35GB of replicated storage and MORE for evaluating virtual machines in the cloud ( the free trial represents a $300 USD value for FREE! ).

Intro to Windows Azure Virtual Machines and Virtual Networks [ Slide 4 ]

  • Windows Azure Virtual Machines and Virtual Networks are part of the Windows Azure Infrastructure as a Service (IaaS) Offering
     
  • Windows Azure Virtual Machines provides the ability to host Windows Server and Linux Virtual Machines on the Windows Azure cloud platform.
     
  • Windows Azure Virtual Networks provides the ability to provision customized virtual networks on the Windows Azure cloud platform
    • Scenario #1: Connecting multiple Azure VMs together on a common network in the cloud
    • Scenario #2: Securely connecting a collection of Azure VMs in the cloud to your on-premise data center via a secure site-to-site IPsec VPN tunnel.
       
  • VMs and Virtual Networks can be dynamically provisioned, imaged, de-provisioned and re-provisioned using the Windows Azure PowerShell Module.
     
  • Today, VMs and Virtual Networks are pre-release preview features on the Windows Azure cloud, but several scenarios still exist for leveraging these features, even in a pre-release state:
    • Build demo/study lab environments in the Windows Azure cloud
    • Evaluate new software prior to formal projects
    • Proof-of-Concept (PoC) environment for functional testing of new solutions prior to pilot/production rollouts.

What does Windows Azure Provide for IT Pros? [ Slide 5 ]

  • IT Pro Experience – Web-based Windows Azure Management Portal and PowerShell Cmdlets - for provisioning and management Virtual Machines and Virtual Networks.
     
  • Support for key server applications – Windows and Linux server workloads – using standard VHD format for easy migration of existing on-premise VMs. 
     
  • Easy storage manageability – via the globally scaled Windows Azure Blob Storage Service
     
  • High availability features – checkbox options for storage replication and highly available VM placement
     
  • Advanced networking – secure virtual networks in the cloud and site-to-site for public, private and hybrid cloud scenarios
     
  • Integration with compute PaaS – VMs and Virtual Networks can be integrated with custom code developed on the Windows Azure Platform as a Service (PaaS) offering.

VM Images Available at Preview [ Slide 6 ]

  • Microsoft VM Images
    • Windows Server 2012
    • Windows Server 2008 R2 SP1
    • SQL Server 2012
    • BizTalk Server 2013
       
  • Partner VM Images
    • SUSE Linux Enterprise Server 11 SP2
    • OpenSUSE 12.1
    • CentOS 6.2 +
    • Ubuntu 12.04

Cloud VMs with Persistent, Reliable Disks [ Slide 7 ]

  • VM virtual hard disks (VHDs) on the Windows Azure cloud platform are persistently stored in the world-wide Windows Azure Blob Storage Service as page blobs.
     
  • Each page blob is automatically replicated up to 3 times within the same Windows Azure datacenter region for storage high availability.
     
  • If a primary copy of a page blob being used to store a VHD becomes unavailable, Windows Azure will automatically restart a VM from a replicated copy of that page blob.
     
  • When provisioning a new Windows Azure storage account, you can optionally also replicate the page blob to a remote Windows Azure data center for even more protection.  Enabling Geo-replication is as easy as checking a single checkbox when provisioning a new storage account.
     
  • Each VHD stored on Windows Azure must be a fixed size VHD and can be up to 1TB in size.

Virtual Disks and VM Images with Windows Azure VMs [ Slide 8 ]

  • In addition to provisioning new VMs on the Windows Azure cloud platform using the standard images listed in Slide 6, IT Pros can also create their own customized images for deploying new VMs
     
  • Because Windows Azure and Windows Server shares a common VHD virtual hard disk format, fixed size VHDs can also be copied to Windows Azure and attached to VMs as either operating system disks or data disks.

Virtual Machine Sizes [ Slide 9 ]

  • When provisioning a new VM on the Windows Azure cloud platform, you will be prompted to select a virtual machine size.
     
  • Based on the VM size selected, an amount of CPU, memory, and network resources are made available to that VM.
     
  • VMs are charged back against an Azure subscription for the hours they consume per-core
    • Each hour of a Small (1 – core) VM is charged as 1 hour of compute time
    • Each hour of a Medium (2 – core) VM is charged as 2 hours of compute time
       
  • During the 90-Day Free Trial period, these compute hours will be charged against your total free allocation of 750 monthly compute hours.
     
  • When a VM is provisioned, CPU resources are reserved for that VM.  Regardless of whether the VM is in a Running or Stopped state, these CPU resources are still reserved and charged back against your Windows Azure subscription.
     
  • To prevent VM compute hours from being charged back when not in use, IT Pros can easily de-provision VMs when they are not needed and re-provision VMs when they are needed again.
     
  • Virtual hard disk content are preserved across VM de-provisioning and re-provisioning – VHDs remain stored on the Windows Azure Blog Storage Service even if the VM is de-provisioned.
     
  • VM de-provisioning and re-provisioning can be automated via the Windows Azure PowerShell Module cmdlets using Export-AzureVM and Import-AzureVM cmdlets ( Download code snippet examples below ).

Hands-on: Let’s Build Virtual Machines in the Cloud! [ Slides 10 through 20]

  • Getting Started with Building Windows Azure Virtual Machines [ Slides 10 – 14 ]
    • Walk-through these steps at: https://aka.ms/CloudLabStartHere
    • Activate FREE Windows Azure 90-Day Trial Subscription
    • Sign-in to Windows Azure Management Portal
    • Define a Windows Azure Affinity Group
    • Create a Windows Azure Storage Account
    • Download and install the Windows Azure PowerShell Module
       
  • PowerShell Code Snippet Examples [ Slides 15 – 20 ]
    • Download these code snippets for testing in your lab
    • Build Windows Server Cloud VMs with PowerShell [ Slide 15 ]
    • Build Linux Server Cloud VMs with PowerShell [ Slide 16 ]
    • Upload VHDs to Windows Azure with PowerShell [ Slide 17 ]
    • Exporting and De-Provisioning Cloud VMs with PowerShell [ Slides 18 & 19 ]
    • Importing / Re-Provisioning Cloud VMs with PowerShell [ Slide 20 ]

What’s Next? Keep Learning! [ Slides 21 & 22 ]

Continue learning about Windows Azure, PowerShell and Windows Server 2012 with these great additional resources …

  • Join the Windows Server 2012 “Early Experts” Challenge study group to learn more about Windows Server 2012 and prepare for MCSA Certification!
     
  • Learn more about Windows Azure Virtual Machines and Virtual Networks with this FREE Online Training!
     
  • Complete the other Hands-On Labs in the "Early Experts" Cloud Quest to request your certificate of completion ... Become our next "Early Expert"!

How are you using Windows Azure Virtual Machines and Virtual Networks?

Do you have an interesting or unique scenario that you are evaluating on the Windows Azure cloud platform with PowerShell?  Feel free to leave your comments, feedback and ideas below to share across our IT Pro community!