Architect training alm

46

Transcript of Architect training alm

Page 1: Architect training   alm
Page 2: Architect training   alm

Windows® Azure™

Application Lifecycle Management for Windows Azure ProjectsEnterprise Strategy Worldwide Azure Team [ESWAT]

Page 3: Architect training   alm

Module OutlineLesson 1: IntroductionLesson 2: BuildLesson 3: DeploymentLesson 4: TestingLesson 5: Operations

Page 4: Architect training   alm

Lesson 1: Introduction

Page 5: Architect training   alm

Application Lifecycle Management

Application Lifecycle Management (ALM) is a continuous process of managing the life of an application through governance, development and maintenance.

Governance

Requirements

Specification

Architecture

Design

Development

Build

Testing

Deployment

Operations

Page 6: Architect training   alm

Typical Activities

Build

Compile

Configure

Package

Deployment

Upload

Install

Verify

Testing

Functional Test

Acceptance Test

Load Test

Operations

Monitor

Manage

Support

Page 7: Architect training   alm

Windows Azure Environment Concepts

Billing

Subscription

Service

Deployment

Role

Instance

Unit of Payment

Unit of Management

Two slots: Production & Staging

Represents a single application

Unit of Scaling

Running VM

Page 8: Architect training   alm

Typical Environments

Development Billing Account

Test SubscriptionDevelopment Subscription

Operations Billing Account

Operations Subscription

Production Service

Production Deployment

Staging Deployment

Test ServiceSandbox Service 2

UAT ServiceSandbox Service 1

Production Deploymen

t

Staging Deploymen

t

Production Deploymen

t

Staging Deploymen

t

Production Deploymen

t

Staging Deploymen

t

Production Deploymen

t

Staging Deploymen

t

Page 9: Architect training   alm

Lesson 2: Build

Page 10: Architect training   alm

Build and Deployment Overview

Code

TFSComputeEmulator

DeveloperWorkstation

Code

Build Server

Test Environment

Production Environment

Build

Deployment

Page 11: Architect training   alm

Build: Continuous Integration

CompileVerify – Run Unit Tests

Ideally, this is not different than traditional CI, since Unit Tests should be testing classes, not integration.

Page 12: Architect training   alm

Build: Daily Build

CompileVerify – Run Unit TestsUpdate ConfigurationPackage… continue with Deploy

Page 13: Architect training   alm

Tools of the Trade

MSBuild targetsAzure SDK includes targets for packagingCustomize .ccproj files or write your own MSBuild scriptsCan be integrated with TFS Build or 3rd party ALM tools

TFS-specificCustom XAML build processCustom activities

ScriptsPowerShell

Page 14: Architect training   alm

Build: Update Configuration

Most applications require different configuration for each environment

Connection Strings, VM sizes and instances, Dependent system URIs, etc.

Changes to configuration should be controlledPer-environment settings checked in to source controlAutomatically applied for target environment as part of build server

Page 15: Architect training   alm

Build: Update Configuration

Understand where your configuration lives

ServiceConfiguration.cscfg is outside of the deployed package – can be applied after packagingWeb.config and ServiceDefinition.csdef are inside the package – must my applied before packaging

Transformation approachesWeb.config transforms, TransformXml target to apply to custom filesXSLTCustom approaches

Package

web.config

ServiceDefinition.csdef

assemblies

ServiceConfiguration.cscfg

Page 16: Architect training   alm

Build: Create the deployment package

Windows Azure applications are deployed as an encrypted package (*.cspkg)Automatically created by Visual Studio when you publishCSPACK command line tool Easiest approach for automated builds: CorePublish targetWatch out for application dependencies

GAC’d AssembliesSecondary web sites

Page 17: Architect training   alm

Lesson 3: Deployment

Page 18: Architect training   alm

Deploy: To the Cloud

To one or more target environments (Test, Production)Ideally executed as a part of daily build Normally implemented via PowerShell scripts using Azure cmdlets, triggered from MSBuildRequires Azure Management Certificate deployed to build server

MSBuildPowerShell

Deploy Script

Azure cmdlets

Azure Management

API

Windows Azure

Deployments

.cspkg.cscfg

Page 19: Architect training   alm

Deploy: To the Cloud

Typical stepsDeploy service certificatesUpload package to Blob StorageDeploy package + ServiceConfiguration to Staging slotRun automatic verification testsFlip Staging to ProductionStop and delete Staging deployment

To save money, delete unused deployments when no longer needed (Staging and Production)

Page 20: Architect training   alm

Deploy: WebDeploy?

Allows code to be uploaded to the cloud without going through a full deployment process

New code is there in seconds, not 10-30 minutesOK for developers to test/troubleshoot in the cloudNot recommended for test or production environments

Only supported for web roles, not worker rolesOnly supports 1 instance per roleChanges are not durable

Page 21: Architect training   alm

Complete Build and Deploy Process

Page 22: Architect training   alm

Example: Targets in .ccproj project file

<PropertyGroup><PackageName>$(AssemblyName).cspkg</PackageName><ServiceConfigName>ServiceConfiguration.cscfg</ServiceConfigName><PackageLocation>$(OutDir)Publish</PackageLocation></PropertyGroup><Target Name="AzureDeploy" AfterTargets="Build" DependsOnTargets="CorePublish" Condition="$(AzureDeployEnvironment)!=''"><Exec WorkingDirectory="$(MSBuildProjectDirectory)" Command=" $(windir)\system32\WindowsPowerShell\v1.0\powershell.exe -f \build\AzureDeploy.ps1 $(AzureSubscriptionID) $(AzureCertificateThumbprint) $(PackageLocation)$(PackageName) $(ServiceConfigName)$(AzureHostedServiceName) $(AzureStorageAccountName)" /></Target>

Page 23: Architect training   alm

Example: Deployment Script

$hostedService = Get-HostedService $servicename -Certificate $cert -SubscriptionId $sub | Get-Deployment -Slot Staging

if ($hostedService.Status -ne $null) { $hostedService | Set-DeploymentStatus 'Suspended' |

Get-OperationStatus -WaitToComplete $hostedService | Remove-Deployment | Get-OperationStatus

-WaitToComplete}Get-HostedService $servicename -Certificate $cert -SubscriptionId $sub

| New-Deployment Staging -package $package -configuration $config -label $buildLabel -serviceName $servicename -StorageServiceName $storageAccount | Get-OperationStatus -

WaitToCompleteGet-HostedService $servicename -Certificate $cert -SubscriptionId $sub | Get-Deployment -Slot Staging | Set-DeploymentStatus 'Running' | Get-OperationStatus -WaitToComplete

Page 24: Architect training   alm

Example: Build Definition

/p:AzureDeployEnvironment="Test" /p:AzureSubscriptionID="847d5f81-1111-2222-9984-af8c008ba1b7" /p:AzureCertificateThumbprint="A38242009E0A1A4DDC0000111122220D943C98E8" /p:AzureHostedServiceName="myservice" /p:AzureStorageAccountName="mystorage"

Page 25: Architect training   alm

Deploy: To the Compute Emulator

Why?Can be used for Unit Tests testing more than just classes (integration tests)Can be used for Functional Testing on internal servers (but cloud normally makes more sense)

How?Package to .csx folder using CSPACK /copyOnly or CorePackageComputeService MSBuild targetStop and start the Compute Emulator using CSRUN Allow external browsers to access the emulator using a port redirector tool

Page 26: Architect training   alm

Deploy: To SQL Azure

Developers should have their own SQL Server sandbox.Use VSDB (“Data Dude”) to manage scripts for the SQL Server database.Challenge: VSDB doesn’t fully support SQL Azure syntax differences / limitations. Solutions:

Use Data Tier Application (DAC) project typeGenerate scripts using SQL Management StudioMigrate scripts / data using SQL Azure Migration Wizard from CodePlexTweak SQL Server scripts by hand

Scripts can be executed as a part of deploymentUse CREATE DATABASE AS COPY for backup

Page 27: Architect training   alm

Lesson 4: Testing

Page 28: Architect training   alm

Functional Test: In the Cloud

Whereas functional testing can be performed on the Compute Emulator, it will also have to be run later in the cloud.Normally executed as automated User Interface tests, run on local servers accessing the cloud.A subset of functional tests (“Build Verification Tests”) can be run after deployment to the staging slot before flipping into production.

Page 29: Architect training   alm

Load Test: Key Decisions

Where to generate the load?In the cloud

No latencyProvision and scale on-demandLow bandwidth costs

Outside the cloudRealistic latencyFull controlHigher Bandwidth costs

What tools to use?Custom developed toolsTraditional load testing products

e.g. Visual Studio 2010

SaaS offeringse.g. SOASTA

Page 30: Architect training   alm

Visual Studio Load Testing from the Cloud

DecisionsWhere to run Visual Studio, Controller, Agents, DatabaseVM Role versus Worker Role

Communication between cloud and on-premises environment

Windows Azure Connect configurationProvisioning sequenceFirewallsLatency

Local user accounts and password synchronisation

Page 31: Architect training   alm

Visual Studio Load Testing from the Cloud Internal Systems Windows Azure

ApplicationVisual Studio Test Controller

Test Agent

Report Data

Test Data

Performance Data

Test

Test

Test

Page 32: Architect training   alm

Lesson 4: Operations

Page 33: Architect training   alm

Storage

Servers

Networking

O/S

Middleware

Virtualization

Data

Applications

Runtime

Storage

Servers

Networking

O/S

Middleware

Virtualization

Data

Applications

Runtime

You

man

ag

e

Man

ag

ed

by v

en

dor

Man

ag

ed

by v

en

dor

You

man

ag

e

You

man

ag

eStorage

Servers

Networking

O/S

Middleware

Virtualization

Applications

Runtime

Data

Man

ag

ed

by v

en

dor

Storage

Servers

Networking

O/S

Middleware

Virtualization

Applications

Runtime

Data

(On-Premises)Infrastructure

(as a Service)Platform(as a Service)

Software(as a Service)

Operations for Cloud Applications

Page 34: Architect training   alm

Monitor

Monitor the Azure Service Dashboard for general availability.Use System Center Operations Manager Windows Azure Management Pack to monitor instance and app health

Cerebrata Diagnostics Manager is an alternative.Develop synthetic transactions to monitor that the whole application is up end-to-end.Use Dynamic Management Views to monitor SQL Azure.

Page 35: Architect training   alm

Monitor: Diagnostics

Role Instance

Trace Listeners,Instrumentation

Remote Desktop

Blob

Azure Storage DiagnosticMonitorTraceListener

System CenterOperations Manager

3rd Party Tools

Visual Studio

Scheduled Transfers

Page 36: Architect training   alm

System Center Operations Manager

Page 37: Architect training   alm

Cerebrata Azure Diagnostics Manager

Page 38: Architect training   alm

Manage: Authentication

Implement policies and routines for handling: Windows Live ID credentials for Azure management portalManagement Certificates

Minimize access to Azure management portalUse tools based on Management APICertificates secured using corporate user accounts

Use different subscriptions for dev/test and production

Page 39: Architect training   alm

Windows Azure Platform Management Tool

Page 40: Architect training   alm

Manage: Scaling

Windows Azure’s “elasticity” allows applications to be scaled up and down based on demandPlatform directly supports manual scaling from portal or APIsAutomated scaling can be built easily on top of APIs

Time-Based: E.g. console application triggered from Windows SchedulerResource-Based: Worker role that monitors KPIs such as performance counters and adds/removes instances when needed.

Page 41: Architect training   alm

Web RoleIN_3

Resource-based Autoscaling

Web RoleIN_2

Web RoleIN_1

Web RoleIN_0

Azure Storage Tables

Performance Counters

AutoscalerWorker Role

Azu

re M

anagem

ent

API

Scale up/down

Read

+1

-1 Sample Period

Analyze

Page 42: Architect training   alm

SummaryBuild

Compile

Configure

Package

Deployment

Upload

Install

Verify

Testing

Functional Test

Acceptance Test

Load Test

Operations

Monitor

Manage

Support

Page 43: Architect training   alm

Resources

Page 44: Architect training   alm

Resources

Using MSBuild to deploy to multiple Windows Azure environments:http://blogs.msdn.com/b/tomholl/archive/2011/02/23/using-msbuild-to-deploy-to-multiple-windows-azure-environments.aspx

Azure Management Pack for SCOM:http://www.microsoft.com/downloads/en/details.aspx?FamilyID=4f05f282-f23a-49da-8133-7146ee19f249

Monitoring SQL Azure:http://msdn.microsoft.com/en-us/library/ff394114.aspx

Overall Management of SQL Azure:http://msdn.microsoft.com/en-us/library/ff394116.aspx

Overall dashboard of Azure status worldwide:http://www.microsoft.com/windowsazure/support/status/servicedashboard.aspx

SQL Azure Backup and Restore:http://social.technet.microsoft.com/wiki/contents/articles/sql-azure-backup-and-restore-strategy.aspx

Cerebrata Diagnostics Manager:http://www.cerebrata.com/products/AzureDiagnosticsManager/Default.aspx

Page 45: Architect training   alm

Questions?

Page 46: Architect training   alm

© 2011 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.