Microsoft Azure Essentials: Azure Web Apps for Developers

[Pages:126]Azure Web Apps for Developers

Microsoft Azure Essentials

Rick Rainey

Visit us today at



?Hundreds of titles available ? Books, eBooks, and online resources from industry experts

? Free U.S. shipping ?eBooks in multiple formats ? Read on your computer,

tablet, mobile device, or e-reader ?Print & eBook Best Value Packs ?eBook Deal of the Week ? Save up to 60% on featured titles ?Newsletter and special offers ? Be the first to

hear about new releases, specials, and more ?Register your book ? Get additional benefits

Hear about it first.

Get the latest news from Microsoft Press sent to your inbox. ? New and upcoming books ? Special offers ? Free eBooks ? How-to articles Sign up today at Newsletters

Wait, there's more...

Find more great content and resources in the Microsoft Press Guided Tours app.

The Microsoft Press Guided Tours app provides insightful tours by Microsoft Press authors of new and evolving Microsoft technologies. ? Share text, code, illustrations, videos, and links with

peers and friends ? Create and manage highlights and notes ? View resources and download code samples ? Tag resources as favorites or to read later ? Watch explanatory videos ? Copy complete code listings and scripts

Download from

Windows Store

PUBLISHED BY Microsoft Press A division of Microsoft Corporation One Microsoft Way Redmond, Washington 98052-6399 Copyright ? 2015 Microsoft Corporation. All rights reserved. No part of the contents of this book may be reproduced or transmitted in any form or by any means without the written permission of the publisher. ISBN: 978-1-5093-0059-4 Microsoft Press books are available through booksellers and distributors worldwide. If you need support related to this book, email Microsoft Press Support at mspinput@. Please tell us what you think of this book at . This book is provided "as-is" and expresses the authors' views and opinions. The views, opinions, and information expressed in this book, including URL and other Internet website references, may change without notice. Unless otherwise noted, the companies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted in examples herein are fictitious. No association with any real company, organization, product, domain name, e-mail address, logo, person, place, or event is intended or should be inferred. Microsoft and the trademarks listed at on the "Trademarks" webpage are trademarks of the Microsoft group of companies. All other marks are property of their respective owners. Acquisitions, Developmental, and Project Editor: Devon Musgrave Editorial Production: nSight, Inc. Copyeditor: Ann Weaver Cover: Twist Creative

1

Table of Contents

Foreword ....................................................................................................................................................................................... 6 Introduction .................................................................................................................................................................................7

Who should read this book ......................................................................................................................................................... 7 Assumptions .................................................................................................................................................................................. 7

This book might not be for you if.............................................................................................................................................8 Organization of this book ............................................................................................................................................................ 8 Conventions and features in this book ................................................................................................................................... 9 System requirements ...................................................................................................................................................................... 9 Acknowledgments ........................................................................................................................................................................ 10 Errata, updates, & support ........................................................................................................................................................ 10 Free ebooks from Microsoft Press.......................................................................................................................................... 10 Free training from Microsoft Virtual Academy ................................................................................................................. 11 We want to hear from you........................................................................................................................................................ 11 Stay in touch ................................................................................................................................................................................... 11 Chapter 1 Microsoft Azure Web Apps .............................................................................................................................. 12 Introduction to Azure Resource Groups .............................................................................................................................. 12 Introduction to App Service Plans.......................................................................................................................................... 13 Create an Azure Web App using the Azure portal.......................................................................................................... 15

Create a Web App and SQL Database ............................................................................................................................. 15 Add an Azure Redis Cache to the Azure Resource Group....................................................................................... 19 Create an Azure Web App using Visual Studio ................................................................................................................ 21 Create a Web App by using Server Explorer ................................................................................................................. 21 Create a Web App by using the Web Application template ............................................................... 24 Create a Web App using the Azure Resource Group template............................................................................. 26 Connection strings and application settings...................................................................................................................... 34 Set connection strings and app settings in the environment ................................................................................ 34 Retrieve connection strings and app settings from the environment ................................................................ 36 How connection strings and app settings are stored in the environment ....................................................... 37

2

Add a deployment slot for an Azure Web App.................................................................................................................38 Scale to a Standard App Service Plan ...............................................................................................................................39 Add a deployment slot ...........................................................................................................................................................40

Set up continuous deployment with Visual Studio Online ...........................................................................................41 Introduction to Visual Studio Online ................................................................................................................................41 Set up deployment from source control to a staging slot .......................................................................................43 Add Visual Studio solution to source control................................................................................................................45 Commit Visual Studio solution to source control ........................................................................................................45

Role Based Access Control .........................................................................................................................................................46 Subscription-level roles ..........................................................................................................................................................47 Resource-level roles .................................................................................................................................................................48

Summary ...........................................................................................................................................................................................49 Chapter 2 Azure WebJobs .................................................................................................................................................... 50

Introduction to Azure WebJobs...............................................................................................................................................50 Create an Azure WebJob............................................................................................................................................................51

Publish a web job from Visual Studio...............................................................................................................................52 Invoke a web job manually...................................................................................................................................................54 View the WebJobs Dashboard.............................................................................................................................................54 Create a web job from the Azure portal ..............................................................................................................................55 Introduction to the Azure WebJobs SDK .............................................................................................................................57 WebJobs SDK .NET libraries and dependencies ...........................................................................................................58 Create a web job designed for use with Azure Storage Queues...........................................................................58 Examine the web job project and code ...........................................................................................................................60 Publish a web job to Azure ...................................................................................................................................................64 Examine new features in the WebJobs Dashboard.....................................................................................................65 Summary ...........................................................................................................................................................................................68 Chapter 3 Scaling Azure Web Apps ................................................................................................................................... 69 Scale Up.............................................................................................................................................................................................69 Scale Out ...........................................................................................................................................................................................71 Dealing with the challenges of scaling out a web app..............................................................................................71

3

Scaling web apps using Autoscale ......................................................................................................................................... 73 Autoscale based on CPU percentage ............................................................................................................................... 73 Autoscale based on a recurring schedule ...................................................................................................................... 74 Understanding Autoscale rules........................................................................................................................................... 77 Turn off Autoscale.................................................................................................................................................................... 79

Scale globally with Azure Traffic Manager ......................................................................................................................... 79 Create a Traffic Manager profile ........................................................................................................................................ 81 Additional services for achieving massive scale........................................................................................................... 83

Scaling WebJobs............................................................................................................................................................................ 83 Summary........................................................................................................................................................................................... 84 Chapter 4 Monitoring and diagnostics ............................................................................................................................. 86 Introduction to diagnostic logs............................................................................................................................................... 86

Enable application and site diagnostic logs .................................................................................................................. 88 Store log files in the web app file system....................................................................................................................... 88 Store log files in Azure Storage .......................................................................................................................................... 89 Access and download diagnostic log files .......................................................................................................................... 91 Access log files stored in the web app file system...................................................................................................... 91 Access log files from Azure Storage ................................................................................................................................. 95 Log streaming................................................................................................................................................................................. 96 Log streaming using Visual Studio.................................................................................................................................... 96 Log streaming using command-line tools ..................................................................................................................... 97 Remote debugging ...................................................................................................................................................................... 98 Diagnostics as a Service (DaaS) .............................................................................................................................................100 Install the Diagnostics as a Service site extension.....................................................................................................100 Run DaaS.................................................................................................................................................................................... 101 View DaaS analysis reports ................................................................................................................................................. 102 Site Admin Tools/Kudu.............................................................................................................................................................105 Install the Site Admin Tools/Kudu ................................................................................................................................... 105 Run the Site Admin Tools ................................................................................................................................................... 105 Monitor web app endpoints externally using web tests.............................................................................................109

4

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download