0% found this document useful (0 votes)
213 views

Module 5 - Implementing Azure App Service

The document provides an overview of Module 5 which covers implementing Azure App Service. It includes 7 lessons that teach how to use App Service to create and manage web, mobile, and API apps. The module objectives are to explain the different app types in App Service, select deployment options, deploy apps using various methods, configure web apps and use WebJobs, and monitor performance. A demonstration prepares the Azure environment for the module labs.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
213 views

Module 5 - Implementing Azure App Service

The document provides an overview of Module 5 which covers implementing Azure App Service. It includes 7 lessons that teach how to use App Service to create and manage web, mobile, and API apps. The module objectives are to explain the different app types in App Service, select deployment options, deploy apps using various methods, configure web apps and use WebJobs, and monitor performance. A demonstration prepares the Azure environment for the module labs.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 91

6/1/2017 Module 5: Implementing Azure App Service

Module 5: Implementing Azure App Service

Contents:

Module Overview

Lesson 1: Introduction to App Service

Lesson 2: Planning app deployment in App Service

Lesson 3: Implementing and maintaining web apps

Lesson 4: Configuring web apps

Lesson 5: Monitoring web apps and WebJobs

Lesson 6: Implementing mobile apps

Lesson 7: Traffic Manager

Lab: Implementing web apps

Module Review and Takeaways

Module Overview

You can use Microsoft Azure Infrastructure as a Service (IaaS) virtual machines for a wide
range of purposes, including hosting web apps by using Internet Information Services (IIS).
However, Azure also includes a specialized Azure App Service that you can use to host web
apps, mobile apps, and application programming interface (API) apps without configuring a
virtual machine and the associated platform software. When you use App Service, you can
create a web app or choose from a wide range of common web applications, including
WordPress, Drupal, Umbraco, and others. Alternatively, you can upload a custom web
application from Microsoft Visual Studio or another web developer tool. In this module, you
will learn how to implement and manage highly scalable app services.
https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 1/91
6/1/2017 Module 5: Implementing Azure App Service

Objectives

After completing this module, you will be able to:

• Explain the different types of apps that you can create by using App Service.

• Select an App Service plan and a deployment method for apps in Azure.

• Use Visual Studio, File Transfer Protocol (FTP) clients, and Azure PowerShell to deploy
web and mobile apps to Azure.

• Configure web apps and use the Azure WebJobs feature to schedule tasks.

• Monitor the performance of web apps.

• Create and configure mobile apps.

• Use Azure Traffic Manager to distribute requests between two or more app services.

Lesson 1: Introduction to App Service

There is an increasing demand for organizations to deliver great mobile and web apps that
engage and connect with their customers. Furthermore, these apps have to work on any
device and should be able to consume and integrate with data from anywhere. App Service
provides a powerful platform that integrates everything that companies need to build web and
mobile apps that can work on any device. These apps can integrate easily with other Software
as a Service (SaaS) apps, such as Microsoft Office 365, Microsoft OneDrive for Business,
Facebook, and more, or connect with enterprise on­premises apps, such as SAP, Oracle, and
others.

In this lesson, you will learn about the features of App Service.

Lesson Objectives
After completing this lesson, you will be able to:

• Describe the components of App Service.
https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 2/91
6/1/2017 Module 5: Implementing Azure App Service

• Describe the Web Apps feature in App Service.

• Describe the Mobile Apps feature in App Service.

• Describe the Logic Apps feature in App Service.

• Describe the API Apps feature in App Service.

• Describe the functionalities of the App Service Environment for PowerApps.

Demonstration: Preparing the Azure environment
Perform this demonstration’s tasks, so that you prepare the lab environment. While the
environment is being configured, this module will describe the Azure services that you will use
in the lab.

Note: The scripts that in this course uses might delete objects that you have in your
subscription. Therefore, you should complete this course by using a new Azure
subscription. You should have received sign­up details and instructions for creating an
Azure learning pass, specifically for this purpose. Alternatively, you can create a new
Azure trial subscription. In both cases, use a new Microsoft account that is not
associated with any Azure subscription. This avoids confusion in the labs and in setup
scripts.

The labs in this course use custom Azure cmdlets in the Windows PowerShell command­line
interface, including Setup­Azure to prepare the Azure environment for a lab and Reset­Azure
to perform clean­up tasks at the end of a lab. Setup­Azure removes any current Azure
subscription and account details from the Azure­based Windows PowerShell session.

Before you start the lab preparation, your instructor will decide which Azure region is the
closest to your classroom location. You will need this information during the lab setup and the
lab.

In this demonstration, you will learn how to:

• Sign in to your Azure subscription.
https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 3/91
6/1/2017 Module 5: Implementing Azure App Service

• Prepare the Azure environment.

Demonstration Steps

Prepare the Azure environment

1. On the taskbar, right­click Windows PowerShell, and then click Run as administrator.
In the User Account Control dialog box, click Yes.

2. Type the following command, and then press Enter:

Setup-Azure

3. At the prompt, type the module number, and then press Enter.

4. Confirm your selection, and then press Enter.

5. When prompted, sign in by using the Microsoft account associated with your Azure
subscription.

6. When the script is complete, close Azure PowerShell.

Note: This script might remove Azure services in your subscription. We recommend
that you use an Azure trial pass that was provisioned specifically for this course, and
not your own Azure account.
The script will take approximately two or three minutes to configure your Azure
environment and make it ready for the lab at the end of this module.

Overview of App Service

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 4/91
6/1/2017 Module 5: Implementing Azure App Service

App Service provides a comprehensive platform for building cloud­based applications that
users can consume on any device. App Service provides a hosted service that developers can
use to build mobile and web apps. Additionally, developers can use this service to develop API
apps and use them for integrating SaaS apps by using logic apps, so that they can combine
business logic to achieve different functionalities in their apps. App Service is a new Azure
service that replaced the following Azure services: Azure Websites, Azure Mobile Services,
and Azure BizTalk Services. App Service now is a single integrated service, and has more
advanced features than its predecessors.

App Service provides the following features:

• Web Apps. Provides a common platform for developing, building, hosting, and managing
web apps.

• Mobile Apps. Provides a platform for building and supporting mobile applications that users
can consume on almost any device.

• API Apps. Provides a hosted service platform that can help developers to build, host, and
consume APIs easily that are developed by using known platforms, such as ASP.NET,
PHP, and Python.

• Logic Apps. Enables quick links between cloud­based apps, so that you can build connected
solutions.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 5/91
6/1/2017 Module 5: Implementing Azure App Service

Overview of Web Apps

The Web Apps feature is a platform of technologies that enable you to build web apps in
Azure without configuring and maintaining your own virtual machines. In Azure, you can run
web apps that are developed by using the ASP.NET, PHP, Node.js, and Python frameworks.
The Web Apps feature allows developers to use the same set of tools and frameworks to
create web apps, provide versioning of applications, update the apps with new functionality,
and have full monitoring functionality through the web apps’  lifecycle.

The Web Apps feature supports common programming languages, such as C#, HTML5, PHP,
Java, Node.js, and Python, and integrates easily with familiar tools such as Visual Studio or
GitHub.

The following are the key features of Web Apps:

• Gallery applications. You can use Azure Marketplace to choose from predefined solutions
for popular configurations, such as blogging sites, frameworks, ASP.NET starter apps, and
others. You can find the full selection of solutions in the Web Applications section of the
Marketplace at http://azure.microsoft.com/en­us/marketplace/web­applications/.

• Auto scaling. You can implement multiple instances of each web app to increase capacity
and ensure resilience. The Azure load balancer automatically distributes incoming requests

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 6/91
6/1/2017 Module 5: Implementing Azure App Service

between these instances. You also can configure the auto­scaling functionality to handle
incoming loads dynamically.

• Continuous integration. You can deploy the web app code from cloud source­control
systems, such as Visual Studio Online and GitHub, on­premises source­control systems,
such as Team Foundation Server (TFS) and Git, and from on­premises deployment tools,
such as Visual Studio, FTP clients, WebMatrix, and MSBuild. You also can use continuous
integration tools, such as Bitbucket, Hudson, or HP TeamSite to automate build, test, and
integration tests.

• Deployment slots. If you are using the Standard­tier plan for App Service, you can create
two or more slots for each web app. For example, you can create one slot for your
production web app, and then deploy your tested and accepted code there. You then can
create a second slot that is your staging environment, and deploy the new code to it to run
acceptance tests. The staging slot will have a different URL.

• Testing in production. When a new version of your staging­slot web app passes all the tests,
you can safely deploy it to the production site by swapping the slots. This also provides a
simple rollback path. If the new version causes unexpected problems, you can swap the
slots once again to revert to the old production site.

• Azure WebJobs. The WebJobs feature runs background processes for web apps, thereby
offloading most of the time­consuming and CPU­intensive tasks from the web apps. You
can perform common tasks, such as updating a database or moving log files, easily by using
WebJobs.

• Hybrid connections. You can implement hybrid connections from web and mobile apps in
Azure to access on­premises resources, such as SQL databases or other published
resources. By using the Hybrid connection manager, you can share the connection across
multiple web apps or mobile apps and can limit the TCP ports required to access your
network. You can also use the App Service Environment, which is a premium feature, to
integrate with an Azure virtual network. A common scenario in which you would use hybrid
connections is if your web app needs to access a database or a web service that is running
on a virtual machine that is hosted on an Azure virtual network.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 7/91
6/1/2017 Module 5: Implementing Azure App Service

Web apps often require two supporting services, data storage and file storage. The raw data
that the server­side code formats into a webpage and sends to the user often is in a database.
In Azure, you can use a SQL database to host that database. Alternatively, you can provision
a database on a virtual machine or use Azure table storage. Web apps often include media
files, such as images, videos, and sound files. Performance typically is improved if you do not
store these media files on a database. In Azure, you can use a storage account for these files.
An alternative is to use a virtual machine’s file system for file storage.

Overview of Mobile Apps

The Mobile Apps feature is a part of App Service, and it provides a platform for building and
supporting mobile applications. Mobile Apps solves common problems for developers who
create mobile­device apps. Common requirements of mobile apps include that they need to:

• Store and access structured data

• Receive notifications when events happen in the cloud

• Authenticate and authorize users based on Facebook, Twitter, Microsoft, or other identities

• Define business logic

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 8/91
6/1/2017 Module 5: Implementing Azure App Service

The Mobile Apps feature allows developers to build cross­platform apps that can run on
Windows, iOS, or Android. These apps can run solely in the cloud or connect with your on­
premises infrastructure for authentication and authorization purposes. Developers can user
more than 40 SaaS API connectors for integration with a variety of cloud apps. They can
benefit from the build­push notification engine that can send a large number of personalized
push notifications to almost any mobile device that is using iOS, Android, or Windows.

Mobile Apps has many similarities with Azure Mobile Services that Microsoft will continue to
support. However, Mobile Apps has more advantages when compared to Mobile Services,
including that it integrates with Office 365, Microsoft Dynamics CRM, Salesforce, and other
important SaaS apps. It supports Java and PHP back­end code and has built­in auto­scale and
load­balancing capabilities. It also supports multiple deployments slots for production and
testing. Mobile Apps also provides alerts and log files for monitoring and troubleshooting.
Additionally, the integration of Mobile Apps with New Relic provides deep insight into the
performance and reliability of mobile apps.

You can capitalize on all of the new features by migrating existing solutions, which you
developed with Mobile Services, to Mobile Apps in one of two ways:

• Migration. This process only changes the underlying environment without any code rewrite.
After you migrate the mobile apps, you can benefit from all the new features, such as
WebJobs, custom domain names, staging slots, auto scaling, and load balancing.

• Upgrade. This process is more complex because it requires code changes. This process
typically requires you to create a second mobile app instance, update the project to use the
new server software development kits (SDKs), and then release the new mobile app.

Overview of Logic Apps

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 9/91
6/1/2017 Module 5: Implementing Azure App Service

Logic apps automate a business process by enabling quick links between cloud­based apps,
such as Office365, Google Services, Salesforce, and many more. The Logic Apps feature
allows you to use a visual designer that you can combine with connectors from Azure
Marketplace for different integration scenarios.

Logic apps use a workflow engine to design business processes graphically, and then connect
them through connectors so that users can access data and required services. The functionality
of the connectors is based on the APIs that can trigger new instances of the workflow based
on a specific event. Each step in the workflow is an action that accesses data or services
through the connector. More advanced integration scenarios can use rules, transformations,
validations, and features that are part of BizTalk Services.

When you develop your solutions, you can use either core or enterprise integration
connectors. Some of the most common core APIs include:

• Office 365 Connector. Use this API to create an action that can send and receive emails,
and manage calendars and contacts for an Office 365 account.

• Microsoft OneDrive Connector. Use this API to create an action that can connect to your
personal Microsoft OneDrive and upload, delete, or list files.

• Microsoft Yammer Connector. Use this API to connect to your Yammer subscription to
post or get new messages.
https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 10/91
6/1/2017 Module 5: Implementing Azure App Service

• Facebook Connector. Use this API to connect to your Facebook account and publish
messages, pictures, get comments, and perform other actions.

• HTTP Connector. Use this API to open an HTTP listener to listen an incoming HTTP
request on a particular URL.

Enterprise­integration connectors can extend app services, and provide integration and
connectivity to SAP, Oracle, DB2, Informix, and other systems.

When you develop your solution, you also can use connectors as either poll or push triggers. A
common poll­trigger scenario is to integrate your apps when new data is available at a file
location, in Azure storage, or in a SQL database. Then you can use poll trigger to get that data
and use it in your app. You typically use push triggers to start a new instance of a logic app
when a specific event occurs.

Logic apps can include connectors that initiate an action. For example, you can use connectors
to write, update, or delete data from a storage account or some other linked app.

Additional Reading: For a list of supported connectors and API apps that you can
use in your logic apps, refer to: http://aka.ms/Bcinbr

The following procedure describes how to build a logic app that sends an email from your
Office 365 subscription on a recurring schedule:

1. Create the logic app:

a. Sign in to the Azure portal.
b. Click New, click Web+Mobile, and then click Logic App.
c. In the create logic app blade, fill in the following information, and then click
Create:

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 11/91
6/1/2017 Module 5: Implementing Azure App Service

▪ Name. Enter a descriptive name.
▪ App Service Plan. Select an existing App Service plan or create a new App
Service plan.
▪ Pricing Tier. Choose a pricing tier for your app.
▪ Resource Group. Select an existing resource group or create a new resource
group.
▪ Subscription. Select your Azure subscription.
▪ Location. Choose a datacenter that is closer to your location.
▪ Triggers and actions. Select predefined or create from scratch.

2. Create a trigger or action:

a. Select your logic app.
b. Select Recurrence API listed on the right side of the Azure portal.
c. In the Recurrence window, from the frequency drop­down list, select days, and
then in the Interval text box, type 1.
d. Select Office365 Connector from the list of APIs.
e. In the Office365 Connector Window, click Subscription, and then provide your
Office 365 credentials.
f. After you sign in, in the choose an action section, click Send Email.
g. Fill the To, Subject, and Body text boxes with the appropriate email address,
subject, and body text, and then click OK.

Overview of API Apps

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 12/91
6/1/2017 Module 5: Implementing Azure App Service

An API is a set of routines, protocols, and tools that developers use for building software
applications. An API specifies how software components should interact. APIs make building
blocks for developing apps. Developers often need to build APIs that they can reuse in their
projects. API Apps is a hosted service platform that can help developers to easily build, host,
and use APIs that are developed by using known platforms, such as ASP.NET, PHP, Python,
and so on. You can create an API app by using the simple interface in the Azure portal and
then you can integrate it with Visual Studio for developing, debugging, and managing. When
you create a new API app, Azure generates the code that enables different SaaS applications,
such as Office 365 and Salesforce, to use the API app. An API app has integrated support for
Swagger API metadata that describes the API’s capabilities and generates the client code for
accessing the API by using different languages, such as, C#, Java, and JavaScript.

Note: Swagger is popular framework for APIs that provides interactive
documentations, client SDK generations, and discoverability of the created APIs. For
more information, refer to: http://aka.ms/R09mma

You also can benefit from enabling cross­origin resource sharing (CORS) for API apps. This
allows JavaScript to make API calls to different domains other than the original domain of the
JavaScript code. A common scenario would be a JavaScript client running in a web app, for
example www.adatum.com, calls the API that is running in an API app that has a different
domain, such as customapi.azurewebsites.net.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 13/91
6/1/2017 Module 5: Implementing Azure App Service

You can build an API app that can trigger a workflow process based on certain events or
conditions. For example, you can configure the app to search for a specific string in a cloud
app, such as Yammer, and then develop a method that automatically initiates an action or
response.

To create an API app, perform the following steps:

1. Create an API app.

a. Open the Azure portal, and then sign in to your subscription.
b. Click New, click Web+Mobile, and then click Api App.
c. In the Api APP blade, fill the following information, and then click Create:

▪ App Service Name. Provide the unique name for your API app that will be
appended with the Microsoft­owned public domain namespace
.azurewebsites.net
▪ Subscription. Select the subscription in which you will provision the new API
app.
▪ Resource Group. Select an existing resource group or create a new resource
group.
▪ App Service plan/Location. Select an existing service plan or create a new
App Service plan.

2. Configure your API app:

a. In the Azure portal, select your API app.
b. In the API app blade, click All Settings.
c. In the Settings blade, in the General section, click Quick start.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 14/91
6/1/2017 Module 5: Implementing Azure App Service

d. In the Get started blade, select the desired platform. For example, you would click
ASP.Net.
e. In the ASP.Net blade:

▪ Create a starter backend API. Select this for downloading a sample API app
backend.
▪ Connect your client. You can either select Create a New App and download
a personalized Windows project that you can open in Visual Studio and that
will be preconfigured to work with your new hosted API, or you can select
Connect an Existing App
▪ Get the tools. You can download Visual Studio Community tools for
developing APIs that can run on a variety of platforms and devices.

a. In the Settings blade, scroll down to the API section, and then click API
definition.
b. In the API Definition blade, you can view or change the endpoint that provides
Swagger 2.0 JSON metadata.

3. Generate the client code:

a. Open your API app project in Visual Studio.
b. In Solution Explorer, right­click your API, point to ADD, and then click REST API
client.
c. In the Add REST API Client dialog box, select Swagger Url, and then click
Select Azure Asset.
d. In the APP Service dialog box, select your subscription, expand the resource group
that contains the API app, and then select your API app.
e.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 15/91
6/1/2017 Module 5: Implementing Azure App Service

In the Add REST API Client dialog box, click OK. This will create a folder that
contains yourAPI.cs file, which contains the code that uses the generated client to
call the API.

Overview of the App Service Environment

Business­critical apps often require isolated and dedicated environments. You can use the App
Service Environment, which is a part of the premium service plan, to enable isolated and
dedicated Azure resources for these type of apps. You can use the App Service Environment
to host web apps, mobile apps, and API apps that require highly scalable compute resources,
isolation, and network access.

To provide high­resource pooling, the App Service Environment supports a front­end pool
virtual machines with P2, P3, or P4 compute resources. Additionally, it can include up to three
worker resource pools with P1, P2, P3, or P4 compute resources that can scale differently, up
to 50 instances per pool. The front­end pool commonly uses dedicated compute resources for
SSL termination and load balancing, and each worker pool runs one or more apps.

Note: P2, P3, and P4 are App Service plans that define the capabilities and capacity
of Azure fabric resources. You will learn more about App Service plans later in this
module.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 16/91
6/1/2017 Module 5: Implementing Azure App Service

You create your App Service Environment in a classic virtual network within one of its
subnets, and you can use Network Security Groups (NSG) to fully isolate and secure the
access to the resources. Apps that run as a part of the App Service Environment communicate
within the virtual network. You can use NSG rules assigned to the subnet in which you
provision the App Service Environment, so that you lock down specific inbound and outbound
traffic. Outbound connectivity the App Service Environment occurs through the IP address
that you configured for outbound calls. Inbound communications from the outside of the
virtual network occur through virtual IP (VIP) address of the App Service Environment.

When you create the App Service Environment, you allocate the following dedicated resources
from Azure:

• Computer resources combined in one front­end pool and up to three worker pools.

• A dedicated 500 gigabyte (GB) storage that is shared across all the apps in the App Service
Environment.

• A database that contains configuration of the environment.

• A regional virtual network v1 with a subnet.

A front­end pool contains compute resources that are commonly used for SSL termination or
automatic load balancing of app requests within an App Service Environment. The worker
pools contain compute resources that are used by the apps that are part of the App Service
Environment.

To create a new mobile App Service Environment, perform the following steps:

1. Sign in to the Azure portal.

2. On the toolbar to the left, click NEW, select Web+Mobile, and then click App Service
Environment.

3. In the All Service Environment blade, in the Name box, type the unique name for your
App Service Environment. The name will be appended with the Microsoft­owned public
domain p.azurewebsites.net.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 17/91
6/1/2017 Module 5: Implementing Azure App Service

4. In the Resource Group box, select an existing resource group or create a new resource
group.

5. In the Virtual Network/Location box, select an existing virtual network or create a new
virtual network. If you choose to create a new virtual network, select Location, select a
virtual network address block, create a subnet, and then select the subnet address block.

6. In the App Service Environment blade, click Scale.

7. In the Scale blade for the front­end pool, select either P2, P3, or P4 compute resource
size. The default is P2, which creates an instance with two cores, 3.5 GB RAM, and 500
GB storage.

8. In the Scale blade, you can select up to three worker pools that can contain P1, P2, P3,
or P4 compute resources.

9. In the Scale blade, select the number of front­end pool instances and the number of
instances for any of the three worker pools.

10. In the Scale blade, select the number of IP addresses, and then click OK to configure
scaling of the App Service Environment.

11. Click Create to create the App Service Environment.

After you create your App Service Environment, you can open it in the Azure portal. In the
Monitoring section, you can configure different performance counters that describe the usage
of CPU, Disk Queue Length, or Average Response Time. You also can configure alerts that
can trigger an email when a counter exceeds a threshold. In the Properties blade, you can find
the VIP address that is allocated for your App Service Environment. You also can increase the
number of IP addresses, such as if you need to use SSL for a dedicated app that is part of the
App Service Environment. From the Properties blade, you can access the individual blades for
each resource pool, front­end pool, and worker pool; view current resource utilization;
configure scaling of resource pools by increasing the number of instances; and configure the
auto­scaling functionality for each app service.

Lesson 2: Planning app deployment in App Service

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 18/91
6/1/2017 Module 5: Implementing Azure App Service

Developers have the flexibility to deploy their web solutions in several cloud­based scenarios.
They can use different scaling and configuration options based on the demands of their
solutions. In this lesson, you will learn about web apps and how they differ from Platform­as­
a­Service (PaaS) cloud services and web applications that are hosted on Azure virtual
machines. You also will learn about the five plans within which you can create web apps, and
the different features that each plan supports. Finally, you will learn how the tools and source­
code control systems that developers use will influence your choice of deployment methods.

Lesson Objectives
After completing this lesson, you will be able to:

• Identify the differences among a web app, a PaaS cloud service, and an application that is
hosted on a virtual machine.

• Identify the differences between the five App Service plans.

• Explain the different methods to deploy and update source code in App Service.

Comparing web apps, PaaS cloud services, and virtual
machines

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 19/91
6/1/2017 Module 5: Implementing Azure App Service

If you want to host a web application in Azure, you can use IaaS Azure Virtual Machines,
Web Apps, or PaaS Azure Cloud Services. The level of control, the flexibility to scale, and the
programming languages and frameworks that you want to use will determine which of the
three options that you select.

Note: In this course, the cloud services that support IaaS v1 virtual machines are
termed IaaS cloud services v1. The cloud services that support web roles and worker
roles are termed PaaS cloud services.
Note that the Resource Manager deployment model does not support cloud services.

Virtual machines

Because an IaaS virtual machine in Azure can include a web server, such as IIS or Apache,
you can use it to host web applications. This scenario is similar to running a traditional web
farm to host your web application, except that the servers are at Azure datacenters and not in
an on­premises environment. Therefore, you typically use virtual machines to migrate an on­
premises web application into Azure with as little modification as possible. You can host
supporting servers, such as SQL Servers that host databases, on other virtual machines. Load
balancing is available to scale out the web application, if necessary.

If you choose to host a web application on virtual machines, this provides maximum control
over your operating system and supporting software. For example, you can install a specific
version of PHP on Apache. However, you must invest the time to update and maintain the
infrastructure that you create. If you want to scale out the application, you must provision new
virtual machines to host the application’s new instances. You can use the Remote Desktop
Protocol (RDP) to connect to IaaS virtual machines.

Web apps

Alternatively, you can choose to host your web application by using the Web Apps feature.
After you create a new web app, you can upload a custom web application or choose from a
wide range of popular general­purpose web applications, including Drupal, WordPress, and
Umbraco. You can build custom web applications and host them in Web Apps by using
ASP.NET, Node.js, PHP, and Python.
https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 20/91
6/1/2017 Module 5: Implementing Azure App Service

You can scale up web apps by changing the pricing tiers, which increases the volume of
workload that a single instance of a web app can service. Alternatively, you can scale out by
installing a web app in multiple instances, and then using Azure load balancing to distribute the
traffic. However, you cannot scale individual components of a web app separately. You also
cannot gain RDP access to the web server. You can use an Azure SQL database or SQL
Server on a virtual machine to host an underlying database.

PaaS cloud services

You also can choose to build a web application as a PaaS cloud service. A PaaS cloud service
consists of a web role, which includes the application’s user interface, and worker roles, which
run background tasks. You can scale each role independently by specifying the number of role
instances, which gives you significant control over scalability. Additionally, you can connect to
the servers that host your PaaS cloud service by using RDP.

PaaS cloud services are a specialized form of web applications that are unique to Azure. An
existing web application sometimes requires a significant modification before it can run as a
PaaS cloud service. You will learn more about PaaS cloud services in Module 8.

Managing App Service plans

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 21/91
6/1/2017 Module 5: Implementing Azure App Service

When you create an app in App Service, you need to choose an existing or a new service plan.
There are five available service plans: Free, Shared, Basic, Standard, and Premium. Multiple
web, mobile, logic, and API apps can share a single App Service plan.

Additional Reading: For more information on the plans and pricing, refer to App
Service Plan Pricing Details: http://aka.ms/Rgjtys

Any App Servcie app that you create must belong to one and only one App Service plan. The
App Service plan defines the capabilities and capacity of Azure fabric resources, and is
associated with a single subscription and geographic location. The App Service plan is part of a
resource group that can host multiple plans with different capabilities. Having multiple plans as
a part of a single resource group allows you to separate the production, development, and
testing environments, without impacting resources across the plans.

Although you can associate a single plan with multiple apps, sometimes it is better to create
different service plans with different features. For example, if an app consumes more
resources and has a different scaling factor than other apps, you should host that app in a
different App Service plan for better isolation.

You can create a new service plan when you create an App Service app. When you create the
service plan, you need to provide a descriptive name and select an appropriate pricing tier and
location. You can move apps that you create in one service plan into another, should they
require different capacity and scaling options, and you can scale an App Service plan to meet
the demands of apps, by changing the plan’s pricing tier, instance size, or instance count.

The Free plan

The Free App Service plan allows you to create a maximum of 10 web, mobile, or API apps,
and limits you to 1 GB of storage. You also can create up to 10 logic apps, free of charge. The
Free plan does not support custom domain names, so you must host every app within the
domain azurewebsites.net. You cannot scale out Free tier apps to multiple instances, and they
do not qualify for any service level agreement (SLA). You can support communications and
offline sync with up to 500 devices per day, and initiate 200 logic actions per day. For specific

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 22/91
6/1/2017 Module 5: Implementing Azure App Service

logic apps that use connectors, the Free App Service plan has a limit of 200 calls per day for
core connectors and enterprise connectors. Additionally, the outbound traffic for apps is
limited to 165 megabytes (MB) per day.

The Shared plan

The Shared App Service plan has unlimited outbound data transfer and allows you to use a
custom domain, although, you cannot use secure sockets layer (SSL) to secure Shared tier
web apps with custom domains. You cannot scale a Shared tier app, and this app does not
qualify for any SLAs. You can create up to 100 web, mobile, or API apps, and up to 10 logic
apps in the Shared App Service plan. Other limits regarding storage­capacity, support for
communications with devices, and calls per day from core and enterprise connectors, are the
same as with the Free App Service plan.

The Basic plan

The Basic App Service plan provides up to 10 GB of storage. Additionally, it allows you to
use custom domains with SSL encryption. The Basic tier apps also qualify for the 99.9
percent uptime SLA, and you can scale up to three instances, and use Azure load balancers to
distribute the load. This plan supports communications from unlimited mobile devices, and
limits offline sync to 1,000 calls per day. It can serve calls from 200 core and enterprise
connectors.

The Standard plan

The Standard App Service plan provides up to 50 GB of storage and you can scale out apps to
10 dedicated instances. Up to five automatic scaling and staged publishing slots are available
for Standard tier apps. Apps created with the Standard App Service plan support geo­
distributed deployments and virtual private network (VPN) hybrid connectivity. They can
handle 10,000 logic actions per day, and can serve calls from 10,000 core connectors and 200
enterprise connectors.

The Premium plan

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 23/91
6/1/2017 Module 5: Implementing Azure App Service

The Premium App Service plan enables maximum scale, isolation, and enterprise connectivity
for the apps. It provides up to 500 GB disk space, supports 50 instances, and can have 20
staging environments.

Comparing app­deployment methods in App Service

Developers and web­app administrators might have different approaches for deploying web,
mobile, logic, and API apps. The chosen approach often depends on where the source code is
located. When there is an individual developer or a very small team, developers typically store
source code on their computers, on which they are running an Integrated Development
Environment (IDE) that they use to write code. For larger teams, the challenges associated
with working collaboratively often require the use of a source control system such as
Microsoft Team Foundation Server (TFS). These source­control systems can be based in an
on­premises environment or in the cloud.

Source code on client machines

If the developers are not using a source­control system to coordinate development, they can
deploy an app to Azure directly from their chosen IDE, such as Visual Studio or Web Matrix.
They also can use the command­line MSBuild tool to script deployment processes.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 24/91
6/1/2017 Module 5: Implementing Azure App Service

Although they can use FTP to transfer files, the Web Deploy technology has extra features
that make it easier to set configuration values, such as connection strings, and reduce the
deployment time.

Developers also can use the Kudu engine to push the code from any repository. Kudu
supports version control, package restore, and web hooks for continuous deployment.

Source code in an on­premises source­control system

If developers are using a source­control system that is on servers within their on­premises
network, they can configure that system to perform continuous delivery to an app service.
This target app should be in a staging slot to ensure that you can test changes before you
move them to the production app. On­premises source control systems include TFS, GitHub,
and Mercurial repositories.

Source code in a cloud source­control system

If developers are using a cloud­hosted source­control system, such as Team Foundation
Version Control (TFVC) in Visual Studio Online (VSO), they can configure continuous
delivery in a very similar way to on­premises source­control systems. Developers have many
choices in these systems. For example, they can use Git for distributed source code in VSO
instead of using the centralized TFVC.

Additional Reading: For more information on deployment mechanisms, refer to:
http://aka.ms/jyfupy

Lesson 3: Implementing and maintaining web apps

Teams of web designers and developers typically create web applications, using a variety of
tools, such as graphic­design packages, image­editing packages, web­design software, and
IDEs, such as Visual Studio. When the first version of a web application is complete, you
must deploy it to a web server. You can choose to use Web Apps as a web server to host your

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 25/91
6/1/2017 Module 5: Implementing Azure App Service

application. There are many ways to package and deploy a web application to Azure. In this
lesson, you will learn about those methods. You also will learn how to deploy new web
applications and updates as web apps by configuring IDEs, FTP tools, and source­control
software.

Lesson Objectives
After completing this lesson, you will be able to:

• Explain how to create a new web app in Azure by using the Azure portal and Azure
PowerShell.

• Explain how to use Web Deploy to deploy a web app to Azure from Visual Studio.

• Explain how to deploy updates to an existing web app.

Creating web apps

Your development team might use web servers on their workstations or an intranet web server
to host a web application during development. If you choose to host the web application in
Azure, you can create a new web app in Azure so that either you or the developers can deploy
the web app. If you want to use Git or FTP to deploy the web app’s code, you should

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 26/91
6/1/2017 Module 5: Implementing Azure App Service

configure the credentials that authentication requires. You then can upload the web app’s code
and content to the new web app so that it becomes available for browsing.

If your web app is based on the ASP.NET framework, you can deploy it directly from Visual
Studio. You can download Azure SDK for .Net that contains a set of Visual Studio tools,
command­line tools, and client libraries that simplify the process of deploying apps to Azure.

Note: Webs apps that you deploy to the App Service are available publically. You
should not deploy a web app unless you are sure that it protects any sensitive data that
it handles.

Creating new web apps in the Azure portal

To create a new web app in the Azure portal, perform the following steps:

1. On the toolbar to the left, click NEW, select the Web+Mobile link, and then click Web
App.

2. In the Web App blade, in the App Service Name text box, type a unique and valid
name. If the name is unique and valid, a green smiley face appears, and Azure will
append the name with the azurewebsites.net domain name.

3. In the Subscription drop­down list, select your subscription.

4. In the Resource Group drop­down list, select an existing resource group or create a new
resource group.

5. In the App service plan/Location drop­down list, select an existing plan or create a new
App Service plan, and then select the location of the datacenter closer to you.

6. Click Create. Azure then creates the new web app.

Creating new web apps by using Azure PowerShell

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 27/91
6/1/2017 Module 5: Implementing Azure App Service

You also can create a new web app by using the New­AzureRMWebApp command in the
Azure PowerShell, as shown below:

New-AzureRMWebApp –ResourceGroupName AdatumRG –Name “WebAppName”


–Location “Location” –AppServicePlan StandardPlan

Setting up deployment credentials

If you use FTP or Git for deploying source code to Azure, then your client cannot use your
Azure account credentials to authenticate. Instead, you must set up deployment credentials.
To do this in the Azure portal, perform the following steps:

1. On the toolbar to the left, click BROWSE, and then click Web Apps.

2. In the Settings blade, scroll down to locate the Publishing section, and then click
Deployment credentials.

3. In the Set Deployment credentials blade, in the FTP/Deployment user name text box,
type ftpadminXXXX, where XXXX is a unique number.

4. In the Password text box, type Pa$$w0rd.

5. In the Confirm password text box, type Pa$$w0rd, and then click Save.

6. Close the Set deployment credentials blade.

Downloading a publishing profile

Azure can create a publishing profile for each web app that you create. This profile is an XML
file with a .publishsettings extension that you can download from the Azure portal. It includes
all the credentials, connection strings, and other settings that are required to publish a web app
from an IDE such as Visual Studio.

Create a project and a web app from Visual Studio

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 28/91
6/1/2017 Module 5: Implementing Azure App Service

1. Open Microsoft Visual Studio 2015.

2. On the File menu, click New, and then click Project.

3. In the New Project dialog box, expand Installed > Templates > Visual C# > Web, and
then select ASP.NET Web Application template.

4. In the New Project dialog box, fill the following information, and then click OK:

o Name: Provide a descriptive name for the project.
o Location: Provide a location on the disk to store the new project.
o Solution: Create new solution.
o Solution Name: Provide a descriptive name for the solution.
o Add Application Insights to project: Select this check box to enable monitoring
of your web app.

5. In the New ASP.Net Project dialog box, select the MVC template.

6. On the right side of the dialog box, click Change Authentication.

7. In the Change Authentication dialog box, select No Authentication, and then click
OK.

8. In the New ASP.Net Project dialog box, under the Microsoft Azure section, verify that
the check box is selected for Host in the cloud. Verify that the host option is App
Service, and then click OK.

9. In the Create App Service dialog box, sign in to your Azure subscription, and then fill
the following information:

o Web App Name: Provide a unique name for your web app that will be append
with the Microsoft­owned public domain azurewebsites.net.
o Subscription: Select your subscription.
o

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 29/91
6/1/2017 Module 5: Implementing Azure App Service

Resource Group: Select an existing resource group or create a new resource
group.
o App Service Plan: Select an existing plan or create a new service plan by choosing
the name and region.

10. Click Create to finish creation of the web app in your Azure subscription.

After you create your project, you can write the code, configure the functionality of the new
web app, and finally publish it as a new web app in Azure.

Deploying web apps

You can deploy your web apps by using several methods, such as copying files manually by
using FTP, or synchronizing files and folders to App Service from a cloud storage service,
such as OneDrive or Dropbox. App Service also supports deployment by using the Web
Deploy technology, which Visual Studio, WebMatrix, and Visual Studio Team Services all
include.

Web Deploy

Web Deploy is a technology with client­side and server­side components that synchronizes
content and configuration values with IIS servers. You can use Web Deploy to migrate content
https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 30/91
6/1/2017 Module 5: Implementing Azure App Service

from one IIS web server to another, or you can use it to deploy web apps from development
environments to staging and production web servers. We recommend using Web Deploy to
deploy a web app to App Service from Visual Studio.

Only IIS web servers, which host web apps, support Web Deploy. A small number of clients
also support it, including Visual Studio and WebMatrix, and it offers several advantages,
including that it:

• Uploads only those files that have changed. Therefore, you can perform modifications
reliably with much less network traffic.

• Works over the secure HTTPS protocol. It does not require extra open ports on the web
server’s firewall.

• Can secure the files it transfers by setting access control lists (ACLs).

• Can use SQL scripts to deploy a database to a remote server.

• Can modify the web.config file automatically. For example, it can replace a database­
connection string so that the web app that you deploy connects to a production database.

To use Visual Studio to deploy your project as a web app in Azure, perform the following
steps:

1. In Visual Studio, open your project that contains the MVC application that you plan to
deploy in Azure.

2. In Visual Studio, in Solution Explorer, right­click your project, and then select Publish.

3. In the Publish Web dialog box, follow the Publish Web Wizard.

4. On the Profile tab, in the Select a publish target section, select Microsoft Azure App
Service.

5. In the App Service dialog box, sign in to your Azure subscription, select your
subscription, and then select or create a new resource group. Select an existing web app
or create a new web app, and then click OK.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 31/91
6/1/2017 Module 5: Implementing Azure App Service

6. On the Connection tab, select the publishing method to be Web Deploy, and then
verify the site name, user name, and destination URL. You can click Validate
Connection to verify the existence of the new web app and its connectivity to App
Service. Click Next to proceed with the next step.

7. On the Settings tab, verify that Release is selected from the Configuration drop­down
menu, and then click Next.

8. On the Preview tab, click Publish to begin the process of copying files to the Azure
server.

9. Upon a successful deployment, the default browser automatically opens the URL of your
deployed web app.

MSDeploy.exe

You implement the Web Deploy client as a command­line utility, MSDeploy.exe. Visual
Studio, WebMatrix, and PowerShell cmdlets use this utility to execute Web Deploy operations.
You can use MSDeploy.exe at the command prompt manually or as part of a batch file.

Additional Reading: To download the MSDeploy.exe tool, refer to:
http://aka.ms/Fir58l

Using Web Deploy in PowerShell

PowerShell in the resource manager model includes the New­
AzureRmResourceGroupDeployment cmdlet, which uses Web Deploy to upload either a
Visual Studio package or a project file to Azure. You can use the cmdlet to automate a web
app’s deployment.

For example, you can use the following Azure PowerShell command to package and publish a
web application project from the Git repository:

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 32/91
6/1/2017 Module 5: Implementing Azure App Service

New-AzureRmResourceGroupDeployment -TemplateUri
https://raw.githubusercontent.com/Azure/azure-quickstart-
templates/master/201-web-app-github-deploy/azuredeploy.json -
siteName ExampleSite -hostingPlanName ExamplePlan -siteLocation
"West US" -ResourceGroupName ExampleDeployGroup

Deploying a web app by using FTP

FTP is an older protocol that is used widely for uploading web applications to web servers.

FTP clients

Azure can act as an FTP server so that you can upload your web app for publishing.
However, you must choose an FTP client, which you can use to upload your web app to
Azure. There are many FTP clients that are available, including:

• Web browsers. Many of the web browsers support FTP and HTTP. This means that you
can use your web browser to browse FTP sites and to upload content. However, advanced
features, such as retries for dropped connections, are not available in most browsers.

• Dedicated FTP clients. Several dedicated FTP clients are available for a free download.
These include FileZilla, SmartFTP, CoreFTP, and others. The advanced features of these
clients make them suitable for web­app publishing, which can involve hundreds of files with
large file sizes.

• IDEs. Visual Studio and other IDEs support FTP for web­app publishing.

Configuring an FTP transfer

To publish a site by using FTP, you must configure your client with the destination URL of
the remote FTP site and the credentials that FTP can use to sign in to the FTP server. Do not
use your Azure account credentials. Rather, use the same FTP credentials that you used to
configure your web app. Furthermore, you must select active or passive FTP mode.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 33/91
6/1/2017 Module 5: Implementing Azure App Service

By default, FTP uses active mode. In this mode, the client initiates the session and issues
commands by using a command port (usually port 21 on the server) and then the server
initiates a data transfer by using a data port (usually port 20 on the server). Firewalls might
block these data transfers because they appear as a separate communication. In passive mode,
both commands and data transfers are initiated by the client and are less likely to be blocked
by firewalls.

Limitations of FTP

The principal advantage of FTP is its wide use and its broad compatibility. However, because
FTP is an older technology that is not specifically for uploading a web app’s source code, it
does not have advanced features. For example:

• FTP just transfers files. It cannot modify files or distinguish their use. Therefore, it cannot
automatically alter the database connection strings in web.config files to connect to the
production database instead of a development database. However, you can configure Web
Deploy to make this modification.

• FTP always transfers all files that you select, regardless of whether they have been
modified. This can cause an operation to upload many files unnecessarily, since they remain
unchanged from their previous upload.

Updating web apps

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 34/91
6/1/2017 Module 5: Implementing Azure App Service

After you deploy a web app to Azure, you rarely cease developing it. In most cases,
developers add new features and fix bugs to improve the app and ensure a compelling user
experience. You can deploy these changes in different ways, depending on the location of your
source code and the deployment tool that you choose.

If you use FTP for deployment, you simply upload new files and overwrite any changed files.
Note that FTP cannot distinguish changed files automatically, so you must keep a careful
record of altered files or overwrite all the files in the site. If you take the second approach,
even a small update requires a lengthy upload operation However, if you use Web Deploy,
MSDeploy.exe compares the files in the source and destination, and then uploads only the
modified files.

Continuous deployment

Continuous delivery is a recent approach to software development in which a project’s source
code changes regularly due to bug fixes, and new and improved features. Continuous
deployment is a part of the continuous delivery model. It involves regular and automatic builds
and deployments of a project to a staging environment. If you develop a web app by using a
centralized source­control system, such as TFS or GitHub, you can configure continuous
deployment of that web app to Azure, on an automated schedule or in response to any
committed changes.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 35/91
6/1/2017 Module 5: Implementing Azure App Service

To enable and use continuous deployment, you must:

1. Connect the project to a web app. In the Azure portal, you must configure the location
of your source­code repository and provide credentials that Azure can use to authenticate
with the repository.

2. Make one or more changes to the source code, and then commit them to the repository.

3. Trigger a build, and deploy an operation.

The precise steps involved in this configuration depend on the repository that you are using.

Additional Reading: For more information on the configuration steps for a Git
repository in Visual Studio Online, refer to Continuous delivery to Azure using Visual
Studio Online and Git: http://aka.ms/T39yxb

Staging and production slots

Before you deploy the source code to a public­facing web app, you must ensure and test its
integrity and reliability. Therefore, it is important to implement a strict testing and acceptance
regime that identifies bugs and other issues in the code before you deploy it to the production
web app. You can perform much of this testing in the development environment. For example,
you can run unit tests on developers’ computers. However, the final testing location should be
the staging environment. The staging environment should match the production environment
as closely as possible.

If you are using the Standard tier web apps, you can create two or more slots for each app.
You can create one slot for the production web app and deploy the tested and accepted code
there. You can create a second slot as the staging environment. You can deploy the new code
to this staging slot, and then use it to run acceptance tests. The staging slot has a different
URL for browsing.

When the new version in the staging slot passes all the tests, you can deploy it to production
safely by swapping the slots. This also provides a simple rollback path. If the new version
https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 36/91
6/1/2017 Module 5: Implementing Azure App Service

causes unexpected problems, you can swap the slots one more time to move back to the old
production site.

Best Practice: If you are using continuous deployment, you should never configure it
to deploy the code to a production web app. This would result in untested code in a
user­facing environment. Instead, you can configure deployment to a staging slot or a
separate web app, where you can run certain tests before final deployment.

When you swap a production and staging slot, the following settings in the production slot are
replaced with those of the staging slot:

• Connection strings

• Handler mappings

• Monitoring and diagnostic settings

For staging, you typically run the web app against a dedicated staging database, which you
define in the connection string. When you swap slots, the new production database will use
the database that you were using while staging the app. If you want to continue to use the
original database because it contains up­to­date production data, you must edit the connection
string in the new production slot. You should do this only if the database schema has not
changed in the new version. If the schema has changed, you must migrate the production data
into the staging database before you swap.

The following production slot settings will not change when you swap a staging slot into a
production slot:

• Publishing endpoints

• Custom domain names

• SSL certificates and bindings

• Scale settings

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 37/91
6/1/2017 Module 5: Implementing Azure App Service

Staging slots are available publically, but because the URL is not widely known, Internet users
are unlikely to find your staging site. However, you might wish to restrict access to your
staging slot so that only your developers and the testing team can access it. You can do this by
adding the IP address white lists to the web.config file in the web app.

Demonstration: Deploying web apps by using Web Deploy
In this demonstration, you will learn how to:

• Create a new web app in the Azure portal.

• Browse the new web app in the Azure portal.

• Obtain a publishing profile.

• Deploy line­of­business (LOB) application in Web Apps.

Demonstration Steps
Create a new web app in the Azure portal

1. Start Internet Explorer, browse to http://portal.azure.com, and then sign in by using the
Microsoft account that is either the Service Admin or co­admin of your subscription.

2. From the Azure portal, create a new web app in a new resource group named
AdatumRG

3. Create a new App Service plan named WebAppStandardPlan, located in the Azure
region near your location, and choose S1 Standard as the pricing tier.

Open the new web app from the Azure portal

1. After the web app’s creation is complete, use the URL in the Essentials section of the
web app blade in the Azure portal to browse to its default webpage.

2. Close the Internet Explorer tab showing the default webpage.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 38/91
6/1/2017 Module 5: Implementing Azure App Service

Obtain the publishing profile

1. From the Azure portal, download the publish settings profile.

2. Save the profile in the Downloads folder on the local computer.

Deploy an LOB application in Web Apps

1. Open Visual Studio 2015 and then open
D:\DemoFiles\Mod05\AdatumWebsite\AdatumWebsite.sln.

2. From the Solution Explorer, publish the AdatumWebsite project. Use the publish
settings profile file from the Downloads folder.

3. Verify that the Adatum web app is open in the Microsoft Edge browser, and then verify
the current address of the web app.

4. Close the Home Page tab in the browser.

5. Close Visual Studio.

Lesson 4: Configuring web apps

After you create and deploy a web app, you have many settings that you can configure on an
ongoing basis. For example, you can configure SSL and web­app certificates to support
encryption; link databases and storage accounts to the web app, which eases scalability and
monitoring; and scale the web app to handle peak demand. In this lesson, you will learn how
to configure a web app for optimal performance and cost efficiency, and how to use WebJobs
to schedule scripted tasks that maintain your web app.

Lesson Objectives
After completing this lesson, you will be able to:

• Explain how to configure a web app’s application and authentication settings.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 39/91
6/1/2017 Module 5: Implementing Azure App Service

• Explain how to configure virtual networks and hybrid connectivity for web apps.

• Explain how to scale web apps and configure availability.

• Describe how to create WebJobs to run background tasks.

Configuring a web app’s application and authentication
settings

After you create your web app in the Azure portal, you can access the Application settings
blade from the All Settings link to configure the settings for the web app. You can configure
the following settings in the Application settings blade:

• Framework versions. Use this setting to select from all the supported versions of
development frameworks. Server­side code that executes to render webpages requires a
framework, which developers select when developing a web app. Azure supports the
ASP.NET, PHP, Java, and Python frameworks. Older web apps might require an older
version.

• Platform. Use this setting to control whether to run the server code in 32­bit or 64­bit
mode. The 64­bit mode is available only for Basic, Standard, and Premium tier web apps.

• Web Sockets. Use this setting to enable web sockets, which allow for two­way
communication between a server and a client. Developers can build chat rooms, games, and
https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 40/91
6/1/2017 Module 5: Implementing Azure App Service

support tools by using web sockets.

Note: Many developers in ASP.NET use the SignalR package to build two­way
messaging into their web applications. SignalR is built on web sockets.

• Always On. Use this setting to enable regular pinging of a web app with a simple request,
which ensures that the app’s code remains in memory and does not need to be recompiled
and reloaded. Many web­development technologies, such as ASP.NET and PHP, unload a
web app from memory when there are no requests for a prolonged period. After this period,
if the web app receives a new request, the code might need to compile and reload before it
can send a response to the user. This process can affect response time. The Always On
feature is available only for web apps in the Standard and Premium tiers.

• Managed Pipeline Version. Use this setting in integrated or classic mode to manage
versioning. An application pool that is running in the integrated mode benefits from the
integrated request­processing architecture of IIS and ASP.NET, so this is default mode for
new web apps. Legacy apps that run in the classic mode, which is equivalent to the IIS 6.0
worker­process isolation mode, use separate process for IIS and ASP.NET, with duplicate
processes for authentication and authorization.

• Auto Swap. Use this setting to enable automatic swap between the production and staging
environments each time you upload new updates to the staging slot.

• Debugging. Use this setting to enable remote debugging and select the version of Visual
Studio to connect directly to the web app.

• App Settings. Use this setting to pass custom name/value pairs to your application at
runtime. Work with your development team to determine what settings the web app’s code
requires. For example, you can use an app setting to specify an administrator’s email
address. The web app’s code could use this setting and display it in an appropriate place on
the site.

• Connection Strings. Use this setting to enable the web app to connect to a database. Most
web apps use databases to store all dynamic data, and they cannot function without a
connection to one or more databases. Configuration files, such as the web.config file, store

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 41/91
6/1/2017 Module 5: Implementing Azure App Service

connection strings. You can use the Connection Strings setting to override these connection
strings without modifying and uploading a new web.config file.

• Default Documents. Use this setting to specify the pages that display when users open
your web app. Work with your developers to ensure that the web app’s home page appears
in the default documents list. Optimize the web app by ensuring that the home page is at the
top of the list.

• Handler mappings. Use this setting to add custom script processors for configuring
specific extensions, such as .php or .asp. To add a custom script processor, provide the path
of the script processor and any additional arguments that you can use with the script.

• Virtual applications and directories. Use this setting to add additional virtual applications
and directories to your web app by specifying physical paths.

Diagnostic logs

You can access the monitoring settings for a web app by clicking the All Settings link, and
then clicking the Diagnostic logs link. In the Logs blade, you can configure application
logging either by using the file system for streaming log feature or a blob to collect the logs
from the configured storage account. You also can configure the logging level (Error, Warning,
Information, or Verbose) and how failed requests are handled for diagnostic purposes.

Custom domain names

If you have registered a custom domain name, such as adatumcorp.com, with a domain
registrar, you can use that domain name to host your site. All Azure sites without custom
domain names are in the azurewebsites.net domain. You can set a custom domain for web
apps that you create in the Shared, Basic, Standard, and Premium tiers. You can configure
your custom domain by verifying the domain’s ownership by clicking the All Settings link,
clicking Custom domains and SSL link, and then on the command bar, clicking Bring your
external domain. You can verify your domain by creating a CNAME resource record in your
Domain Name System (DNS) server that points from your custom domain, such as
www.adatumcorp.com to webapp.azurewebsites.com. You also can create an A resource
record that can map your custom domain name with the public IP address that Azure allocates

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 42/91
6/1/2017 Module 5: Implementing Azure App Service

for your web app. Optionally, you can verify your custom domain with CNAME resource
record, which maps awverify.yourdomain to awverify.yourwebapp.azurewebsites.net.

Certificates

If you want to use SSL to encrypt communications between the web browser and the server
that is hosting the web app, you must obtain and upload a certificate from a recognized
certificate authority. Use the Certificates section in the Custom Domain and SSL blade in the
Azure portal to add a certificate to your site. To use SSL with a custom domain, you must
ensure the custom domain appears in the certificate when you purchase it from the certificate
authority. After you upload the certificate, you can bind it to the custom domain by using the
SSL Bindings table. The following is the process for enabling HTTPS for a custom domain:

1. Create your SSL certificate that contains your custom domain that you define in the
Subject Name or Subject Alternative Name property of the certificate. You also can use
a wildcard certificate for this purpose.

2. Configure the Standard or Premium pricing tier, because only these tiers allow the usage
of HTTPS for a custom domain.

3. Configure SSL in your app by uploading your certificate and configuring with your
custom domain name for the web app.

4. Enforce HTTPS on your app (optionally) by configuring the URL Rewrite module that is
part of App Service. URL Rewrite defines rules in the web.config file of the web app to
force incoming requests for the web app to use an HTTPS connection.

Note: For more information on how to enable HTTPS for an app in App Service,
refer to Enforce HTTP on your app: http://aka.ms/X0xh9y

Configuring authentication and authorization in App Service

You can integrate web apps that require authentication and authorization with Azure Active
Directory (Azure AD) or with on­premises Active Directory Domain Services (AD DS) by

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 43/91
6/1/2017 Module 5: Implementing Azure App Service

using Active Directory Federation Services (AD FS). Azure AD authentication supports the
following authentication protocols, OAuth 2.0, OpenID Connect, and SAML 2.0. If you
configure your Azure AD to synchronize directories with your on­premises AD DS, you can
achieve single sign­on (SSO) experience for AD DS users when they access your web app in
Azure. Furthermore, for authentication, you can configure other cloud authentication
providers, such as Microsoft account, Facebook, Twitter, or Google.

Advanced configuration of web apps by using ApplicationHost.config

You can use XML Document Transformation (Xdt) declaration in the ApplicationHost.config
file to control additional configuration for your web app. For example, you can configure
custom environment variables, add additional applications, define runtime environment, and
configure Azure site extensions.

Additional Reading: For more information on how to use Xdt transform samples,
refer to: http://aka.ms/Rkzucb

Configuring virtual networks and hybrid connectivity

Web apps and mobile apps often require a connection to a database or a web service that
might run as PaaS or that you implement as a service on an Azure virtual machine. In case the
database or the web service runs on a virtual machine, App Service might require integration
https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 44/91
6/1/2017 Module 5: Implementing Azure App Service

with the virtual network in which the virtual machine is running. With virtual network
integration, apps communicate with virtual machines that contain databases and web services
by using private IP addresses that are not exposed to the Internet. To integrate app services
with a virtual network, you need to create a Standard or Premium service plan and use classic
virtual networks. You can enable virtual network integration for multiple apps, but all of them
should run a supported service plan and all must belong to the same subscription. You must
configure each virtual network with point­to­site VPN and dynamic routing gateway. Web
apps use point­to­site VPN connection to connect with the virtual network. If that virtual
network also connects to your on­premises network with a site­to­site VPN, the apps also can
access on­premises resources, such as a database server that is running in your datacenter.

To enable virtual network integration for your app, perform the following steps:

1. Sign in to the Azure portal, and then select your web app for which you want to
configure virtual network integration.

2. In the Settings blade, in the Routing section, click the Networking link.

3. In the Network Feature Status blade, under the VNet Integration section, click the Setup
link.

4. In the Virtual Network blade, select an existing virtual network or create a new virtual
network.

5. In the Create a Virtual Network blade, type a descriptive name for the virtual network,
choose an address space, and then optionally configure a primary and secondary DNS
server.

6. Click OK to confirm the creation of the virtual network.

If you need to enable App Service apps to connect with on­premises resources, you can use
hybrid connections. You can implement hybrid connections from web apps and mobile apps in
Azure to access on­premises resources behind your firewall, such as SQL databases or other
published resources. A hybrid connection provides secure connectivity with on­premises
resources that are configured with static TCP ports. You can limit the connection to only
specific on­premises resources, and you can share a hybrid connection across multiple apps.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 45/91
6/1/2017 Module 5: Implementing Azure App Service

Developers use the same connection string from web apps and mobile apps to connect to on­
premises resources by using the configuration of hybrid connections. You establish security in
a hybrid connection between apps and on­premises resources by using Shared Access
Signature (SAS) authorization. The configuration of the on­premises resources is set such that
it does not require you to reconfigure the firewall or any special hardware. It only requires
outbound connectivity to the specific TCP port or HTTP connectivity from your on­premises
network. However, only some TCP ports are used by hybrid connections:

Port Purpose

9350­9354 Port 9530 probes to determine whether TCP connectivity is available. Outbound connections use
these ports.

5671 Acts as a control channel with on­premises resources.

80 and 443 Act as fallback ports for data transmission and to control connectivity with on­premises
resources.

After you enable a hybrid connection between web apps and on­premises resources, you need
to install the Hybrid Connection Manager in your infrastructure. Hybrid Connection Manager
is an agent that you must connect to on­premises resources and Azure.

To create a hybrid connection with your apps, perform the following steps:

1. Sign in to the Azure portal, and then select your web app for which you want to
configure hybrid integration.

2. In the Settings blade, in the Routing section, click the Networking link.

3. In the Network Feature Status blade, under the Hybrid Connections section, click the
Configure your hybrid connection endpoint link.

4. In the Hybrid connections blade, click Add.

5. In the Create hybrid connection blade, in the Name text box, type a descriptive name.

6. In the Create hybrid connection blade, in the Hostname text box, type the fully qualified
domain name (FQDN) of the on­premises resource.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 46/91
6/1/2017 Module 5: Implementing Azure App Service

7. In the Create hybrid connection blade, in the Port text box, enter the static port for the
on­premises resource for which you want to establish connection.

8. In the Create hybrid connection blade, click the BizTalk Service link.

9. In the Create BizTalk Service blade, in the Name text box, type a unique name that will
be appended with the Microsoft­owned public DNS domain, biztalk.windows.net.

10. In the Resource Group section, select an existing resource group or create a new
resource group.

11. In the Location section, choose the Azure region closer to your location.

12. Click OK to confirm the creation of the hybrid connection.

13. After the hybrid connection is created, click it to configure connectivity.

14. In the Hybrid connection blade, click the Listener Setup icon.

15. In the Hybrid connection properties blade, in the On­Premises Hybrid Connection
Manager section, click the Install and configure now link.

16. Follow the setup to install Hybrid Connection Manager on the resource that you want to
connect.

Configuring availability and scalability

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 47/91
6/1/2017 Module 5: Implementing Azure App Service

The scaling options that are available for your web app depend on the service tier you select
for the app. For the Shared and Basic tiers, you can only increase the size of an individual
web app instance or the number of instances. For the Standard and Premium tiers, you can
also configure automatic scaling. You can scale a web app based on a schedule, which can be
helpful when you expect a peak load. Alternatively, you can configure the app to scale
automatically by setting a metric that will trigger scaling when it reaches a value that you
preconfigure.

Additional Reading: For more information on scaling web apps, refer to:
http://aka.ms/Vaut94

To configure scaling for a web app, perform the following steps:

1. In the Azure portal, click the web app that you want to configure.

2. In the web app blade, click the All Settings link, and then click the Scale Up (App
Service Plan) link.

3. In the Choose your pricing tier box, select Share or Basic to configure simple static
scaling. If you want to use automatic scaling, select Standard or Premium.

4. In the Settings blade, click the Scale Out (App Service Plan) link.

5. In the Scale setting blade, you can scale up by selecting a larger Instance Count.

6. For the Standard and Premium tier web apps, you can configure automatic scaling based
on a specific CPU utilization percentage. You can create automatic configuration of new
instances to cover an expected spike in the demand, on the basis of CPU percentage.

7. For the Standard and Premium tier web apps, you can configure automatic scaling based
on a schedule and a performance rule. Click Add Profile, define the name of the profile,
and then configure the profile to use different instances based on a fixed date. Select a
recurrence schedule for different times of the week or configure the profile with a fixed
instance count.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 48/91
6/1/2017 Module 5: Implementing Azure App Service

Best Practice: When you specify a schedule for scaling instances, consider that it can
take several minutes for each instance to start and become available to users.
Therefore, ensure that you have enough time between the start of the schedule and
the point when you expect peak traffic to start.

Implementing WebJobs

WebJobs is a feature of App Service that enables administrators and developers to run
automated background tasks:

• On demand. Tasks runs whenever an administrator executes them.

• Continuously. Tasks continuously reexecute their main methods. For example, a task might
continuously check for the presence of new files to process.

• On a schedule. Tasks run at times that the site administrator specifies.

You use WebJobs for important maintenance tasks that do not affect content delivery to users,
such as for:

• Image processing. Processes that must be run on uploaded images are often CPU intensive.


https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 49/91
6/1/2017 Module 5: Implementing Azure App Service

File maintenance. For example, you might want to scan log files and remove unimportant
events.

• RSS aggregation. Importing information from an RSS feed can be CPU­intensive when
there are many articles.

Best Practice: By default, web apps unload and halt after a prolonged period of
inactivity. This also interrupts any WebJobs in process. To avoid these halts and
prevent interruption of WebJobs, use the Always On feature.

The operations and logic that a WebJob performs are defined in a script file. This file can be a:

• Batch file

• PowerShell script

• Bash shell script

• PHP script

• Python script

• Node.js script

The type of script that you create for a WebJob depends on your own experience. For
example, if you are a Windows administrator with little web development experience, you are
more likely to code WebJob operations as a Azure PowerShell script than as a Node.js script.
Use the following procedures to create and monitor WebJobs.

Creating a WebJob

To create a WebJob, first compress your script file and any supporting files that it requires into
a zip file, and then perform the following steps:

1. In the Azure portal, click the web app that you want to configure with a WebJob.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 50/91
6/1/2017 Module 5: Implementing Azure App Service

2. In the Settings blade, click the Webjobs link.

3. In the WebJobs blade, click Add.

4. In the NAME text box, type a descriptive name for the new WebJob.

5. In the HOW TO RUN drop­down list, select On demand or Run continuously.

6. In the File Upload text box, browse to the zip file that you created.

7. Click Create to finish creation of the WebJob.

At the time of the writing this course, the Azure portal did not support the creation of
scheduled WebJobs. However, you could create scheduled WebJobes in the Azure classic
portal. To create a scheduled WebJob in the Azure classic portal, perform the following steps:

1. In the Azure classic portal, in the navigation pane on the left, click WEB APPS.

2. Click the relevant web app, and then click the WEBJOBS tab.

3. On the command bar at the bottom, click Add.

4. In the NAME text box, type a descriptive name for the new WebJob.

5. In the CONTENT text box, browse to the zip file you created.

6. In the HOW TO RUN drop­down list, select Run on a Schedule.

7. If you are creating a scheduled WebJob, in the SCHEDULER REGION drop­down list,
select an Azure datacenter where you want the scheduler to run.

8. Specify either a one­off time for the job to execute or a recurring schedule.

Viewing the WebJob history

The WebJob history shows when the WebJob was run and the result of the script execution.
To access the history, perform the following steps:

1.
https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 51/91
6/1/2017 Module 5: Implementing Azure App Service

In the Azure portal, click the web app that runs the WebJob, and then click the WebJob
link.

2. For the relevant WebJob, click the link in the Logs column. Azure displays the WebJob
details page. This page displays the script that is run, the duration of the script execution,
and the status.

3. To see further details, click the link in the TIMING section, and then click Toggle
output. Individual events in the execution of the WebJob are displayed.

4. To see the output in a separate browser window, click the download link.

Demonstration: Configuring web­app settings and auto­
scaling, and creating a WebJob
In this demonstration, you will learn how to:

• Configure web­app settings.

• Configure auto­scaling.

• Create a WebJob.

Demonstration Steps

Configuring web­app settings

1. In the Azure portal, navigate to the web app that you created in the previous
demonstration.

2. In the Settings blade, under the General section, click the Application settings link.

3. In the Application settings blade, under General settings, review the current settings:

o .Net Framework version
o PHP version
https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 52/91
6/1/2017 Module 5: Implementing Azure App Service

o Java version
o Python version
o Platform
o Web Sockets
o Always On
o Managed Pipeline Version.
o Auto Swap
o Debugging

4. In the Settings blade, scroll down to the App Service plan section, and then click Scale
Up (App Service Plan).

5. In the Choose your pricing tier blade, review the different App Service plan tiers, and
then close the blade.

Configure auto­scaling options

1. In the Settings blade, click Scale Out (App Service Plan), and then in the Scale by
drop­down menu, review the scaling options:

o An instance count that I enter manually
o CPU Percentage
o Schedule and performance rule

2. In the Scale by drop­down list, select schedule and performance rules. Configure the
scale out by 2 instances if the CPU utilization percentage is greater than 80. Configure
the cool­down time to be 5 minutes.

Create a WebJob

1. In the Settings blade, scroll down to the Web Jobs section, and then create a WebJob
named AdatumWebJob.
https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 53/91
6/1/2017 Module 5: Implementing Azure App Service

2. Configure the WebJob to run continuously as a single instance. Upload the following file:
d:\demofiles\Mod05\AdatumWebJob.zip.

3. In the WebJobs blade, click the logs URL for AdatumWebJob, and then verify that the
WebJob has run and returned the current open processes.

Lesson 5: Monitoring web apps and WebJobs

Running web apps consume resources and incur costs, and also can generate errors. For
example, users might request webpages that do not exist, and an error might display. Azure
allows you to have full control of your web app’s behavior by providing several diagnostic logs
and tools. In this lesson, you will see how to configure logging for your web app, and how to
view and analyze the logging data.

Lesson Objectives
After completing this lesson, you will be able to:

• Identify the different ways to monitor web apps.

• Explain how to configure site diagnostics and application diagnostics to log a web app’s
behavior.

• Explain how to use the Kudu user interface to access further information about your web
app.

Monitoring web apps

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 54/91
6/1/2017 Module 5: Implementing Azure App Service

After you enable application and site­diagnostic logs, you must download the logs to examine
the recorded data. Additionally, you can use the Monitoring tail in the Azure portal to profile
a web app’s performance.

Accessing diagnostic logs

You can access the application and site diagnostic logs by using FTP. You can provide an FTP
link in the Quick Glance section of each web app’s DASHBOARD tab. You can use this link
in your web browser or paste it in a dedicated FTP client, such as CoreFTP. To access the
logs, you must authenticate with deployment credentials that you configure for the FTP server
and Git.

The logs are in the following folders:

• Application logs: /LogFiles/Application

• Detailed error logs: /LogFiles/DetailedErrors

• Failed request traces: /LogFiles/W3SVC#########/

• Web Server logs: /LogFiles/http/RawLogs

• Deployment logs: /LogFiles/Git

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 55/91
6/1/2017 Module 5: Implementing Azure App Service

To examine the failed request traces, ensure you download both XML and XSL files to the
same folder. You can then open the XML files in Internet Explorer.

Instead of using FTP, you also can download the logs by using the Save­AzureWebsiteLog
Windows PowerShell cmdlet, as follows:

Save-AzureWebsiteLog -Name MyWebapp -Output .\LogFiles.zip

You also can use the Azure cross­platform command­line interface (X­Plat­CLI) to download
logs:

Azure site log download MyWebappname

If you want better filtering and search capabilities, you can view the application logs in Visual
Studio, which provides the Application Insight tool. To use this tool, install the Application
Insight SDK and then add it to your project in Visual Studio. Then add Trace Listener to your
project by selecting Manage NuGet Packages, and then selecting
Microsoft.ApplicationInsights.TraceListener. Finally, upload the project to Azure, and then
monitor the log data, together with requests, usage, and other statistical information.

For real­time logging information that can be useful during development, developers can
stream the logs into the development environment. To do this, they can run the following
PowerShell command:

Get-AzureWebSiteLog -Name webappname -Tail

You can store diagnostic logs in a file system, a table storage, or a blob storage. File system
logs provide basic information such as time, process ID, event level, and a message that
explains the event. Table storage logs contains additional properties, such as instance ID,

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 56/91
6/1/2017 Module 5: Implementing Azure App Service

thread ID, row key, and so on. Blob storage logs are stored as comma­separated values and
provide similar functionality as table storage logs.

Diagnostic logs are easy to understand but can be challenging to analyze when they contain a
large quantity of data. One way to analyze diagnostic logs is to use Microsoft Azure
HDInsight.

Additional Reading: For more information, refer to Analyze Windows Azure Web
app application logs using transient HDInsight cluster: http://aka.ms/Wrwug2

Monitoring web apps in the Azure portal

The Azure portal also includes a Monitoring section for every web app. You can use this to
view performance counters that describe how your web app uses resources such as CPU time
and network traffic. Some of the most interesting counters include:

• CPU Time

• Data In

• Data Out

• HTTP Server Errors

• Requests

• Monitoring working set

Other metrics that you can add to the graph include:

• Average Memory Working Set

• Average Response Time

• Various HTTP error type counts

• HTTP Successes
https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 57/91
6/1/2017 Module 5: Implementing Azure App Service

By adding these counters and displaying them in the graph, you can examine how the demand
and the web app response have varied over an hour, 24 hours, or seven days.

You also can set alerts that can trigger an email when a counter exceeds a threshold. Typically,
you would use alerts to notify your team of administrators automatically when there is a
demand spike or other performance issues. To add an alert, perform the following steps:

1. In the Azure portal, click the web app you want to monitor.

2. From the Monitoring section, click the Requests and errors graph.

3. On the Metric tab, click Add alert.

4. In the Add an alert rule blade, in the NAME text box, type a descriptive name.

5. In the Metric drop­down list, select the metric to which you would like to add an alert.

6. In the CONDITION drop­down list, select a condition, such as greater than.

7. In the THRESHOLD text box, type the value that should trigger the alert.

8. In the Period drop­down list, select the period during which the value should exceed the
threshold.

9. Select Send an email to the service administrator and co­administrators.

10. Optionally in the Webhook text box, type the HTTP/HTTPS endpoint to route Azure
alerts to other notification channels.

11. Click OK to finish the creation of the alert.

Configuring application and site diagnostics

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 58/91
6/1/2017 Module 5: Implementing Azure App Service

If you want to troubleshoot a web app’s errors or improve its performance, you need to gather
information about the behavior of the web app. The Web App feature includes application
diagnostics and site diagnostics, which you can configure to record such information for later
analysis.

Best Practice: Configure site diagnostics and application diagnostics to record detailed
information only when you are investigating a web app’s behavior. When you
complete your investigation and want to tune your web app for high performance, you
should minimize the amount of information the diagnostic tools log, because logging
has a small but potentially significant impact on a web app’s performance.

Application diagnostics

Application diagnostics allows you and web app developers to capture and log individual
events that occur as the web app code executes. To record such an event, the developer must
use the System.Diagnostics.Trace class to send a message. Developers often send trace
messages in error handling code but they can also send them simply to record a successful
operation.

Application diagnostics are turned off by default, which means that trace messages are not
recorded. If you switch on application diagnostics, you must configure the following settings
by clicking the Diagnostic logs link in the Settings blade for the web app:
https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 59/91
6/1/2017 Module 5: Implementing Azure App Service

• Log storage location. Choose whether to store the application diagnostic log in the web
app file system, a table in an Azure storage account, or a blob container in an Azure storage
account. You can choose to enable any combination of these locations.

• Logging level. Choose whether to record informational, warning, or error messages in the
log. The verbose logging level records all the message the application sends. You can
configure a different logging level for each log storage location.

• Retention period. Logs stored in a blob storage are not deleted automatically. If you want
to enable automatic deletion, you must set a retention period.

Site diagnostics

You can use site diagnostics to record information about HTTP requests and responses, which
are the communications between the web server and the web browser. The following are the
site diagnostic settings that you can enable or disable:

• Detailed Error Logging. In HTTP, any response with a status code of 400 or greater
indicates an error. Often, users might only see a simple error page with no technical details.
The details stored in site diagnostic logs might help you to diagnose the problem. If you
enable the Detailed Error Logging option, users can see the detailed information about an
error.

• Failed Request Tracing. This option enables you to log rich­tracing information when an
error occurs. Because the trace includes a list of all the IIS components that processed the
request and the timing information, you can use this trace to isolate problematic
components.

• Web Server Logging. This option enables the standard W3C extended log for your web
app. Such a log shows all requests and responses, client IP addresses, and timings and you
can use it to assess server load, identify malicious attacks, and study client behavior.

Additional Reading: For more information on diagnostic logging, refer to Enable
diagnostic logging for Azure Websites: http://aka.ms/A42xut

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 60/91
6/1/2017 Module 5: Implementing Azure App Service

Using Kudu

Project Kudu is an open­source component of Web Apps that implements Azure’s support for
continuous deployment from Git and Mercurial source­code control systems. It also includes
the code that supports WebJobs.

Kudu includes a user interface that publishes diagnostic information and can help you obtain
troubleshooting and performance information.

Accessing the Kudu user interface

Every web app includes a hidden Kudu site. To access this, add the “scm” sub­domain to the
azurewebsites.net fully­qualified domain name for your site. For example, if your web app is
found at:

http://mywebapp.azurewebsites.net

You can access the corresponding Kudu user interface at:

https://mywebapp.scm.azurewebsites.net

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 61/91
6/1/2017 Module 5: Implementing Azure App Service

To access the information in Kudu, you must authenticate with your Azure administrator
account and encrypt the connection by using SSL. The default page displays information
about the IIS environment that is hosting the web app. You also can run commands, either at a
Windows command prompt or in Windows PowerShell, by using the links on the Debug
Console menu in the Kudu user interface.

The Process Explorer tab shows a list of all the processes within the web app and includes
information such as their memory usage and uptime. For each process, you can find out what
DLLs it has loaded, the threads it runs, and the environment variables that are in place.

Other links in Kudu enable you to view diagnostic log files and add NuGet extensions to the
web app.

Demonstration: Using Kudu to monitor a WebJob
In this demonstration, you will learn how to use Kudu to monitor the status of a WebJob.

Demonstration Steps

1. In Internet Explorer, in the address bar, modify the URL of your web app to match the
following format:

o https://yourWebApp.scm.azurewebsites.net
o This opens the Kudu interface.

2. Under the Rest API section, locate the WebJobs entry, and then click the continuous
link.

3. In the dialog box, click Save. Internet Explorer saves the log file to the Downloads
folder.

4. Open the log file by using Visual Studio.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 62/91
6/1/2017 Module 5: Implementing Azure App Service

Lesson 6: Implementing mobile apps

You can use many services and tools that are available in Azure as a backend for mobile apps
that run on phones, tablets, and other devices. Microsoft enables this by adding the Mobile
Apps feature to App Service. Mobile Apps provides the features that are widely used by
mobile app developers in a single service with a single API. In this lesson, you will learn how
to create and administer a mobile app backend in Azure to support a mobile app created by
your team of developers.

Lesson Objectives
After completing this lesson, you will be able to:

• Explain how to create and configure a new mobile app by using the Azure portal.

• Explain how to configure external authentication providers in a mobile app.

• Describe how to deploy a mobile app by using a publishing profile or by using continuous
deployment.

• Describe how to implement a mobile app by using the Azure portal.

Creating and configuring Mobile Apps

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 63/91
6/1/2017 Module 5: Implementing Azure App Service

The Mobile Apps feature provides a complete platform for developing mobile apps that users
can use on almost any device. You can use familiar tools and SDKs to develop your mobile
apps, and then deploy them by using the same deployment methods that you used for web
apps. The following are the most important features of Mobile Apps:

• Single sign­on. You can enable authentication for your mobile app to use Azure AD, or
other cloud providers, such as Facebook, Google, Twitter, and Microsoft account.

• Offline synchronization. You can build apps that can work offline and then synchronize the
data when the device becomes online.

• Push notifications. You can benefit from the push notification engine that delivers large
number of notifications to devices for events that happened in the cloud.

• Auto scaling. You can configure auto­scaling of instances based on the utilization for mobile
apps that are created in the Standard or Premium servicing tier.

• WebJobs. You can use WebJobs for background processes.

• Connect to a SaaS API. You can integrate your mobile app with cloud applications, such as
Office 365, Salesforce, Dropbox, and more.

• Virtual network integration. You can connect mobile apps with background services, such
as databases that can run on a virtual machine that is a part of Azure virtual network. You
can also connect the mobile apps with on­premises servers.

• Staging environment. You can create multiple staging environments to test your mobile app
before you move it to the production environment.

To create a new mobile app, perform the following steps:

1. Sign in to the Azure portal.

2. On the toolbar to the left, click NEW, select the Web+Mobile link, and then click
Mobile App.

3. In the Mobile App blade, in the App Service Name text box, type a unique valid URL
for the mobile app. The mobile app must be unique within the azurewebsites.net domain.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 64/91
6/1/2017 Module 5: Implementing Azure App Service

4. In the Resource Group drop­down list, select an existing resource group or create a new
resource group.

5. In the App Service plan/location drop­down list, select an existing plan or create a new
App Service plan.

6. Click Create to finish the creation of the mobile app.

7. After the backend for the mobile app is created in the Settings blade, click the Quick
start link.

8. In the Quick start blade, choose the language for the business logic code. Work with your
developer team to choose the language that you want.

9. If you have chosen Windows, click the Connect a database section.

10. In the Data connections blade, click Add.

11. In the Add data connection blade, select SQL Database, and then click the Configure
required settings link.

12. In the Database blade, type a descriptive name, select Pricing ties, and then click
Configure required settings to configure the required settings for the server.

13. In the New Server blade, in the Server name text box, type the unique name for the
server. The server name will be appended with the Microsoft­owned public domain
name database.windows.net.

14. In the Server admin login text box, type the administrator account, in the Password
and Confirm Password text boxes, type the administrator password.

15. Select Allow azure services to access server, and then click OK to confirm the creation
of the server.

16. In the New database blade, click OK.

17. In the Add data connection blade, click OK.

18. In the Windows (C#), under the Create a table API section, select the backend language
as C# or Node.js. 

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 65/91
6/1/2017 Module 5: Implementing Azure App Service

19. Click the Download link, and save the compressed files on your computer. These files
contain the startup project that you can open in Visual Studio, develop the code, and
then publish it to Azure.

After you create the backend for the mobile app, the next logical step is to develop and publish
its code in Azure. You can develop your mobile app for iOS, Windows, or Android by using
the similar development environment that you used for web apps. Microsoft provides SDKs
for these platforms that you can integrate with Visual Studio.

You can download sample code for developing your mobile apps based on the platform. The
sample code is preconfigured to work with your mobile app.

Configuring authentication

Azure and social­networking sites are very popular, and a majority of your app’s potential
users typically have Azure AD, Microsoft, Facebook, Twitter, or Google user accounts
already. They also trust these services because they use them on a regular basis. When you
enable users to authenticate in your mobile app with the credentials from these external
services, you make it easier for them, as they do not have to create a new account for your
app and remember new credentials.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 66/91
6/1/2017 Module 5: Implementing Azure App Service

To configure your mobile app to use Azure AD as an identity provider, perform the following
steps:

1. In the Azure portal, click the mobile app that you want to configure.

2. In the web app blade, click the All Settings link, and then in the Settings blade, click the
Authentication/Authorization link.

3. In the Authentication/Authorization blade, under the App Service Authentication section,
click On to configure authentication and authorization for your mobile app.

4. In the Authentication Provider section, click Azure Active Directory.

5. In the Azure Active Directory Settings blade, under the Management mode section, click
Express. This will create a new registration for the mobile app. You also can use existing
Active Directory App registration.

6. Click OK to confirm Azure AD registration.

7. In the Authentication /Authorization blade, click Save to register the authentication
provider.

Note: You can also provide configuration settings manually by creating a registration in
Azure AD, and then use that information in App Service. This procedure is explained
in Module 9 “Implementing Azure AD” in the topic “Integrating applications with
Azure AD”.

For mobile apps that require greater security, you can prevent invoking APIs anonymously.
Based on the platform that you choose to develop your mobile app, you can configure this
differently:

• Node.js. Add the following line to the Node.js server script:

table.access =”authenticated”

• .NET (C#). Add the Authorize attribute to the controller class.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 67/91
6/1/2017 Module 5: Implementing Azure App Service

The next step is to configure the app to authenticate users before requesting resources from
the mobile app.

You can do that by configuring the authentication provider in the mobile app code. For
example, to add an authentication provider such as Facebook, use the following section in the
code in your MainPage.cs project file:

user = await App.MobileService

.LoginAsync(MobileServiceAuthenticationProvider.Facebook);

You also can configure caching of the authentication token on the client device. This can
improve the performance of a mobile app, because the authentication token can be retrieved
from the local cache instead of retrieving it from the authentication provider.

Deploying a mobile app

Deploying mobile apps is not different from deploying web apps. You can use several
deployment methods to deploy your mobile apps. You can copy the files manually by using
FTP or you can synchronize the files and folders to App Service from a cloud storage service,

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 68/91
6/1/2017 Module 5: Implementing Azure App Service

such as OneDrive or Dropbox. App Service also supports deployment from Web Deploy that
is included in Visual Studio, WebMatrix, and Visual Studio Team Services.

From the Azure portal, you can download a starter project for your mobile app. You can
import this project into Visual Studio 2015 and add custom code. When you complete the
mobile app, you can import a publishing profile into your project, as you did for a web app.
You then can use this publishing profile to deploy your completed mobile app to Azure by
using the publishing wizard.

To deploy your project to Azure by using Visual Studio, perform the following steps:

1. In Visual Studio, open your project that contains the MVC application that you plan to
deploy in Azure.

2. In Solution Explorer, right­click your project, and then select Publish.

3. In the Publish Web dialog box, follow the Publish Web wizard.

4. On the Profile tab, in the Select a publish target section, select Microsoft Azure App
Service.

5. In the App Service dialog box, sign in to your Azure subscription, select your
subscription, select a resource group or create a new resource group, select an existing
mobile app or create a new mobile app, and then click OK.

6. On the Connection tab, select the publishing method to be Web Deploy, and then
verify the site name, user name, and the destination URL. You can click Validate
Connection to verify the existence of the new mobile app and the connectivity to the
App Service. Click Next to proceed to next step.

7. On the Settings tab, verify that Release is selected from the Configuration drop­down
menu, and then click Next.

8. On the Preview tab, click Publish to begin the process of copying files to the Azure
server.

9. Upon successful deployment, the default browser will automatically open the URL of
deployed mobile app.
https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 69/91
6/1/2017 Module 5: Implementing Azure App Service

Alternatively, you can use a Git repository to download starter projects for your mobile app
source code. The following is process of setting up continuous deployment:

1. Install Git from the official build http://git­scm.com/download/win.

2. Create a local repository, and then initialize by running the command git init.

3. Set the credentials to push the changes from your local repository.

4. Configure continuous deployment by providing the Git URL.

Demonstration: Implementing a mobile app
In this demonstration, you will learn how to create a new mobile app.

Demonstration Steps

1. In the Azure portal, create a new mobile app by specifying a unique valid URL.

2. Select an existing resource group or create a new group named AdatumMobileRG, and
then select the WebAppStandardPlan App Service plan.

3. Navigate to the newly created Mobile App. In the Quick start blade, choose Windows
(C#) as the language for the business logic code, and then click the Connect a database
section.

4. In the Data connections blade, click Add.

5. In the Add data connection blade, select SQL Database, and then specify
AdatumMobileDB as the database name and choose S0 Standard as its pricing tier.
Create a new SQL server with admin user Instructor and password Pa$$w0rd.

6. In the Windows (C#) blade, under the Create a table API section, select C# as the
backend language.

7. Click the Download link, and save the compressed files on your computer. These files
contain the startup project that you can open in Visual Studio, develop the code, and
then publish to Azure.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 70/91
6/1/2017 Module 5: Implementing Azure App Service

Lesson 7: Traffic Manager

If you are running a large global web app, you might want to scale out the web app to multiple
datacenters. This helps in providing rapid response to user requests from a web server that is
close to their physical location. Alternatively, you might want to increase availability of your
web app by providing failover web apps that take over in case the primary web app has a
problem. You can set up these scenarios by using Azure Traffic Manager. In this lesson, you
will learn how to configure and use Traffic Manager to support highly responsive and available
web apps.

Lesson Objectives
After completing this lesson, you will be able to:

• Describe how Traffic Manager distributes requests to multiple web apps.

• Explain how to configure DNS prefixes and endpoints for Traffic Manager.

• Describe the best practices for a Traffic Manager configuration.

• Explain how to distribute requests to webs apps by using Traffic Manager.

Overview of Traffic Manager

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 71/91
6/1/2017 Module 5: Implementing Azure App Service

When you create an app, you must choose an Azure datacenter where the app will be hosted.
If you choose a Basic, Standard, or Premium tier service plan, you can create multiple
instances of your app to increase capacity and resilience to failure. These instances will be in
the same Azure datacenter and have the requests automatically distributed by the Azure load
balancer.

However, you also might want to distribute the load across app services that are located in
different Azure datacenters. You can do this distribution by using Traffic Manager. Traffic
Manager provides load balancing by applying intelligent DNS queries between endpoints
located in different Azure regions. These endpoints can include cloud services that connect to
virtual machines, PaaS cloud services that connect to roles, and app services. You can
configure load balancing to support failover or to ensure that users connect to an endpoint that
is close to their physical location for higher performance.

How Traffic Manager works

A client resolves a FQDN to an IP address through Traffic Manager in the following way:

• The user requests a FQDN, for example by typing it into a browser address bar or by
clicking a link. In this example, the user requests www.adatum.com.

• In the DNS, the requested FQDN is forwarded to a traffic manager URL by using a
CNAME record. Administrators must configure such a record in DNS in order to use
Traffic Manager with their own domains. The traffic manager URL must be within the
trafficmanager.net domain.

• Traffic Manager monitors the endpoints configured for the requested traffic manager URL.
It returns the IP address of one endpoint. The endpoint that it chooses depends on the load­
balancing method that you configure.

• The client receives the IP address and makes a connection to the web app’s endpoint.

Note: Traffic Manager can be used to distribute load across web apps, mobile apps,
PaaS cloud services, IaaS cloud services, public IP address, or external endpoints.
Therefore, Traffic Manager is useful for more than just web apps. In fact, it is a

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 72/91
6/1/2017 Module 5: Implementing Azure App Service

generic Azure service that you can use to increase performance and availability for
many endpoints within, and outside of, Azure.

How to implement Traffic Manager

The following are the steps to implement Traffic Manager:

1. Deploy endpoints that contain the same content and apps across different Azure
datacenters.

2. Choose a domain prefix for your Traffic Manager profile that is unique.

3. Create a Traffic Manager profile with appropriate routing methods.

4. Add endpoints to your Traffic Manager profile to load balance the client requests.

5. Configure monitoring for your endpoints to identify that they are online and can serve
client requests.

6. Configure your company domain to point to your Traffic Manager profile.

You can configure Traffic Manager by using the classic deployment model and the Azure
Resource Manager deployment model. In the classic deployment model, Traffic Manager uses
a load­balancing method to decide how to distribute the client requests. In the Azure Resource
Manager deployment model, the same load­balancing method is known as the traffic routing
method, which supports the following three type of routing:

• Performance

• Weighted (round robin in the classic deployment)

• Priority (failover in the classic deployment)

Note: If you create Traffic Manager profiles by using classic deployment, they are not
available by using Azure Resource Manager, and vice versa.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 73/91
6/1/2017 Module 5: Implementing Azure App Service

You can configure three types of Traffic Manager endpoints:

• Azure endpoints that represent services hosted in Azure, such as web apps, cloud services,
or public IP addresses

• External endpoint that are used to identify the services hosted outside of Azure, such as
your web app that is running at an ISP

• Nested profiles that are used to implement nested hierarchies of different Traffic Manager
profiles.

External endpoints

You can add an endpoint to a Traffic Manager profile even if that endpoint is external to
Azure. For example, consider the scenario in which A. Datum Corporation has a web app
running at an ISP. You want to move this web app into Azure, but because the web app is
mission critical, you want to perform the move in stages. You will add instances of the web
app in Azure but want the ISP­hosted web app to continue responding to requests. If the
Azure instances fail, you want all web requests to be forwarded to the ISP­hosted instance.
You can build this configuration by adding the ISP­hosted web app as an external endpoint to
the Traffic Manager profile, which also includes the Azure web apps as endpoints.

To configure an external endpoint, use the New­AzureRMTrafficManagerProfile command
and specify the value ExternalEndpoint for type parameter.

In this example, the command adds an external endpoint to a performance­based Traffic
Manager profile:

$profile = Get-AzureRMTrafficManagerProfile -Name "myprofile" –


ResourceGroup AdatumRG
New-AzureRmTrafficManagerEndpoint –Name ExtEuro –ProfileName
MyProfile –ResourceGroupName AdatumRG –Type ExternalEndpoints -
Target app-eu.adatum.com –EndpointStatus Enabled

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 74/91
6/1/2017 Module 5: Implementing Azure App Service

Weighted routing method

If you choose the weighted routing method for your Traffic Manager profile, Traffic Manager
distributes the load approximately equally between the endpoints. If there are three endpoints
in the profile, one third of Traffic Manager responses will forward requests to the first
endpoint. An equal proportion of responses will forward requests to the second and third
endpoints.

Note: Sometimes caching and other issues can distort the distribution of traffic. For
example, if a proxy server with a large number of clients caches a Traffic Manager
response, all clients that use that proxy server will connect to the same endpoint while
that response remains in the cache. However, if there are a large number of clients
across the Internet, this distortion tends to average out and the distribution of traffic
becomes approximately equal.

Sometimes, however, you would prefer an unequal distribution of traffic. For example, if one
endpoint is a web app in the Standard tier, you can scale it more easily than a web app in the
Basic tier. For such situations, you can bias the distribution of load by specifying a weight for
each endpoint. Endpoints with larger weights receive more traffic. You can specify weights
between 1 and 1,000. All endpoints have a default weight of 1.

The following command adds a new endpoint with a specific weight to a Traffic Manager
profile:

$endpoint = Get-AzureRmTrafficManagerEndpoint -Name myendpoint -


ProfileName myprofile -ResourceGroupName AdatumRG -Type
ExternalEndpoints
$endpoint.Weight = 20
Set-AzureRmTrafficManagerEndpoint -TrafficManagerEndpoint
$endpoint

Nested profiles

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 75/91
6/1/2017 Module 5: Implementing Azure App Service

In most cases, a Traffic Manager endpoint is either a web or mobile app, a PaaS cloud
service, or a virtual machine in an IaaS cloud service. However, you can also specify a Traffic
Manager profile as an endpoint. This creates a nested profile, in which a parent profile
contains one or more child profiles.

You can use this technique to increase the flexibility of load balancing. For example, you could
set up a parent profile that uses performance load balancing to distribute the load over several
endpoints around the world. Traffic Manager sends client requests to the endpoint that is
closest to the user. Within one of those endpoints, you could use round­robin load balancing in
a child profile to distribute the load equally between two web apps.

Configuring Traffic Manager

Before you can use Traffic Manager to distribute the load to two or more app services, you
must create those apps in different locations and deploy identical app content to all the sites.
Both content and configuration should be identical on every app you use in a Traffic Manager
set. After you complete the deployment, perform the following tasks to configure Traffic
Manager:

1. Sign in to Azure portal.

2. On the hub menu to the left, click New, select the Networking link, and then click the
Traffic Manager profile link.
https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 76/91
6/1/2017 Module 5: Implementing Azure App Service

3. In the Create Traffic Manager profile blade, in the Name text box, type the unique name
that will be append with the trafficmanager.net domain.

4. Choose a routing method. You can choose from:

o Priority. Traffic Manager forwards all traffic to the first endpoint unless that
endpoint is offline.
o Weighted. Traffic Manager distributes traffic equally between all endpoints.
o Performance. Traffic Manager forwards each request to the nearest endpoint to
the client. This increases performance because with endpoints located around the
world, you can provide the web app from a location close to the user.

5. In the Settings blade, click the Endpoints link.

6. In the Endpoints blade, click Add to add endpoints to the Traffic Manager profile. Each
endpoint is a web app in a different physical location.

7. In the Settings blade, click the Configuration link.

8. In the Configuration blade, you can change the routing method, define time to live (TTL)
parameter for the record, and configure monitoring. Traffic Manager polls each endpoint
in the profile to confirm that it is online. You can use TCP or HTTP for this monitoring.
If you use HTTP, you can specify a page that the Traffic Manager will request each
time. You must ensure this page exists for each endpoint in the Traffic Manager profile.

You can also configure Traffic Manager by using PowerShell. To configure, perform the
following steps:

1. Start Azure PowerShell, and then sign in to your subscription by running the following
command:

Login-AzureRMAccount

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 77/91
6/1/2017 Module 5: Implementing Azure App Service

2. If you have multiple subscriptions, select the one in which you are going to create the
Traffic Manager profile by running the following command:

Set-AzureRmContext SubscriptionName “Name of your


subscription”

3. Create a new resource group by running the following command:

New-AzureRMResourceGroup –Name AdatumRG –Location centralus

4. Create the Traffic Manager profile with the name Myprofile. Use the Performance
routing method with the relative DNS name adatum. Provide a TTL value of 30
seconds and HTTP as the monitoring protocol:

$profile = New-AzureRmTrafficManagerProfile –Name MyProfile -


ResourceGroupName AdatumRG -TrafficRoutingMethod Performance
-RelativeDnsName adatum -Ttl 30 -MonitorProtocol HTTP -
MonitorPort 80 -MonitorPath "/"

5. Add the first endpoint to the Traffic Manager profile by running the following command:

$webapp1 = Get-AzureRMWebApp -Name webapp1


Add-AzureRmTrafficManagerEndpointConfig –EndpointName
webapp1ep –TrafficManagerProfile $profile –Type
AzureEndpoints -TargetResourceId $webapp1.Id –EndpointStatus
Enabled

6. Add the second endpoint to the Traffic Manager profile by running the following
command:

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 78/91
6/1/2017 Module 5: Implementing Azure App Service

$webapp2 = Get-AzureRMWebApp -Name webapp1


Add-AzureRmTrafficManagerEndpointConfig –EndpointName
webapp2ep –TrafficManagerProfile $profile –Type
AzureEndpoints -TargetResourceId $webapp2.Id –EndpointStatus
Enabled

7. Update the Traffic Manager profile with the changes by running the following command:

Set-AzureRMTrafficManagerProfile –TrafficManagerProfile $profile

Enabling and disabling endpoint and profiles

Certain configurations of Traffic Manager might require you to enable or disable some
endpoints or even the entire Traffic Manager profile. You can use the Enable­
AzureRMTrafficManagerProfile or Disable­AzureRMTrafficManagerProfile command to
enable or disable a Traffic Manager profile. For example:

Enable-AzureRmTrafficManagerProfile -Name MyProfile -


ResourceGroupName AdarumRG
Disable-AzureRmTrafficManagerProfile -Name MyProfile -
ResourceGroupName AdarumRG

To enable or disable a Traffic Manager endpoint, use the Enable­
AzureRMTrafficManagerEndpoint and Disable­AzureRMTrafficManagerEndpoint
commands.

Traffic Manager best practices

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 79/91
6/1/2017 Module 5: Implementing Azure App Service

Follow these rules and best practices to ensure the best resilience from Traffic Manager:

Best Practice:
• You must use a unique Traffic Manager prefix. All Traffic Manager profiles must
have a FQDN within the trafficmanager.net DNS domain. Ensure you choose a
unique prefix that is not already in use. The portal indicates clearly when your
chosen prefix is not unique.

• Keep in mind implications of changing the DNS TTL value. This value determines
how often the web browser’s local caching name server will query Traffic Manager
for the IP address of the endpoint. When you change any endpoints in a profile, it
might take up to this time for changes to reach all clients.

• Endpoints should all be in the same subscription. You can add endpoints to the
Traffic Manager profile in a different subscription, such as a partner organization’s
subscription. You also can add endpoints that are external to Azure. However,
Traffic Manager will not remove external endpoints automatically from the profile if
they are deprovisioned. You must delete them manually.

• Remember that you can use only production endpoints. You cannot add staging
slots to a Traffic Manager profile. If you need to add staging slots, you can add
them as external endpoints.

• Name endpoints clearly. Traffic Manager profiles can include many endpoints;
administrators might be confused if you do not ensure the endpoint names are
descriptive and include the endpoint’s location.


https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 80/91
6/1/2017 Module 5: Implementing Azure App Service

Make endpoints consistent. If the content and configuration of all the endpoints in
the Traffic Manager profile are not identical, the response sent to users might be
unpredictable.

• Disable endpoints for web app maintenance. You can perform maintenance
operations on an endpoint, such as updating a deployment, without causing any
service interruptions by redirecting the traffic to other endpoints. To do this, disable
the endpoint you want to maintain before you begin your administrative actions.
Traffic Manager will forward all traffic to other endpoints until you finish and
reenable this endpoint.

Demonstration: Configuring Traffic Manager
In this demonstration, you will learn how to:

• Create a new Traffic Manager profile.

• Add an endpoint to a Traffic Manager profile by using the Azure portal.

• Test Traffic Manager.

Demonstration Steps
Create a Traffic Manager profile

1. In the Azure portal, create a new Traffic Manager profile in the AdatumTMRG
resource group.

2. Select Performance for the Routing Method and choose the Azure region closest to your
location.

Add endpoints and configure Traffic Manager

1. In the Traffic Manager, add the web app endpoint representing the web app that you
created in the demonstration “Deploying a Web App by using Web deploy”

2. Set the TTL to 30 seconds.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 81/91
6/1/2017 Module 5: Implementing Azure App Service

Test Traffic Manager

1. Open a new Internet Explorer tab with the URL representing the new Traffic Manager
profile. Verify that Internet Explorer displays A. Datum’s web app.

2. From the Command Prompt, run the following command:

nslookup dnsname

Where dnsname is the DNS NAME of the Traffic Manager profile.

3. Note the aliases that are returned.

Lab: Implementing web apps

Scenario
The A. Datum Corporation’s public­facing web app currently runs on an IIS web server at the
company’s chosen ISP. A. Datum wants to migrate this web app into Azure. You must test the
Web Apps functionality by setting up a test A. Datum web app. An internal team provides you
with a test web app to deploy. You must ensure that they can continue to stage changes to the
test web app before deploying those changes to the public­facing site. A. Datum is a global
company, so you also want to test Azure Traffic Manager, and show your organization’s
decision makers how it distributes traffic to instances close to users of the web app.

Objectives
After completing this lab, you will be able to:

• Create a new web app.

• Deploy a web app.

• Manage web apps.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 82/91
6/1/2017 Module 5: Implementing Azure App Service

• Implement Traffic Manager to load­balance web apps.

Lab Setup

Estimated Time: 60 minutes

Virtual machine: 20533C­MIA­CL1

User name: Student

Password: Pa$$w0rd

Before you begin this lab, ensure that you perform the “Preparing the Azure environment”
demonstration tasks at the beginning of this module’s first lesson, and that the setup script is
complete.

Exercise 1: Creating web apps

Scenario

You must set up a test web app in Azure. As the first step in the setup process, you want to
create a new web app. Later in this lab, you will deploy this web app to the test web app.

The main tasks for this exercise are as follows:

1. Create a web app

2. Add a deployment slot

3. Configure deployment credentials

Task 1: Create a web app

1. Ensure that the MSL­TMG1 and 20533C­MIA­CL1 virtual machines are running, and then sign in to
20533C­MIA­CL1 as Student with the password Pa$$w0rd.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 83/91
6/1/2017 Module 5: Implementing Azure App Service

2. In Internet Explorer, browse to http://portal.azure.com, and then sign into the portal by using a
Microsoft account that is either the Service Admin or co­admin of your subscription.

3. To create a new web app, use the following information:

o App name: any unique valid server name
o Resource Group: AdatumLabWebRG
o Web Hosting Plan Name: WebAppStandardPlan
o Pricing tier: S1 Standard
o Location: a location near you

Task 2: Add a deployment slot

1. In the Azure portal, add a new deployment slot to the web app that you created in the first task,
using the following information:

a. Name: Staging
b. Configuration Source: choose the web app you created in Task 1

2. Open Azure PowerShell window and sign in to the Azure subscription with a Microsoft account that
is either the Service Admin or co­admin of your subscription.

3. If you have multiple subscriptions, select the target one by running the Azure PowerShell Set­
AzureRmContext cmdlet.

4. Use the Azure PowerShell Get­AzureRMWebApp and Get­AzureRMWebAppSlot cmdlets to
identify the web app and staging slot that you created.

5. Keep the Azure PowerShell window open.

Task 3: Configure deployment credentials

• Use the Settings blade to set the following deployment credentials for the web app that you created in
the first task:

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 84/91
6/1/2017 Module 5: Implementing Azure App Service

o FTP/Deployment User Name: ftpadminXXXX (replace XXXX is a unique number)
o Password: Pa$$w0rd

Result: After completing this exercise, you should have created a new web app in the
Azure portal, and configured the new web app with deployment slots and credentials.

Exercise 2: Deploying a web app

Scenario

Now that you created a web app in Azure, and added a deployment slot for the web app, you
can publish the internally developed web app that the A. Datum web­development team
supplied. In this exercise, you will use a publishing profile in Visual Studio 2015 to connect to
the new web app and deploy the web content.

The main tasks for this exercise are as follows:

1. Obtain a publishing profile

2. Deploy a web app

Task 1: Obtain a publishing profile

1. From the Azure portal, download the publish profile for the Web app you created in Exercise 1.

2. Open the following web­application project in Visual Studio 2015:

o D:\LabFiles\Lab05\Starter\AdatumWebsite\AdatumWebsite.sln

3. Start debugging the web application, examine the contents, and then close Internet Explorer.

Note: When you start the web application in Visual Studio, the web app runs in IIS Express on
your local workstation.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 85/91
6/1/2017 Module 5: Implementing Azure App Service

Task 2: Deploy a web app

1. In Visual Studio, start the Publish Wizard for the AdatumWebsite project, and then import the
.PublishSettings file that you downloaded in task 1 of this exercise.

2. Verify that the publish settings file includes correct connection information.

3. Ensure that the Release configuration is used for the published web app.

4. Preview the file changes, and then Publish the new website to Azure.

Note: The publish operation may take approximately two to three minutes. When the
operation is complete, Microsoft Edge opens and displays the new web app hosted in
Azure.

5. Verify that A. Datum’s web app is open in Microsoft Edge, and then verify the web app’s current
address.

6. Close the Home Page tab.

7. Close Visual Studio.

Result: After completing this exercise, you should have a deployed a web app hosted in
Azure that you can open with any common web browser.

Exercise 3: Managing web apps

Scenario

The web­deployment team created an updated style sheet for the A. Datum’s test web app.
You have to demonstrate to the decision makers how you can deploy these changes to a
staging slot, and then test them, before you deploy to the production A. Datum web app. In
this exercise, you will upload the new web app to the staging slot that you created in Exercise
1, and you then will move the new site into the production slot.

The main tasks for this exercise are as follows:
https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 86/91
6/1/2017 Module 5: Implementing Azure App Service

1. Deploy a web app for staging

2. Swap deployment slots

3. Roll back a deployment

Task 1: Deploy a web app for staging

1. In the Azure portal, download a publishing profile for the Staging slot for your web app.

2. Open the following project in Visual Studio:

o D:\LabFiles\Lab05\Starter\NewAdatumWebsite\AdatumWebsite.sln

3. Publish the new web app, and then import the staging publish settings file that you just downloaded.

4. Validate the connection, and then choose the Release configuration.

5. Publish the new web app to the Staging slot.

6. Close Internet Explorer and Visual Studio.

Task 2: Swap deployment slots

1. In Internet Explorer, access the web app that you created in Exercise 1.

2. Notice that the color scheme has not changed, because the Web app with the new color scheme is
still in the staging slot. Close the A. Datum web app.

3. From the Settings blade of your web app, open the Deployments Slots blade, and swap the staging
and production web­app slots.

4. When the swap completes, browse the web app, and notice that the color scheme is new.

5. Close the tab that displays the A. Datum’s web app.

Task 3: Roll back a deployment

1. In the Azure portal, swap the staging and production slots again.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 87/91
6/1/2017 Module 5: Implementing Azure App Service

Note: By swapping the slots a second time, you simulate a deployment rollback.

2. When the swap is complete, browse the web app. Notice that the color scheme is reverted to the
old scheme.

3. Close the A. Datum tab in Internet Explorer.

Result: After completing this exercise, you should have an updated web app staged and
published in Azure.

Exercise 4: Implementing Traffic Manager

Scenario

Because A. Datum is a global brand, you must ensure that the A. Datum web apps respond
rapidly to requests from multiple locations around the world. You must evaluate Traffic
Manager to see if it can ensure web content is served from a location that is close to users.
You have to set up Traffic Manager to serve content from two different Azure regions.

The main tasks for this exercise are as follows:

1. Deploy a web app to another region

2. Create a Traffic Manager profile

3. Add endpoints, and configure Traffic Manager

4. Test Traffic Manager

5. Reset the Azure environment

Task 1: Deploy a web app to another region

1. In Azure PowerShell, obtain a list of all the web apps in your Azure subscription by using the Get­
AzureRMWebApp cmdlet. Note the name of your original web app and location.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 88/91
6/1/2017 Module 5: Implementing Azure App Service

2. Choose an Azure region that is different from the location of the original web app. This will become
the “SecondLocation”.

3. Use the New­AzureRMResourceGroup cmdlet to create a new resource group named
AdatumLabWebRG2.

4. Use the New­AzureRMAppServicePlan cmdlet to create a new App Service plan named
StandardPlan with Standard pricing tier in the resource group AdatumLabWebRG2 and the
“SecondLocation”.

5. Use the New­AzureRMWebApp cmdlet to create a new web app. Use the following information for
the web app:

o Resource group: AdatumLabWebRG2
o Name: Use the name of your original web app with the number 2 appended.
o Service plan: StandardPlan
o Location: “SecondLocation”.

6. In the Azure portal, download a publishing profile for the web app you just created (WebappName2).

7. Open the following project in Visual Studio:

o D:\LabFiles\Lab05\Starter\AdatumWebsite\AdatumWebsite.sln

8. Start the Publish Web Wizard, and then import the publish settings file that you just downloaded.

Note: Be sure to add a new publish settings file on the Profile tab, so that you can publish
its content to the new web app.

9. Validate the connection, and then choose the Release configuration.

10. Publish the web app, and then close Internet Explorer and Visual Studio.

Task 2: Create a Traffic Manager profile

• In the Azure portal, create a new Traffic Manager profile by using the following information:

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 89/91
6/1/2017 Module 5: Implementing Azure App Service

o DNS Prefix: Use unique domain name
o Routing Method: Performance
o Resource Group: AdatumLabTMRG

Task 3: Add endpoints, and configure Traffic Manager

1. Use the Settings blade of the Traffic Manager profile to add the web apps that you created in
Exercise 1 and Exercise 4 as endpoints.

2. In the Settings blade, use Configuration link to configure the DNS TTL value to be 30 seconds.

Task 4: Test Traffic Manager

1. Use the DNS name listed in the newly created Traffic Manager profile in the Azure Portal to browse
to the corresponding URL by using Internet Explorer.

2. Use the nslookup command to resolve the DNS name for your Traffic Manager profile.

Note: In the DNS aliases, Traffic Manager returns the web app you created in Exercise 1,
which is the closest to your physical location.

3. In the Azure portal, disable the Traffic Manager endpoint that is the web app you created in Exercise
1.

4. Use the nslookup command to resolve the DNS NAME for your Traffic Manager profile. The results
should differ from those in step 2.

Note: If the aliases are not changed, reissue the nslookup commands until there is a change.

Task 5: Reset the Azure environment

1. Close all open applications without saving any files.

2. On the taskbar, right­click Windows PowerShell, and then click Run as administrator. In the
User Account Control dialog box, click Yes.

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 90/91
6/1/2017 Module 5: Implementing Azure App Service

3. Type the following command, and then press Enter:

Reset-Azure

4. When prompted (twice), sign in by using the Microsoft account associated with your Azure
subscription.

5. If you have multiple Azure subscriptions, select the one you want the script to target

6. When prompted for confirmation, type y.

Note: This script may remove Azure services in your subscription. Therefore, we recommend
that you use an Azure trial pass that was provisioned specifically for this course, and not your
own Azure account.
The script will take approximately two or three minutes to reset your Azure environment, so that
you are ready for the next lab. The script removes all storage, virtual machines, virtual networks,
cloud services, and resource groups.
Important: The script may not have exclusive access to a storage account so that it can delete
it. If this occurs, you will see an error message. If you find objects remaining after the reset
script is complete, you can rerun the Reset­Azure script, or use the Azure portal to delete all
objects in your Azure subscription manually, with the exception of the default directory. Do not
delete it.

Result: After completing this exercise, you should have a web app set up in two Azure
regions and Traffic Manager configured to distribute requests between them.

Review Information
Review Question(s)

Module Review and Takeaways

Review Question(s)

https://skillpipe.com/es­ES/Book/BookPrintView/221b0e25­dc2b­45f8­a14f­a19b7566e327?ChapterNumber=7 91/91

You might also like