automating windows azure

19
Ido Flatow Senior Architect Microsoft MVP SELA Group Automating Windows Azure Because the Management Portal is so 2012 @idoFLATOW http://bit.ly/flatow- blog This presentation: http://sdrv.ms/ 13HplxU

Upload: ido-flatow

Post on 15-Nov-2014

1.826 views

Category:

Technology


0 download

DESCRIPTION

Automatic Windows Azure with PowerShell and the Windows Azure CLI tools.

TRANSCRIPT

Page 1: Automating Windows Azure

Ido FlatowSenior Architect

Microsoft MVPSELA Group

Automating Windows Azure

Because the Management Portal is so 2012

@idoFLATOWhttp://bit.ly/flatow-blog

This presentation:http://sdrv.ms/

13HplxU

Page 2: Automating Windows Azure

www.devconnections.com

AUTOMATING WINDOWS AZURE

ABOUT ME

Senior architect, Sela Group Co-author of:

Developing Windows Azure and Web Services – Microsoft official course

WCF 4 – Microsoft official course

Pro .NET Performance – Apress

Microsoft MVP Focus on server, services, and cloud

technologies Manager of the Israeli Web Developers User

Group

Page 3: Automating Windows Azure

www.devconnections.com

AUTOMATING WINDOWS AZURE

3

DEPLOYMENT SCENARIOS

New product version/build Creating new environments (dev, test,

staging) Deploying to new data centers Provisioning components for new tenants

(multitenant applications) Installing entire system using customer’s

subscription Disaster recovery

Page 4: Automating Windows Azure

www.devconnections.com

AUTOMATING WINDOWS AZURE

4

WE NEED AUTOMATION BECAUSE

The checklist becomes annoying after the third time

We miss a step during each and every deployment

Someone will eventually need to update the deployment instructions (but not me!)

Five VMs done, 45 to go We want to go home before dawn

Page 5: Automating Windows Azure

www.devconnections.com

AUTOMATING WINDOWS AZURE

5

WE NEED AUTOMATION BECAUSE

We just want something to double-click so

we can go home on time!

Page 6: Automating Windows Azure

www.devconnections.com

AUTOMATING WINDOWS AZURE

6

HOW STUFF WORKS

HTTP Management APIs

Page 7: Automating Windows Azure

www.devconnections.com

AUTOMATING WINDOWS AZURE

7

HOW STUFF WORKS

Page 8: Automating Windows Azure

www.devconnections.com

AUTOMATING WINDOWS AZURE

8

HOW STUFF WORKS

HTTP Management APIs HTTPS

x.509 Client Cert.

XML

Page 9: Automating Windows Azure

www.devconnections.com

AUTOMATING WINDOWS AZURE

9

WHAT CAN WE AUTOMATE?

Web Sites Virtual Machines Mobile Services Cloud Services

SQL Database Storage

Media Services Service Bus

Virtual Network Traffic Manager

Locations Affinity Groups Certificates

SQL ReportingHDInsight Recovery Services

Active Directory CDN

AlertsLinked Resources

Has HTTP APIs No HTTP APIs

Page 10: Automating Windows Azure

www.devconnections.com

AUTOMATING WINDOWS AZURE

10

HOW TO AUTOMATE

Page 11: Automating Windows Azure

www.devconnections.com

AUTOMATING WINDOWS AZURE

11

COMMAND LINE TOOLSCommand Line Interface (CLI) Runs on Windows, Mac, and

Linux

Written in Node.js

Commands can return JSON

Scripting with: Linux tools, such as grep,

awk, and sed

Javascript with Azure-scripty (node-based)

PowerShell Cmdlets Run only on Windows

Larger toolset

Commands return .NET objects

Scripting with PowerShell piping

PowerShell scripts

Page 12: Automating Windows Azure

www.devconnections.com

AUTOMATING WINDOWS AZURE

12

THE BASICS:AZURE ACCOUNTS

Get-AzurePublishSettingsFile

Import-AzurePublishSettingsFile $pathToPublishSettingsFile

# Or manually set the subscriptionSet-AzureSubscription -subscriptionname $name -certificate $cert -subscriptionid $id

azure account download

azure account import <pathToPublishSettingsFile>

Page 13: Automating Windows Azure

www.devconnections.com

AUTOMATING WINDOWS AZURE

13

THE BASICS:WEB SITES & CLOUD SERVICES

New-AzureWebsite -Name $name -Location "East US“

New-AzureService -ServiceName $name -Location “East US“

azure site create --location "East US" <Name>

azure service create --location "East US" <Name>

Page 14: Automating Windows Azure

www.devconnections.com

AUTOMATING WINDOWS AZURE

14

THE BASICS:VIRTUAL MACHINES

$image = Get-AzureVMImage | ? {$_.ImageFamily -like '*2012*Datacenter'} | sort $_.PublishedDate | select –first 1

New-AzureQuickVM -Windows -Name $name -Location "East US" -ImageName $image.ImageName -ServiceName $cloudServiceName -AdminUsername myAdmin -Password $password

image=$(azure vm image list | grep 'Windows-Server-2012-Datacenter-201308.01' | awk '{print ($2)}')

azure vm create $name $image administrator $pass --location "East US" -r

Page 15: Automating Windows Azure

www.devconnections.com

AUTOMATING WINDOWS AZURE

15

VIRTUAL MACHINESWITH AZURE-SCRIPTY

var scripty = require('azure-scripty');

scripty.invoke('vm image list', function(err, results) {

var imageName = results[0].Name;

cmd = {

command: 'vm create',

rdp: true,

positional: [process.argv[2],imageName, 'administrator',

process.argv[3]],

location: '"' + process.argv[4] + '"'};

scripty.invoke(cmd);

});node createVM.js myNewVM mypassword ‘East US’

Page 16: Automating Windows Azure

www.devconnections.com

AUTOMATING WINDOWS AZURE

SUPPORTED SERVICES

SQL Database Storage

Service Bus

HDInsight

Web Sites Virtual Machines Cloud Services Mobile Services

Virtual Network

Affinity Groups Certificates

SQL Database Storage

Service Bus

Web Sites Virtual Machines Cloud Services

Virtual Network

Affinity Groups Certificates Locations Name Test

Store Add-ons

Page 17: Automating Windows Azure

www.devconnections.com

AUTOMATING WINDOWS AZURE

17

AUTOMATING WINDOWS AZURESeeing is Believing!

Page 18: Automating Windows Azure

www.devconnections.com

AUTOMATING WINDOWS AZURE

18

WHAT ABOUT ALL THE REST?

Use the HTTP-based APIs Require some coding (curl, python, C#, …) Don’t forget to authenticate MSDN documentation is available

http://msdn.microsoft.com/library/jj152841.aspx You are not the first one to try this

Windows Azure SDK (Python, Node, PHP, Ruby, …)

ElastaCloud Azure Fluent Management (.NET)

Windows Azure Service Management Library (.NET)

Media Services Traffic Manager VNet Gateway Management Certs. …

Page 19: Automating Windows Azure

www.devconnections.com

AUTOMATING WINDOWS AZURE

19

RESOURCES

Too many resources for a single slide

Presentation and resources can be found here:

sdrv.ms/13HplxU

[email protected] @idoflatow http://bit.ly/flatow-blog