wade wegner windows azure technical evangelist microsoft corporation real world windows azure...

31
Wade Wegner Windows Azure Technical Evangelist Microsoft Corporation Real World Windows Azure Development – Tips & Tricks

Post on 20-Dec-2015

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Wade Wegner Windows Azure Technical Evangelist Microsoft Corporation Real World Windows Azure Development – Tips & Tricks

Wade WegnerWindows Azure Technical EvangelistMicrosoft Corporation

Real World Windows Azure Development – Tips & Tricks

Page 2: Wade Wegner Windows Azure Technical Evangelist Microsoft Corporation Real World Windows Azure Development – Tips & Tricks

Role EnhancementsUsing RDP with Windows AzureStartup TasksExternalizing StateFull IIS SupportDynamic DeploymentVirtual Machine RoleWindows Azure Toolkit for WP7…Demos, demos, demos!

Agenda

Page 3: Wade Wegner Windows Azure Technical Evangelist Microsoft Corporation Real World Windows Azure Development – Tips & Tricks

I will post all code and details here:

http://www.wadewegner.com/

Additional Information

Page 4: Wade Wegner Windows Azure Technical Evangelist Microsoft Corporation Real World Windows Azure Development – Tips & Tricks

Additional control and flexibility on the Windows Azure environment and simplified migration of existing Windows applications to Windows Azure.

Windows Server 2008 R2 & IIS 7.5Admin Access: Full administrative access to your role instancesReboot/Re-image support: Ability to easily reboot or re-image your instancesRemote Desktop: Ability to use Remote Desktop with any Role type (Web, worker, VM)Network Modeling

Well Known Ports: Easier to bring your existing applications to Windows AzurePort Ranges: for “inbound traffic” (as opposed to 5 in the past)Network Filters: Enable traffic filtering between roles within a service

Improved AutomationStartup Tasks: Includes scripts that automate the preparation and configuration of roles Role Plugins: Ability to easily include “plug-ins” in the service definition(e.g., built-in: remote desktop, virtual network, diagnostics. More samples to come)

Role Enhancements

Page 5: Wade Wegner Windows Azure Technical Evangelist Microsoft Corporation Real World Windows Azure Development – Tips & Tricks

Portal integrated Remote Desktop access to instances within your deploymentUse standard Remote Desktop clientSupport for all three role types – Web, worker, and VMDynamic configuration of Remote Desktop settings

CredentialsEnable/DisableExpiration of credentials

Ability to take instances on/off the load balancer for debugging

RDP with Windows Azure

Page 6: Wade Wegner Windows Azure Technical Evangelist Microsoft Corporation Real World Windows Azure Development – Tips & Tricks

DEMO

Configuring and Using RDP

Page 7: Wade Wegner Windows Azure Technical Evangelist Microsoft Corporation Real World Windows Azure Development – Tips & Tricks

Simple way to run code during your Windows Azure role’s initializationUpdate the ServiceDefinition.csdef file:

<Startup> <Task commandLine="startup.cmd“ executionContext="elevated" /> </Startup>

Add the command to the package

Startup Tasks

Page 8: Wade Wegner Windows Azure Technical Evangelist Microsoft Corporation Real World Windows Azure Development – Tips & Tricks

Simple (Default): (Synchronous) In this case the task is launched and forward progress in the instance is blocked until the task is complete.Background: (Asynchronous Fire and Forget) In this case the task is launched and role starts up continues. Foreground: (Asynchronous) Similar to Background, but role shutdown can only happen when all the foreground tasks exit.

Startup Task Types

Page 9: Wade Wegner Windows Azure Technical Evangelist Microsoft Corporation Real World Windows Azure Development – Tips & Tricks

Create batch files to execute your commandsBe sure to save as “Unicode (UTF8 without signature) codepage 65001” in Visual Studio (or use NotePad)

Tip #1: Batch files

Page 10: Wade Wegner Windows Azure Technical Evangelist Microsoft Corporation Real World Windows Azure Development – Tips & Tricks

If you put start /w cmd in a batch file, it will pop up a new command window and wait for it to exit

start /w "%~dp0\YourCommand.cmd"

Useful for testing startup tasks locally

Tip #2: Debug locally

Page 11: Wade Wegner Windows Azure Technical Evangelist Microsoft Corporation Real World Windows Azure Development – Tips & Tricks

“Simple” startup tasks (the default type) run to completion before putting the VM in the ready state

If your startup tasks fails, you can’t RDP to connect and debug

For development, set the startup type to “background”

Then you can RDP in and see what’s happening

Tip #3: Background tasks

Page 12: Wade Wegner Windows Azure Technical Evangelist Microsoft Corporation Real World Windows Azure Development – Tips & Tricks

Try to log to a file whenever possible, because sometimes you can’t RDP in fast enough to watch

command1 >> log.txt 2>> err.txtcommand2 >> log.txt 2>> err.txt...

Tip #4: Log to a file

Page 13: Wade Wegner Windows Azure Technical Evangelist Microsoft Corporation Real World Windows Azure Development – Tips & Tricks

You need to configure PowerShell to execute unsigned PowerShell scriptsPowerShell 2.0

powershell -ExecutionPolicy Unrestricted ./myscript.ps1

PowerShell 1.0

reg add HKLM\Software\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell /v ExecutionPolicy /d Unrestricted /f

Tip #5: PowerShell scripts

Page 14: Wade Wegner Windows Azure Technical Evangelist Microsoft Corporation Real World Windows Azure Development – Tips & Tricks

When installing 32-bit applications in a 64-bit environment, as an elevated startup tasks, the system can get confusedThe installer will use the wrong “Local AppData” folder

md "%~dp0appdata“

reg add "hku\.default\software\microsoft\windows\currentversion\explorer\user shell folders" /v "Local AppData" /t REG_EXPAND_SZ /d "%~dp0appdata" /f…reg add "hku\.default\software\microsoft\windows\currentversion\explorer\user shell folders" /v "Local AppData" /t REG_EXPAND_SZ /d %%USERPROFILE%%\AppData\Local /f

Tip #6: 32-bit Installers

Page 15: Wade Wegner Windows Azure Technical Evangelist Microsoft Corporation Real World Windows Azure Development – Tips & Tricks

PsExec makes it easy to launch your scripts as the system user when RDP’d into the VM

psexec –s -i cmd

Tip #7: PsExec & sys user

Page 16: Wade Wegner Windows Azure Technical Evangelist Microsoft Corporation Real World Windows Azure Development – Tips & Tricks

DEMO

Windows Azure Encoder

Page 17: Wade Wegner Windows Azure Technical Evangelist Microsoft Corporation Real World Windows Azure Development – Tips & Tricks

Windows Azure storage?SQL Azure?…Windows Azure AppFabric Caching

Externalizing State

Page 18: Wade Wegner Windows Azure Technical Evangelist Microsoft Corporation Real World Windows Azure Development – Tips & Tricks

DEMO

Externalizing Session State with Windows Azure AppFabric Caching

Page 19: Wade Wegner Windows Azure Technical Evangelist Microsoft Corporation Real World Windows Azure Development – Tips & Tricks

Easy to setup and no managementSimply API that’s symmetric to Windows Service AppFabric CachingUseful scenarios:

Session StatePage Output CachingExplicit Caching (e.g. reference, activity, resource data)

Takeaways

Page 20: Wade Wegner Windows Azure Technical Evangelist Microsoft Corporation Real World Windows Azure Development – Tips & Tricks

Leverage the ecosystem of IIS applications, programming languages tools, and components with the revamped Web role

Multiple Web sites and applicationsImproved iterative local development with the Development FabricIterative cloud development with Web Deploy and IIS ManagerHost level configuration, including native modulesEnhanced by Windows Azure automated service management

Full IIS Support

Page 21: Wade Wegner Windows Azure Technical Evangelist Microsoft Corporation Real World Windows Azure Development – Tips & Tricks

Extend the Service Model

Page 22: Wade Wegner Windows Azure Technical Evangelist Microsoft Corporation Real World Windows Azure Development – Tips & Tricks

DEMO

Multiple Applications in IIS

Page 23: Wade Wegner Windows Azure Technical Evangelist Microsoft Corporation Real World Windows Azure Development – Tips & Tricks

With the Windows Azure SDK 1.3 (or higher) you now have Full IIS support

Multiple sitesVirtual applicationsVirtual directories

Extend the Service Model

Takeaways

Page 24: Wade Wegner Windows Azure Technical Evangelist Microsoft Corporation Real World Windows Azure Development – Tips & Tricks

DEMO

Dynamic Deployment

Page 25: Wade Wegner Windows Azure Technical Evangelist Microsoft Corporation Real World Windows Azure Development – Tips & Tricks

VM Role provides additional control and flexibility on the Windows Azure environment, and makes it easy to run existing Windows applications on Windows Azure.

Developers / IT Pros have full control over the OS imageAbility to upload your own customized WS08R2 Enterprise imagesOperators can reboot, reimage and Remote Desktop

Virtual Machine Role

Page 26: Wade Wegner Windows Azure Technical Evangelist Microsoft Corporation Real World Windows Azure Development – Tips & Tricks

“… let me restate that the only reasonto use them instead of worker roles is… for the migration of WindowsServer applications that have long,non-scriptable or fragile installationsteps.”

“… While the VM role offers additional control and flexibility, the Windows Azure Web and Worker roles offer additional benefits over the VM role.”

Mark Russinovich: VM Role

Page 27: Wade Wegner Windows Azure Technical Evangelist Microsoft Corporation Real World Windows Azure Development – Tips & Tricks

DEMO

VM Role

Page 28: Wade Wegner Windows Azure Technical Evangelist Microsoft Corporation Real World Windows Azure Development – Tips & Tricks

Designed to make it easier for WP7 developers to use Windows AzureIncludes

Project templatesClass librariesServices (e.g. push notification, membership, & storage)SamplesDocumentation

Get it: http://watoolkitwp7.codeplex.com

WAZ Toolkit for WP7

Page 29: Wade Wegner Windows Azure Technical Evangelist Microsoft Corporation Real World Windows Azure Development – Tips & Tricks

Understand the Cloud fundamentalsKnow what makes up the Windows Azure PlatformGo build some applications!

Session Takeaways

Page 30: Wade Wegner Windows Azure Technical Evangelist Microsoft Corporation Real World Windows Azure Development – Tips & Tricks

Q&A

Page 31: Wade Wegner Windows Azure Technical Evangelist Microsoft Corporation Real World Windows Azure Development – Tips & Tricks

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