elevating windows azure deployments (visual studio live - las vegas 2013)

42
Elevating Windows Azure Deployments Michael S. Collier National Architect, Cloud Level: Intermediate

Upload: michael-collier

Post on 27-Jan-2015

107 views

Category:

Technology


2 download

DESCRIPTION

One of the core tenants for working with cloud services is automation. When it comes to deploying our new cloud solutions, we want to automate the process as much as possible too. Both Visual Studio and the Windows Azure online management portal make deployments pretty easy - but it's manual. By leveraging tools like PowerShell we can automate much of the mundane deployment tasks, allowing us to have confidence in the final solution. We can further enhance our build and deploy solution by leveraging TFS - giving us continuous cloud deployments! Besides covering deployment options with PowerShell and TFS, in this session we'll also discuss techniques for handling the inevitable updates of our cloud services. Coming away from this session you'll have a solid understanding, backed by practical real-world examples, of handling service deployments and updates. This session was presented at Visual Studio Live (Las Vegas, March 2013).

TRANSCRIPT

Page 1: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

Elevating Windows Azure Deployments

Michael S. CollierNational Architect, Cloud

Level: Intermediate

Page 2: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

About Me

Michael S. Collier

National Architect, Cloud

[email protected]

@MichaelCollier

www.MichaelSCollier.com

http://www.slideshare.net/buckeye01

Page 3: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

Today’s Agenda

• Authentication• Visual Studio• PowerShell• TFS• Command Line Options

Page 4: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

• Build & deployment process crucial to any project.– Easily overlooked initially.– Good tools and/or process

are worth the time.

Why?

Page 5: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

• Windows Azure – nearly everything is automated.

• Scale makes automation a necessity.

• Failure to automate puts projects at risk

• Several deployment options available with Windows Azure.

Automation is the Key

Page 6: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

Management PortalGreat for quick deployments or updates.

Need to have deployment package and config prepared.

Windows Azure Deployment Options

Page 7: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

Visual StudioVery low developer friction – wizards make it easy.

Automatically handles some of the necessary tasks

Windows Azure Deployment Options

Page 8: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

PowerShellVery powerful – can do pretty much anything from PowerShell.

Slight learning curve if not familiar with PowerShell.

Windows Azure Deployment Options

Page 9: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

Management APIThe native interface – everything else uses the management API.

More code to write – build your own tools or processes.

Windows Azure Deployment Options

Page 10: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

• Team Foundation Server– Tap into existing build workflows.– Need to understand how to edit

build tasks and workflows.– Use PowerShell script or MSBuild

target to deploy.

• Team Foundation Service– Already includes workflow to build

and deploy.

• Everything requires some form of authentication.

Windows Azure Deployment Options

Page 11: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

Microsoft Account

• Used only with Windows Azure Management Portal.• Can delegate co-admin access to other Microsoft Accounts.

https://manage.windowsazure.com

Page 12: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

Management Certificate

• Identifies you with Windows Azure– X509 certificate.– Can create yourself or have Windows Azure create one for you.– Anything that uses the management API (Visual Studio, PowerShell, TFS, etc.)

• Key Management– Upload the .cer file to the Windows Azure management portal.– You keep the private key in your certificate store.

Page 13: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

Create a Cert using IIS

• Quick and easy, but limited control– IIS Management Console

Server CertificateLink to ‘Create Self-Signed Certificate’Provide a name – file in Local Computer\Personal store

– Export the PFX to a CER without the private keyAdd Certificate snap-in for MMCFind certificate and Export

Page 14: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

Create a Cert using IIS

• Quick and easy, but limited control– IIS Management Console

Server CertificateLink to ‘Create Self-Signed Certificate’Provide a name – file in Local Computer\Personal store

– Export the PFX to a CER without the private keyAdd Certificate snap-in for MMCFind certificate and Export

Page 15: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

Create a Cert using IIS

• Quick and easy, but limited control– IIS Management Console

Server CertificateLink to ‘Create Self-Signed Certificate’Provide a name – file in Local Computer\Personal store

– Export the PFX to a CER without the private keyAdd Certificate snap-in for MMCFind certificate and Export

Page 16: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

• Import a Certificate via a .publishsettings file– Created automatically by visiting

https://windows.azure.com/download/publishprofile.aspx

– Contains a base64 encoded certificate (w/ the private key).

• Advantages– Fast and easy – minimal developer

friction.

• Disadvantages– Certificate created in every subscription

associated with your Microsoft Account.– Can’t control the certificate name

(<subscription_name>-<date_created>-credentials)

– Easy to hit 25 certificate limit within a subscription or Microsoft Account.

Import a Cert from Windows Azure

Page 17: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

• Protect Your Secrets– Delete the .publishsettings file after

import (or at least keep someplace safe).– Visual Studio places local file at

%UserProfile%\My Documents\Visual Studio 2012\Settings\Windows Azure Connections.xml.

Import a Cert from Windows Azure

Page 18: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

Create a Cert using MAKECERT

• Offers a great deal of control.• Create a .cmd file for easy reuse & share with team.

One line

Page 19: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

CREATING A CERT ANDMANUAL CONFIGURATION

demo

Page 20: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

Visual Studio Deployment• Create a Project

– New Windows Azure Cloud Service project.– Add Windows Azure deployment to existing

project.

• Authenticate– Import certificate from a .publishsettings file.– Use an existing certificate.

Load certificate to the management portal.Associate certificate with Visual Studio.

• Publish– Visual Studio verifies deployment package.– Creates new Cloud Service (if necessary).– Uploads package (.cspkg and .cscfg) to blob

storage and deploys.

More details at http://msdn.microsoft.com/en-us/library/ee460772.aspx

Page 21: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

Where are the Files?

• Visual Studio publish location– Temporarily stored at <storage_account>\vsdeploy\<guid>

Page 22: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

• Keep deployment files in blob storage for easy & fast deployments in the future.

• No need to re-upload – deploy from blob storage.

Page 23: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

PowerShell Deployment

• Automate as much as possible.– Figure out the process first.– Automate the tedious and error prone – like deployments.– Save time and frustrations.

• One script for all.– One script for local and source control builds (TFS).– Share across a team – everybody follows the same process.

Page 24: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

PowerShell Deployment

Page 25: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

Getting Started• Download from

https://www.windowsazure.com/en-us/manage/downloads/ – Officially supported cmdlets – not the previous version on CodePlex.– Not everything from previous version has made it over yet (e.g. storage)

• Import module– Import-Module "C:\Program Files (x86)\Microsoft SDKs\Windows Azure\

PowerShell\Azure\Azure.psd1“

• Authenticate– Import certificate from a .publishsettings file or use an existing certificate.

• Subscription– Select a subscription and a storage account for deployments– Default location - %userprofile%\AppData\Roaming\Windows Azure Powershell

Page 26: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

BUILD & DEPLOY WITH POWERSHELL

demo

Page 27: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

Leverage Team Foundation Service

• Includes pre-built deployment workflow.– Use default settings– Override settings to customize

deployment (name, storage account, slot, label, etc.)

– See full tutorial at https://www.windowsazure.com/en-us/develop/net/common-tasks/publishing-with-tfs/

• Currently in Preview

Page 28: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

Leverage Team Foundation Service

• Includes pre-built deployment workflow.– Use default settings– Override settings to customize

deployment (name, storage account, slot, label, etc.)

– See full tutorial at https://www.windowsazure.com/en-us/develop/net/common-tasks/publishing-with-tfs/

• Currently in Preview

Page 29: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

BUILD & DEPLOY WITHTEAM FOUNDATION SERVICE

demo

Page 30: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

PowerShell and TFS

• Execute PowerShell script from TFS build workflow– Call to the same PowerShell script created previously.– Edit build definition to accept input parameters for the PowerShell script.

Page 31: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

Enabling Continuous Deployment

• Check-in the source code.• Package and deploy to Windows Azure.

• NOT cost efficient!– Deployed services cost money regardless of use.– Each time a service is deleted and deployed == 1 hour cost charge.

Page 32: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

Build Server Configuration

• Not “hard”, but somewhat time consuming.– Turn on logging in the build – very helpful in understanding why something doesn’t work.

• Several misc. components to install manually.– Developer workstations – Web PI often handles these things for you as part of Visual Studio

setup.

• Give build service account at least Read access to mgmt. certificate.• What You May Need

– .NET Framework version(s)– Windows Azure Authoring Tools– Windows Azure Tools for Visual Studio– Windows Azure PowerShell Cmdlets– Microsoft.WebApplications.targets file (copy from computer w/ Visual Studio installed)– Management Certificate

Page 33: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

POWERSHELL AND TFSdemo

Page 34: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

• Service Bus– Create & manage namespaces

• Cloud Services– List & delete services– Manage service certificates

• Storage Account– Create & manage

• Websites– Create & manage– Download logs– Manage deployments– Github integration

• Virtual Machines– Create & manage– Endpoints & images

• Mobile Services– Create & manage– Tables, scripts, & configuration– Logs

Cross Platform Tools (command line)

• Command reference at http://www.windowsazure.com/en-us/manage/linux/other-resources/command-line-tools/

• Check out https://github.com/windowsazure/azure-sdk-tools-xplat for bug list and updates. Look at the dev branch to see the future!

Page 35: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

Get the Tools

• Get node.js– http://nodejs.org– npm install –g azure-cli– V0.8.x

• Get node.js– Windows installer– http://go.microsoft.com/fwlink/

?LinkID=275464&clcid=0x409

Page 36: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

Easy Git integration

Windows Azure xPlat CLI

> azure site create -–location “East US” –-git MySiteName> notepad default.htm> git add .> git commit –m “initial commit”> git push azure master

Page 37: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

CONTINUOUS DEPLOYMENT WITH WEB SITES

demo

Page 38: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

Support for Logical Environments• Different Windows Azure projects for different logical

environments– Handle differences in .csdef (i.e. machine size).

• Different build definitions - different environments.– Different configuration settings (instance count, connection strings, etc.)– Adjust input parameters to match the environment.

Storage account nameService nameDeployment slot. . .

Development

Staging

Production

CS CS

CS DB

CS CS

CS DB

QA

Staging

Production

CS

DB

CS

DB

Production

Staging

Production

CS

CS

DB

Page 39: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

Command Line

Visual Studio TFSPowerShell

Multiple paths availablePick an authentication approach that works for you – understand the pros and cons.Automate as much as possible – invest early and save yourself time and money later.

Windows Azure Deployments

Page 40: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

• Windows Azure Guidance– https://www.windowsazure.com/en-us/develop/net/Guidance/

• Windows Azure Training Kit– https://www.windowsazure.com/en-us/develop/net/other-resources/training-kit/

• Windows Azure Continuous Delivery– https://www.windowsazure.com/en-us/develop/net/common-tasks/continuous-d

elivery/

• Deploy Cloud Services with Visual Studio– http://msdn.microsoft.com/en-us/library/ee460772.aspx

• Windows Azure Web Sites Cheat Sheet– http://windowsazurewebsitescheatsheet.info

Resources

Page 41: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

Q &

A

Ask your questions

Page 42: Elevating Windows Azure Deployments (Visual Studio Live - Las Vegas 2013)

Thank You!!Michael S. Collier

National Architect, Cloud

[email protected]

@MichaelCollier

www.MichaelSCollier.com

http://www.slideshare.net/buckeye01

Please fill out your session evals!