Enrique lima azure-it-pro-ps

Preview:

DESCRIPTION

Azure and PowerShell

Citation preview

idea. plan. deliver.

idea. plan. deliver.

Enrique LimaPrincipal Consultant

The road to Azure for IT Pros goes through PowerShell

idea. plan. deliver.

•Enrique Lima• enrique@thinkalm.com• Principal Consultant / Owner• Microsoft v-TSP BPIO / CoreIO / APPIO• Microsoft Community Contributor• Member of the Geekswithblogs.net Community - Influencer

▫ http://geekswithblogs.net/enriquelima• @enriquelima - twitter.com/enriquelima

• Member of INETA

Who am I?

idea. plan. deliver.

Disclaimer …

idea. plan. deliver.

Agenda

Getting Started

PowerShell and Azure

Windows Azure Pack

idea. plan. deliver.

idea. plan. deliver.

idea. plan. deliver.

Introduction to Windows Azure

Getting Started

idea. plan. deliver.

idea. plan. deliver.

Cloud Computing

consume

Software-as-a-ServiceSaaS

build

Platform-as-a-ServicePaaS

Infrastructure-as-a-Service

host

IaaS

idea. plan. deliver.

idea. plan. deliver.

Cloud ComputingPackaged Software

Storage

Servers

Networking

O/S

Middleware

Virtualization

Data

Applications

Runtime

You

man

age

Infrastructure(as a Service)

Storage

Servers

Networking

O/S

Middleware

Virtualization

Data

Applications

Runtime

Managed by vendor

You

man

age

Platform(as a Service)

Managed by vendor

You

man

age

Storage

Servers

Networking

O/S

Middleware

Virtualization

Applications

Runtime

Data

Software(as a Service)

Managed by vendor

Storage

Servers

O/S

Middleware

Virtualization

Applications

Runtime

Data

Networking

idea. plan. deliver.

Comprehensive set of services that enable you to quickly build, deploy and manage applications across a global network of Microsoft-managed datacenters

Windows Azure

Solid

Open

Flexible

idea. plan. deliver.

idea. plan. deliver.

Windows Azure Instance Sizes

Unit of Compute Defined

Variable instance sizes to handle complex workloads of any size

Small1 x

1.6Ghz (moderate IO) 1.75 GB memory

225 GB storage(instance storage)

Medium2 x

1.6Ghz (high IO)3.5 GB

memory 490 GB storage(instance storage)

Small

$0.12 Per service

hour

Medium

$0.24 Per service

hour

X-Large

$0.96 Per service

hour

Large

$0.48 Per service

hour

Large 4 x

1.6Ghz (high IO) 7.0 GB

memory1000 GB storage(instance storage)

X-Large8 x

1.6Ghz(high IO)

14 GB memory2040 GB

(instance storage)

$0.02 Per service

hour

Extra Small

Extra Small1 x 1.0Ghz(low IO)

768 MB memory 20 GB storage

(instance storage)

idea. plan. deliver.

idea. plan. deliver.

Per-hour license in the cloud

What about licensing?

Windows Server

Application License Mobility (SA)Per-hour license in the cloud (select few)

MicrosoftApplications

Based upon vendor and productExternal

Applications

idea. plan. deliver.

idea. plan. deliver.

Service Level AgreementsWhat’s includedCompute Hardware failure (disk, cpu, memory)Datacenter failures - Network failure, power failureHardware upgrades, Software maintenance – Host OS Updates

What is not includedVM Container crashes, Guest OS Updates

99.95% for multiple role instances4.38 hours of downtime per year

Server 2

SLA 99.95

Availability set

Server 1

idea. plan. deliver.

idea. plan. deliver.

Global Footprint

idea. plan. deliver.

idea. plan. deliver.

89Australia

AustriaBelgium

BrazilCanada

ChileColombia

Costa RicaCyprus

Czech RepublicDenmark

FinlandFrance

GermanyGreece

Hong KongHungary

IndiaIreland

IsraelItaly

LuxembourgMalaysia

MexicoNetherlands

New ZealandNorway

PeruPhilippines

PolandPortugal

Puerto RicoRomania

RussiaSingapore

SpainSweden

SwitzerlandTrinidad & Tobago

UKUnited States

New Countries:Algeria

ArgentinaBelarus

BulgariaCroatia

Dominican RepEcuador

EgyptEl Salvador

EstoniaGuatemala

IcelandIndonesia

JordanKazakhstan

Kenya

KuwaitLatvia

LiechtensteinLithuania

MacedoniaMalta

MontenegroMorocco

AzerbaijanNigeriaOman

PakistanPanama

ParaguayQatarJapan

Saudi ArabiaSerbia

SlovakiaSlovenia

South AfricaSri Lanka

TaiwanThailand

TunisiaTurkey

UAEUkraine

UruguayVenezuela

BahrainKorea

countries and territories

idea. plan. deliver.

idea. plan. deliver.

idea. plan. deliver.

PowerShell and Azure

idea. plan. deliver.

idea. plan. deliver.

Cloud services Web sites Virtual machines

Mobile services

Media services

idea. plan. deliver.

idea. plan. deliver.

What can you do with PowerShell?

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

Virtual NetworkingCompletely Configure VNETs from a Script

Provision Fully Configured Virtual MachinesDomain JoinedStorage and Networking Configured

idea. plan. deliver.

idea. plan. deliver.

Setting up your Subscription

Use: Get-AzurePublishSettingsFile and Import-AzurePublishSettingsFileTo Import Downloaded Publish Profile (.publishsettings) http://windows.azure.com/download/publishprofile.aspx

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

idea. plan. deliver.

idea. plan. deliver.

Manual Configuration of Subscription

Associate Certificate and Subscription ID$cert = Get-Item cert:\CurrentUser\My\CERTTHUMBPRINTSet-AzureSubscription 'mysub' -Certificate $cert -SubscriptionID $id

idea. plan. deliver.

idea. plan. deliver.

Subscription Management

Subscription Settings Persisted C:\Users\user\AppData\Roaming\Windows Azure Powershell

Subscription Example<Subscription name="somesub1"> <SubscriptionId>13d83b03-6d06-4770-943c-3d46766c3a35</SubscriptionId>

<Thumbprint>2AC8112B34CC840A30B9C2716AE840D5DC107510</Thumbprint> <ServiceEndpoint>https://management.core.windows.net/</ServiceEndpoint> </Subscription>

idea. plan. deliver.

idea. plan. deliver.

Switching Between Subscription Settings

Multiple Subscription Support Get-AzureSubscription | foreach { Select-AzureSubscription $_.SubscriptionName # Perform Management Operation Against Each Subscription}

idea. plan. deliver.

idea. plan. deliver.

Setting the current storage account

Returns Storage AccountGet-AzureStorageAccount | Select StorageAccountName

Cmdlets like New-AzureQuickVM will use this Account

Sets the Current Storage AccountSet-AzureSubscription 'somesub1' -CurrentStorageAccount 'mystorage‘

idea. plan. deliver.

idea. plan. deliver.

Information Needed to create a VM

Image NameGet-AzureVMImage | select ImageName

Disk NameGet-AzureDisk | select DiskName

Data Center LocationGet-AzureLocation

idea. plan. deliver.

idea. plan. deliver.

Virtual Machine Management

Quick VM Provisioning ModeSupports VM Creation in a Single Cmdlet

Create Multiple Pre-Defined VMs in a BatchNew-AzureVM -VMs $vm1, $vm2, $vm3

Advanced Provisioning Configuration ModeProvision With: Endpoints, Data DisksConfigure: Cache Settings for OS/Data Disks and Subnet Names

idea. plan. deliver.

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 ServiceNew-AzureQuickVM -Linux -ServiceName $svc -Name $vm3 -ImageName $limg -LinuxUser $lu -Password $pwd

idea. plan. deliver.

Configuring VM at Provisioning

Create Configuration Object with New-AzureVMConfigModify with Add-* cmdletsAdd 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

idea. plan. deliver.

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

idea. plan. deliver.

VM Batch Creation (using an array)

Create Multiple Configured VMs and Pass to New-AzureVM

$vmcount = 5$vms = @()for($i = 0; $i -lt 5; $i++){ $vmn = 'myvm' + $i $vms += New-AzureVMConfig -Name $vmn -InstanceSize 'Small' -ImageName $img | Add-AzureProvisioningConfig -Windows -Password $pwd | Add-AzureDataDisk -CreateNew -DiskLabel 'data' -DiskSizeInGB 10 -LUN 0 | Add-AzureDataDisk -CreateNew -DiskLabel 'logs' -DiskSizeInGB 10 -LUN 1 }

New-AzureVM -ServiceName $cloudSvcName -VMs $vms -Location $dc

idea. plan. deliver.

idea. plan. deliver.

Common Settings

NameThe name of the Virtual Machine

InstanceSizeExtraSmall, Small, Medium, Large, ExtraLarge

AvailabilitySetNameThe availability set (used for high availability)

idea. plan. deliver.

idea. plan. deliver.

Windows 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

idea. plan. deliver.

idea. plan. deliver.

Linux Provisioning Options

Add-AzureProvisioningConfig OptionsLinux -LinuxUser $user -Password $pwd -DisableSSH , -NoSSHEndpoint -SSHKeyPairs, -SSHPublicKeys installed from certificates deployed in cloud service

idea. plan. deliver.

idea. plan. deliver.

Deploying into a Virtual Network

Virtual Machine SettingsSet Subnet on VM with Set-AzureSubnet

Deployment SettingsSet Virtual Network -VNetName Set DNS Servers - New-AzureDns and -DNSSettings

idea. plan. deliver.

Provisioning into a VNET and Active Directory

$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

idea. plan. deliver.

Virtual Machine Discovery

Retrieve Cloud Services Get-AzureService

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

Retrieve Status for All VMs in SubsriptionGet-AzureService | foreach { $_ | Get-AzureVM | ft ServiceName, Name, InstanceStatus}

idea. plan. deliver.

idea. plan. deliver.

Virtual Machine Storage

Data DisksAdd/Remove data disks at boot or while runningCreate blank or attach existing disks

Modify Cache Settings of OS Disk or Data DiskModifying OS Disk while running requires reboot

idea. plan. deliver.

Data Disk Creation

New Virtual Machine Creation with Data DiskNew-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 MachineGet-AzureVM -ServiceName 'myvm1' | Add-AzureDataDisk -CreateNew -DiskSizeInGB 10 -DiskLabel 'myddisk' -LUN 1 | Update-AzureVM

idea. plan. deliver.

Modifying Cache Settings

Set Host Caching on OS Disk During ProvisioningNew-AzureVMConfig -Name 'myvm1' -InstanceSize 'Small' -ImageName $img | Add-AzureProvisioningConfig -Windows -Password $pwd | Set-AzureOSDisk -HostCaching 'ReadOnly' | New-AzureVM -ServiceDescription $cloudSvcName

Set Host Caching on Existing Data Disk in running VMGet-AzureVM -ServiceName $cloudSvcName -Name 'myvm1' | Set-AzureDataDisk -HostCaching 'ReadWrite' -LUN 0 | Update-AzureVM

idea. plan. deliver.

Configuring Endpoints

Add Endpoints at CreationNew-AzureVMConfig -Name 'myvm1' -InstanceSize 'Small' -ImageName $img | Add-AzureProvisioningConfig -Windows -Password $pwd | Add-AzureEndpoint -LocalPort 80 -PublicPort 80 -Name http -Protocol tcp | Add-AzureEndpoint -LocalPort 443 -PublicPort 443 -Name https -Protocol tcp | New-AzureVM -ServiceDescription $cloudSvcName

Modify Endpoints at RuntimeGet-AzureVM -ServiceName $cloudSvcName -Name 'myvm1' Add-AzureProvisioningConfig -Windows -Password $pwd | Add-AzureEndpoint -LocalPort 53 -PublicPort 53 -Name dns -Protocol udp | Remove-AzureEndpoint -Name https | New-AzureVM -ServiceDescription $cloudSvcName

idea. plan. deliver.

Disk and Image Repository

OS Images

Get-AzureVMImage # Return all Get-AzureVMImage | Where { $_.Category -eq 'Microsoft' } # Return Microsoft Get-AzureVMImage | Where { $_.Category -eq 'User' } # Return CustomGet-AzureVMImage | Where { $_.Category -eq 'Partner' } # Return Partner ImagesGet-AzureVMImage | Where { $_.OS -eq 'Windows' } # Return only Windows OS imagesRemove-AzureVMImage -ImageName 'myimg' -DeleteVHD # Delete image and storageAdd-AzureVMImage -OS 'Windows' -ImageName 'MyWinImage' -MediaLocation 'http://storageaccount/vhds/winimage.vhd' # Add Existing VM Image from Storage

Disks

Get-AzureDisk # Return all Get-AzureDisk | Where { $_.AttachedTo -eq $null } # Return all not attached to a VMGet-AzureDisk | Where { $_.OS -eq $null } # Return only data disks Get-AzureDisk | Where { $_.OS -eq 'Windows' } # Return only Windows OS disksRemove-AzureDisk -DiskName 'mydisk' -DeleteVHD # Delete disk and storageAdd-AzureDisk -OS 'Windows' -DiskName 'MyWinDisk' -MediaLocation 'http://storageaccount/vhds/winosdisk.vhd‘ # Add Existing OS Disk from Storage Add-AzureDisk -DiskName 'MyDataDisk' -MediaLocation 'http://storageaccount/vhds/datadisk.vhd‘# Add Existing Data Disk from Storage

Microsoft, Partner and User

OS Disks or Data Disks

idea. plan. deliver.

Batch Updates to 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}

idea. plan. deliver.

Capturing a Virtual Machine as a new Image

Capture Sys-Prepped VM into a new Image (Deletes the Source VM)

Save-AzureVMImage -ServiceName $cloudSvcName -Name 'myvm1' -NewImageName 'Image Name'

idea. plan. deliver.

Virtual Network Operations

View and Set Virtual Network ConfigurationGet-AzureVNetConfig | Select -Expand XMLConfigurationSet-AzureVNetConfig -ConfigurationPath 'c:\Network\MyNetCFG.xml'

Start and Stop Virtual Network Gateway Set-AzureVNetGateway -Disconnect -VNetName 'MyVNet' -LocalNetworkSiteName 'MySite'Set-AzureVNetGateway -Connect -VNetName 'MyVNet' -LocalNetworkSiteName 'MySite'

View Virtual Network StatusGet-AzureVNetConnection -VNetName 'MyVNet'

idea. plan. deliver.

idea. plan. deliver.

idea. plan. deliver.

A view into System Center 2012 R2

Windows Azure Pack

idea. plan. deliver.

ON-PREMISES

SERVICE PROVIDERMICROSOFT

CONSISTENTPLATFORM

Modern platform for the world’s apps

Enables modern apps

Unlocks insights on any data

Empowers people-centric IT

Transforms the datacenter

1

idea. plan. deliver.

idea. plan. deliver.45

Consistent experiences

SERVICE MGMT PORTAL & API

WEB SITES SERVICE BUS

Reliable Messaging

Standards Based

Cross Cloud

Fully self-service

Web Application PaaS

Highly Scalable

Dev-ops optimized

Integrated SCC

Fully self-service

VIRTUAL MACHINES

IaaS - Elastic Tiers

Virtual Networks

Window and Linux

Gallery of apps

Fully self-service

Azure Consistent

Federated Identities

Active Directory

Standards Based

Device Friendly

ON-PREMISES

SERVICE PROVIDERMICROSOFT

CONSISTENTPLATFORM1

idea. plan. deliver.

idea. plan. deliver.

Finished Services

Web Sites

High density and scalable

Easy deployment and administration

Fully self-service

Service Management API

Service Management Portal

Virtual Machines

Offer preconfigured workloads

Windows and Linux

Fully self-service

Service Bus

Reliable Messaging

Standards based

Fully self-service

Web Sites Virtual Machines Service Bus

Service Provider Foundation API

System Center(Virtual Machine Manager Component)

Windows Server

GatewayController(Web farm framework)

Web FarmFront-end/Workers(Application Request Routing/Dynamic Windows Process Activation Service )

Windows Server Windows Server

Message Broker Service

idea. plan. deliver.

idea. plan. deliver.

R2 w/ Service Provider Foundation

Future Services

Service Bus

SQLVMsWebSites

Service Management API

ServicePlansUsers Provider

PortalConsumer

Self-ServicePortal

Web SitesAppsDatabaseVMs

Service ProviderCustomer

Self Service Portal Moves On-

Premises

Common Mgt. Experience

Workloads

Cloud-Enabled Services Move On-

Premises

Consistent Dev.

Experience

Other Services

CDN.Media,, etc.

CachingService

BusSQLVMs

WebSites

WorkerRole

Service Management API

Web SitesAppsDatabaseVMs

Subscriber Self-

ServicePortal

Windows Azure

Cloud OS Consistent Experiences

R2

idea. plan. deliver.

idea. plan. deliver.

Service ConsumersConsume infrastructure and apps

from service providers as “off the shelf” solutions

Service ProvidersOffer and administer servicesthat are provided to customers

self-service administration

acquire capacity on demand

empowered operations

predictable costs

get up & running quickly

extreme focus on cost

maximize per-customer profit

hardware efficiency

automate everything

differentiate on SLAs

idea. plan. deliver.

Cloud Offerings for Service Consumers

Web Sites Service Bus Virtual Machines

idea. plan. deliver.

Build highly scalable web applications

Iterate with integrated source control

Manage your app with real-time telemetry

Scale up with one click

Support for .Net, Node.js, PHP, Python

Web Sites

idea. plan. deliver.

Messaging service for cloud apps

Guaranteed message delivery

Publish-subscribe messaging patterns

Standard protocols (REST, AMQP, WS*)

Interoperability (.NET, Java/JMS, C/C++)

Now integrated with management portal

Service Bus

idea. plan. deliver.

Windows Azure-consistent IaaS- User Experience & API

Virtual Machine Roles- Portable- Elastic- Gallery- Windows and Linux Support

Virtual Networks- Site to Site connectivity- Tenant supplied IP addresses

Virtual Machines

idea. plan. deliver.

Identity- Active Directory- ADFS Federation- Co-administrators

Database Services- SQL Server- MySQL

Custom services from provider

Programmatic access to cloud services

- Windows Azure Consistent REST APIs

Additional Services

idea. plan. deliver.

Enabling Service Providers

AdministrationUsage &

ReportingAutomation

idea. plan. deliver.

Administration

Offer Services to Tenants via Plans

Provide Add-ons to subscriptions

Manage subscriptions

Administer Services

Extend and customize

idea. plan. deliver.

Automation

Optimize and extend services using runbooks

Powershell workflows

Web-based runbook authoring

Manage runbooks and jobs

Integrates with other systems including System Center

idea. plan. deliver.

Usage and Reporting

Continuous usage metering per tenant subscription

Per-subscription Billing APIs

IaaS Data Warehouse

Server Inventory Reports

idea. plan. deliver.

idea. plan. deliver.

idea. plan. deliver.

Summary

Getting Started

PowerShell and Azure

Windows Azure Pack

idea. plan. deliver.

idea. plan. deliver.

idea. plan. deliver.

Questions

idea. plan. deliver.

•Windows Azure Training Kit•MVA: What’s New in System Center 2012 R2 Jump Start

Special acknowledgement to:• David Aiken • Jeffrey Snover• Jason Helmick• Symon Perriman

Resources:http://msdn.microsoft.com/en-us/library/windowsazure/jj156055.aspxhttp://msdn.microsoft.com/en-us/library/windowsazure/jj152841.aspx

Credits and Information

idea. plan. deliver.

Recommended