27
Continuous Delivery of Windows Azure Cloud Services (DEV310) Paul Yuknewicz Principal Program Manager Lead, Visual Studio [email protected] Microsoft Corporation DEV310

Continuous Delivery of Windows Azure Cloud Services (DEV310) Paul Yuknewicz Principal Program Manager Lead, Visual Studio [email protected] Microsoft

Embed Size (px)

Citation preview

Continuous Delivery of Windows Azure Cloud Services (DEV310)

Paul YuknewiczPrincipal Program Manager Lead, Visual [email protected] Corporation

DEV310

Session Goals

Automate complete delivery process of Cloud ServicesIntegrate with overall software app dev lifecycleCustomize for your unique environment

Agenda

OverviewConfiguring build serverAutomate package build using MSBuildPush packages to Azure using PowerShell scriptsBuild and deploy packages using TFS Team build (on prem)Build and deploy packages using TFS Build Service (cloud)Customizations and best practices throughout

Application Development Lifecycle

Developer Machine

Windows Azure SDK for .NET

Development

TestingF5

Dep

loy

Build Server

Check In

Staging

Automated testing

Warm-bloodeduser testing

TFS Build Server

Web & Azure Projects

Web & Azure DLL’s

Build

Run Tests ?

Fix Bugs(repeat as necessary)

NightlyBuild -OR-Continuous Integration

Deploy using PowerShell or WF

Open/Close Bugs

CSPKG

Build targets & scripts

Configuring Build ServerPrinciples

Package build task is fast and disconnectedDeployment pushes handled in separate tasks/activities/scriptsDevelopers own the app source code, not build serverFidelity with manual / VS package buildFast failure with validation and logs

Configuring Build ServerConsiderations

Automation runner (MSBuild, TFS Build, scripts, 3rd party)MSBuild tools and build targets (Web, Azure SDK, etc)Windows Azure SDK (allows partial install w/o VS tools, side by side version)PowerShell scripts and Azure SDK cmdletsProcess identity, access control, and secretsTriggersDrop locationsLog and trace output locations

Configuring Build ServerPre-reqs

.NET Framework 4.0 (includes MSBuild)Required MSBuild targets:

Windows Azure SDK – Windows Azure Authoring Tools (1.6 or 1.7)Windows Azure Tools for Visual Studio (doesn’t require VS)Microsoft.WebApplication.targets (copy from VS2010 or VS2012)

MSBuild install paths:VS 2010: \Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0VS 2012: \Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0

Create a cloud package with MSBuildGetting started

set PATH=%PATH%;"C:\Windows\Microsoft.NET\Framework\4.0“

MSBuild /target:Publish

Notes:• Same output as Visual Studio Package command: CSPKG + CSCFG files• Publishes to <ProjectDir>\bin\<Configuration>\app.publish\ • Ensure this is the appropriate path to MSBuild to match your target .NET

framework version• TFS: set these in the MSBuild Arguments property of the process template / build

definition

Create a cloud package with MSBuildOptional parameters

MSBuild /t:Publish /p:TargetProfile=ServiceConfiguration.Test.cscfg

Override cloud config file to publish:

MSBuild /target:Publish /p:PublishDir=\\myserver\drops\

Override drop location:

demo

Build cloud packages

Continuous integration (CI)

Deploy using PowerShellPre-reqs

Windows Azure PowerShell 0.6.0+ cmdletsPublishSettings file with management certificatePre-built package build outputStorage account createdCloud Service container createdCloud Service certificate created and uploaded (optional: for RDP or SSL)

Tip: publish with Visual Studio cloud tools first, or else you must use portal + PowerShell to provision resources

Provisioning resources in PowerShell

New-AzureService -ServiceName myservicedns -Location ‘West US’ -Label ‘myservicedns’

Create a Cloud Service container example:

New-AzureStorageAccount –StorageAccountName mystoragedns -Location ‘West US’ -Label ‘ mystoragedns’

Create a storage account example:

Get-AzureLocationGet-AzureAffinityGroup

List all locations (data centers) and affinity groups:

Upload RDP certificates in PowerShell

<Certificates> <Certificate

name="Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption" thumbprint="C33B6C432C25581601B84C80F86EC2809DC224E8" thumbprintAlgorithm="sha1" /> </Certificates>

First, locate the cert(s) in the cloud configuration (.cscfg) file for your target environment:

Add-AzureCertificate -serviceName 'myservicedns' -CertToDeploy (get-item cert:\CurrentUser\MY\C33B6C432C25581601B84C80F86EC2809DC224E8

Upload certificate from the user store matching the thumbprint (above):

Execute the PowerShell script to publish

PowerShell c:\scripts\windowsazure\PublishCloudService.ps1 –environment Staging -serviceName myservicedns -storageAccountName mystoragedns -packageLocation c:\drops\app.publish\ContactManager.Azure.cspkg -cloudConfigLocation c:\drops\app.publish\ServiceConfiguration.Cloud.cscfg

Example 1: publish to a staging environment on the same service before performing a VIP swap

PowerShell c:\scripts\windowsazure\PublishCloudService.ps1 –environment Production -serviceName testservicedns -storageAccountName mystoragedns -packageLocation c:\drops\app.publish\ContactManager.Azure.cspkg -cloudConfigLocation c:\drops\app.publish\ServiceConfiguration.Cloud.cscfg

Example 2: publish to a test environment in a separate cloud service

demo

Publish using PowerShell

Continuous deployment (CD)

Configuring TFS build (on-premise)

Create a build definition Leverage existing TFS server and build agentsSet MSBuild ArgumentsWire up PowerShell script in process template workflow (XAML)Set Azure specific process properties (cloud service, storage account, publish settings, locations, etc)

demo

Publish using TFS (on prem)

Continuous deployment (CD)

Configuring TFS elastic build service (cloud)Set up TFS publishing in Azure portal

Wizard does this for youEnables communication between TFS and Azure using OAuthCreates a build definition with Azure process template & activitiesSets the solution to build if one exists in depotSets Continuous Integration trigger (i.e. build/deploy on check-in)

What you can doCustomize triggerCustomize solution to build and solution configOverride all cloud specific properties

demo

Publish using Team Foundation Service (tfspreview.com)

Continuous deployment (CD)

Summary

Automation of complete Cloud Services delivery process Integrates with overall software app dev lifecycleFlexible to your unique environments

Complete guidance & code available:On-premise: https://www.windowsazure.com/en-us/develop/net/common-tasks/continuous-delivery/#step1 Team Foundation Service: https://www.windowsazure.com/en-us/develop/net/common-tasks/publishing-with-tfs/

Related Content

Breakout Sessions:

DEV362 -- From Development to Production: Optimizing for Continuous Delivery (Tues 1:30pm, Jamie Cool) AZR205 -- App Deployment Options for Windows Azure (Tues 5pm, Vishal Joshi)DEV314 -- Azure Development Using Visual Studio (Thurs 10:15am, Paul Yuknewicz)

Visual Studio

Product Demo Stations

Find Me Later At…

Product Demo Stations (Visual Studio) or email [email protected]

DEV Track Resources

Visual Studio Home Page :: http://www.microsoft.com/visualstudio/en-us

Jason Zander’s Blog :: http://blogs.msdn.com/b/jasonz/

Facebook :: http://www.facebook.com/visualstudio

Twitter :: http://twitter.com/#!/visualstudio

Somasegar’s Blog :: http://blogs.msdn.com/b/somasegar/

Resources

Connect. Share. Discuss.

http://northamerica.msteched.com

Learning

Microsoft Certification & Training Resources

www.microsoft.com/learning

TechNet

Resources for IT Professionals

http://microsoft.com/technet

Resources for Developers

http://microsoft.com/msdn

Complete an evaluation on CommNet and enter to win!

MS Tag

Scan the Tagto evaluate thissession now onmyTechEd Mobile

© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to

be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS

PRESENTATION.