Docstoc

Automating-and-Managing-Windows-Azure-Solutions-with

Document Sample
Automating-and-Managing-Windows-Azure-Solutions-with Powered By Docstoc
					Automating and Managing Windows
Azure Solutions with Powershell
Tom Fuller
Windows Azure – Technology Solution Professional
@DeveloperTofu
http://developertofu.com
Who is Tom Fuller?
       2 Years as MVP,     I lived in Buffalo,
       5 Years as          NY until I left for
       Microsoft Field     college and yes,
       Engineer,           I am still a
       recently took       Buffalo Bills fan     Active speaker, writer,
       role as Azure       but no, I do not      blogger developertofu.com
       specialist          miss the snow         or @DeveloperTofu


       12 years in dev
       focused roles
                                In 2010,
       like architect,          the family
       web developer            moves to
       lots of work with        Atlanta,
       large enterprises        GA from          A fun challenge, coaching
       in the US                Tampa, FL        a 5 and under girls team
Cloud Computing
             Packaged                       Infrastructure                                Platform                                Software
             Software                       (as a Service)                                (as a Service)                          (as a Service)




                                                                             You manage
               Applications                   Applications                                   Applications                            Applications

                  Data                            Data                                           Data                                    Data




                               You manage
                Runtime                         Runtime                                        Runtime                                 Runtime




                                                                                                                                                      Managed by vendor
               Middleware                      Middleware                                     Middleware                             Middleware
You manage




                                                                                                              Managed by vendor
                   O/S                             O/S                                            O/S                                    O/S

              Virtualization                  Virtualization                                 Virtualization                          Virtualization




                                                               Managed by vendor
                 Servers                         Servers                                        Servers                                 Servers

                 Storage                         Storage                                        Storage                                Storage

               Networking                      Networking                                     Networking                             Networking
                                                                      Cloud
                           On and Off
Compute




          Inactivity       On & off workloads (e.g. batch job)
                           Over provisioned capacity is wasted
           Period
                           Time to market can be cumbersome




                                                                      Computing
                       t


                           Growing Fast

                                                                      Patterns
Compute




                           Successful services needs to grow/scale
                           Keeping up w/ growth is big IT challenge
                           Cannot provision hardware fast enough
                       t


                           Unpredictable Bursting
Compute




                           Unexpected/unplanned peak in demand
                           Sudden spike impacts performance
                           Can’t over provision for extreme cases
                       t


                           Predictable Bursting
Compute




                           Services with micro seasonality trends
                           Peaks due to periodic increased demand
                           IT complexity and wasted capacity
                       t
Windows Azure
Comprehensive set of         Flexible
services that enable you
to quickly build, deploy
and manage applications      Open
across a global network of
Microsoft-managed
datacenters                  Solid
Global
Footprint
99.95% monthly SLA
Pay only for what you use
Virtual machines   Cloud services   Web sites
compute              application
                 building blocks                networking   big data

  virtual
 machines



                 infrastructure for building and
                           database   storage    identity    caching


 web sites            running your applications
             service bus    media      CDN        traffic
                                                 manager     mobile

   cloud
  services
   cloud                        SQL       noSQL                                 virtual       traffic
  services   VMs   websites   database   database      blob          connect   network       manager
                   compute                data management                                 networking


Windows Azure Cloud Services (Stateless VM’s)
Virtual machines in the Cloud                   A place for your application
Two Flavors:                                    code to run…
                                                Web role is simply a Virtual Machine
  Web Role            Worker Role               with IIS pre-configured
                                                Worker role is for non-web based processing code,
                                                back-end business processes
                                                You can actually connect to your web/worker
                                                roles – they are just VM’s
                                                You package your code/artifacts and Windows
                                                Azure bootstraps a VM, installs the code
                                                and starts up the VM for you. Load balances
                                                multiple instances
    cloud                                  SQL       noSQL                            virtual       traffic
   services      VMs      websites       database   database   blob        connect   network       manager
                          compute                    data management                            networking


Windows Azure Virtual Machines
Getting Started                      Select Image and VM Size          New Disk Persisted in Storage



              Management Portal                                            Boot VM from New Disk



              Scripting                                                   Blob
              (Windows,                                                  Storage
              Linux and Mac)


              REST API
                                                                        Cloud
  cloud                                       SQL       noSQL                               virtual       traffic
 services   VMs        websites             database   database   blob           connect   network       manager
                       compute                          data management                               networking


Windows Azure Web Sites
            Quickly and easily deploy sites to a highly scalable cloud environment with the
            frameworks and open source apps of your choice using Windows Azure Web Sites

            Supported Deployment Protocols
            Supports multiple frameworks
            (ASP.NET, Classic ASP, PHP, Node.js)                     GIT : FTP
            Pick from popular                                       1010111001010101010001010100011
            Open Source apps
            Pick your DB                                             GIT : FTP
            (SQL Azure, MySQL)
                                                                    1010111001010101010001010100011
            Choose your tools
            (Visual Studio, Git, FTP, WebMatrix)
                                                                     GIT : FTP     Web Deploy : TFS Deploy
            Build on any platform
            (Windows, Mac, Linux)                                   1010111001010101010001010100011
Management
Service Management API for Managing and Monitoring
Applications in Windows Azure
                                       Provides programmatic access to
                                       platform functionality


                                       Used to deploy, manage,
                                       and monitor applications

                                       Powerful REST API, performed over SSL
                                       and mutually authenticated using
                                       X.509 certificates

                                       May be accessed from within application
                                       running in Windows Azure, or directly over
                                       the Internet from any application


                                       PowerShell commands using the same APIs
                                       can be used to script management functions
What can you do with PowerShell?
     Remote Management
     Manage SQL Databases, Configuration, Diagnostics, Deployments, and Azure assets (Affinity Groups,
     Storage Accounts, Keys, etc..)



     Automation
     Query, Manage and Configure Virtual Machines across multiple subscriptions,
     cloud services and storage accounts.



     Provision Fully Configured Virtual Machines
     Domain Joined
     Storage and Networking Configured




     Virtual Networking
     Completely Configure VNETs from a Script
Getting Started
       Use: Get-AzurePublishSettingsFile and Import-AzurePublishSettingsFile
       To Import Downloaded Publish Profile (.publishsettings)
       http://windows.azure.com/download/publishprofile.aspx




       Automatically configures Subscription ID, Certificate,
       Service Endpoint and Subscription Name.




       Multiple Subscription Support
       Get-AzureSubscription | foreach {
         Select-AzureSubscription $_.SubscriptionName
         # Perform Management Operation Against Each Subscription
       }
Getting
Demo Started with Azure Subscription
Credentials in Powershell
Virtual Machine Management
    Quick VM Provisioning Mode
    Supports VM Creation in a Single Cmdlet




    Advanced Provisioning Configuration Mode
    Provision With: Endpoints, Data Disks
    Configure: Cache Settings for OS/Data Disks and Subnet Names




    Create Multiple Pre-Defined VMs in a Batch
    New-AzureVM -VMs $vm1, $vm2, $vm3
Setting the current storage account
    Returns Storage Account
    Get-AzureStorageAccount | Select StorageAccountName




    Sets the Current Storage Account
    Set-AzureSubscription 'somesub1' -CurrentStorageAccount 'mystorage‘




    Cmdlets like New-AzureQuickVM will use this Account
Information Needed to create a VM
      Image Name
      Get-AzureVMImage | select ImageName

      Disk Name
      Get-AzureDisk | select DiskName




      Data Center Location
      Get-AzureLocation
Simple VM Creation
  First Virtual Machine in a NEW Cloud Service (-Location specified)
  New-AzureQuickVM -Windows -ServiceName $svc -Name $vm1 -
  ImageName $wimg -Location $location -Password $pwd

  New Virtual Machine in an Existing Cloud Service (no –Location)
  New-AzureQuickVM -Windows -ServiceName $svc -Name $vm2 -
  ImageName $wimg -Password $pwd

  Creating a Linux Virtual Machine in an Existing Cloud Service
  New-AzureQuickVM -Linux -ServiceName $svc -Name $vm3 -
  ImageName $limg -LinuxUser $lu -Password $pwd
Virtual Machine Discovery
  Retrieve Cloud Services
  Get-AzureService

  Retrieve Virtual Machines for Service
  Get-AzureVM -ServiceName $cloudSvcName

  Retrieve Status for All VMs in Subsription
  Get-AzureService | foreach {
    $_ | Get-AzureVM | ft ServiceName, Name, InstanceStatus
  }
Common Settings
   Name
   The name of the Virtual Machine




   AvailabilitySetName
   The availability set (used for high availability)




   InstanceSize
   ExtraSmall, Small, Medium, Large, ExtraLarge
Provisioning Options

      Add-AzureProvisioningConfig Options
      -Windows -Password $pwd
      -WindowsDomain -Password $pwd
        -Domain $dom, -JoinDomain $fqdn, -DomainUser $domUser
        -DomainPassword $domPwd -MachineObjectOU $ou
      -DisableAutomaticUpdates
      -NoRDPEndpoint, -TimeZone, Certificates




      Add-AzureProvisioningConfig Options
      Linux
       -LinuxUser $user -Password $pwd
       -DisableSSH , -NoSSHEndpoint
       -SSHKeyPairs, -SSHPublicKeys
         installed from certificates deployed in cloud service
Configuring a VM at Provision Time
 Create Configuration Object with New-AzureVMConfig
 Modify with Add-* cmdlets
 Add with New-AzureVM

 New-AzureVMConfig -Name $vm1 -InstanceSize Medium -ImageName $img |
  Add-AzureProvisioningConfig -Windows -Password $pwd |
  Add-AzureDataDisk -CreateNew -DiskLabel 'data' -DiskSizeInGB 10 -LUN 0 |
  Add-AzureEndpoint -Name 'web' -PublicPort 80 -LocalPort 80 -Protocol tcp |
    New-AzureVM -ServiceName $newSvc -Location $location
Virtual Machine Storage

     Data Disks
     Add/Remove data disks at boot or while running
     Create blank or attach existing disks




     Modify Cache Settings of OS Disk or Data Disk
     Modifying OS Disk while running requires reboot
Data Disk Creation
 New Virtual Machine Creation with Data Disk
 New-AzureVMConfig -Name 'myvm1' -InstanceSize 'Small' -ImageName $img |
  Add-AzureProvisioningConfig -Windows -Password $pwd |
  Add-AzureDataDisk -CreateNew -DiskSizeInGB 10 -DiskLabel 'myddisk' -LUN 0 |
  New-AzureVM -ServiceName $cloudSvcName

 Add new Data Disk to existing Virtual Machine
 Get-AzureVM -ServiceName 'myvm1' |
  Add-AzureDataDisk -CreateNew -DiskSizeInGB 10 -DiskLabel 'myddisk' -LUN 1 |
  Update-AzureVM
Deploying into a Virtual Network

     Virtual Machine Settings
     Set Subnet on VM with Set-AzureSubnet




     Deployment Settings
     Set Virtual Network -VNetName
     Set DNS Servers - New-AzureDns and -DNSSettings
Provision into a VNET and AD
 $dom = 'contoso'
 $jdom = 'contoso.com'
 $onPremDNS = New-AzureDns -IPAddress '192.168.1.4' -Name 'OnPremDNS'
 $cloudDNS = New-AzureDns -IPAddress '10.1.1.4' -Name 'CloudDNS'
 $computerOU = $advmou = 'OU=AzureVMs,DC=contoso,DC=com‘

 New-AzureVMConfig -Name 'myvm1' -InstanceSize 'Small' -ImageName $img |
  Add-AzureProvisioningConfig -WindowsDomain -Password $pwd -Domain $dom `
   -DomainUserName $domUser -DomainPassword $dpwd -JoinDomain $jdom `
   -MachineObjectOU 'AzureVMs' |
  Set-AzureSubnet -SubnetNames 'AppSubnet' |
  New-AzureVM –ServiceName $svc -AffinityGroup 'adag' `
   -VNetName 'ADVNet' -DnsSettings $onPremDNS, $cloudDNS
Provisioning and updating a new Virtual
Demo
Machine from Powershell
Automation
Adding and Removing Instances
 Update a running role to have more or less instances
 Set-AzureRole –ServiceName "MySvc1" –Slot "Production" –RoleName
 "MyTestRole3" –Count 3
VM Batch Creation
 Create Multiple Configured VMs and Pass to New-AzureVM
 $vm1 = New-AzureVMConfig -Name 'myvm1' -InstanceSize 'Small' -ImageName
 $img | Add-AzureProvisioningConfig -Windows -Password $pwd

 $vm2 = New-AzureVMConfig -Name 'myvm1' -InstanceSize 'Small' -ImageName
 $img | Add-AzureProvisioningConfig -Windows -Password $pwd

 $vm3 = New-AzureVMConfig -Name 'myvm1' -InstanceSize 'Small' -ImageName
 $img | Add-AzureProvisioningConfig -Windows -Password $pwd

 New-AzureVM -CreateService -ServiceName $cloudSvcName -VMs
 $vm1,$vm2,$vm3
   -Location $dc
Disk and Image Repository
                              Get-AzureVMImage # Return all
                              Get-AzureVMImage | Where { $_.Category -eq 'Microsoft' } # Return Microsoft
                              Get-AzureVMImage | Where { $_.Category -eq 'User' } # Return Custom
                              Get-AzureVMImage | Where { $_.Category -eq 'Partner' } # Return Partner Images
Microsoft, Partner and User   Get-AzureVMImage | Where { $_.OS -eq 'Windows' } # Return only Windows OS images
                              Remove-AzureVMImage -ImageName 'myimg' -DeleteVHD # Delete image and storage
                              Add-AzureVMImage -OS 'Windows' -ImageName 'MyWinImage' -MediaLocation
OS Images                     'http://storageaccount/vhds/winimage.vhd' # Add Existing VM Image from Storage


                              Get-AzureDisk # Return all
                              Get-AzureDisk | Where { $_.AttachedTo -eq $null } # Return all not attached to a VM
                              Get-AzureDisk | Where { $_.OS -eq $null } # Return only data disks
                              Get-AzureDisk | Where { $_.OS -eq 'Windows' } # Return only Windows OS disks
                              Remove-AzureDisk -DiskName 'mydisk' -DeleteVHD # Delete disk and storage
   OS Disks or Data Disks     Add-AzureDisk -OS 'Windows' -DiskName 'MyWinDisk' -MediaLocation
                              'http://storageaccount/vhds/winosdisk.vhd‘ # Add Existing OS Disk from Storage
Disks                         Add-AzureDisk -DiskName 'MyDataDisk' -MediaLocation 'http://storageaccount/vhds/datadisk.vhd‘
                              # Add Existing Data Disk from Storage
Batch Updating Running VMs
 Remove RDP and Add New Storage Across all Web Front Ends

 Get-AzureVM -ServiceName $svc | Where { $_.Name -match 'wfe' } |
 foreach {
  $_ |
  Remove-AzureEndpoint -Name 'rdp' |
  Add-AzureDataDisk -CreateNew -DiskSizeInGB 10 -LUN 1 -DiskLabel
 'newstorage' |
  Update-AzureVM
 }
Automating Scale Up of a Web Role with
Demo
Powershell
Get Started

 http://WindowsAzure.com
Q&A

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:0
posted:12/11/2013
language:Unknown
pages:39
jiang lifang jiang lifang
About