20180116-Azure Webapp Toc
20180116-Azure Webapp Toc
20180116-Azure Webapp Toc
Azure App Service Web Apps (or just Web Apps) is a service for hosting web applications, REST APIs, and mobile
back ends. You can develop in your favorite language, be it .NET, .NET Core, Java, Ruby, Node.js, PHP, or Python.
You can run and scale apps with ease on Windows or Linux VMs (see App Service on Linux).
Web Apps not only adds the power of Microsoft Azure to your application, such as security, load balancing,
autoscaling, and automated management. You can also take advantage of its DevOps capabilities, such as
continuous deployment from VSTS, GitHub, Docker Hub, and other sources, package management, staging
environments, custom domain, and SSL certificates.
With App Service, you pay for the Azure compute resources you use. The compute resources you use is
determined by the App Service plan that you run your Web Apps on. For more information, see App Service plans
in Azure Web Apps.
The following 5-minute video introduces Azure App Service Web Apps.
Next steps
Create your first web app.
ASP.NET
PHP
Node.js
Java
Python
HTML
Introduction to Azure App Service on Linux
10/24/2017 • 2 min to read • Edit Online
Web App is a fully managed compute platform that is optimized for hosting websites and web applications.
Customers can use App Service on Linux to host web apps natively on Linux for supported application stacks. The
following sections lists the application stacks that are currently supported.
Languages
App Service on Linux supports a number of Built-in images in order to increase developer productivity. If the
runtime your application requires is not supported in the built-in images, there are instructions on how to build
your own Docker image to deploy to Web App for Containers.
Ruby 2.3
Deployments
FTP
Local Git
GitHub
Bitbucket
DevOps
Staging environments
Azure Container Registry and DockerHub CI/CD
Scaling
Customers can scale web apps up and down by changing the tier of their App Service plan
Locations
Check the Azure Status Dashboard.
Limitations
The Azure portal shows only features that currently work for Web App for Containers. As we enable more
features, they will become visible on the portal.
Some features, such as virtual network integration, Azure Active Directory/third-party authentication, or Kudu site
extensions, are not available yet. Once these features are available, we will update our documentation and blog
about the changes.
App Service on Linux is only supported with Basic and Standard app service plans and does not have a Free or
Shared tier. The following are also important restrictions for App Service on Linux:
You cannot create Web App for Containers in an App Service plan already hosting non-Linux Web Apps.
When creating Web App for Containers in a resource group containing non-Linux Web Apps, you must create
an App Service plan in a different region than the existing App Service plan.
Troubleshooting
When your application fails to start or you want to check the logging from your app, check the Docker logs in the
LogFiles directory. You can access this directory either through your SCM site or via FTP. To log the stdout and
stderr from your container, you need to enable Docker Container logging under Diagnostics Logs.
You can access the SCM site from Advanced Tools in the Development Tools menu.
Next steps
See the following links to get started with App Service on Linux. You can post questions and concerns on our
forum.
How to use a custom Docker image for Web App for Containers
Using .NET Core in Azure App Service on Linux
Using Ruby in Azure App Service on Linux
Azure App Service Web App for Containers FAQ
SSH support for Azure App Service on Linux
Set up staging environments in Azure App Service
Docker Hub Continuous Deployment with Web App for Containers
Azure App Service, Virtual Machines, Service Fabric,
and Cloud Services comparison
1/2/2018 • 12 min to read • Edit Online
Overview
Azure offers several ways to host web sites: Azure App Service, Virtual Machines, Service Fabric, and Cloud
Services. This article helps you understand the options and make the right choice for your web application.
Azure App Service is the best choice for most web apps. Deployment and management are integrated into the
platform, sites can scale quickly to handle high traffic loads, and the built-in load balancing and traffic manager
provide high availability. You can move existing sites to Azure App Service easily with an online migration tool, use
an open-source app from the Web Application Gallery, or create a new site using the framework and tools of your
choice. The WebJobs feature makes it easy to add background job processing to your App Service web app.
Service Fabric is a good choice if you’re creating a new app or re-writing an existing app to use a microservice
architecture. Apps, which run on a shared pool of machines, can start small and grow to massive scale with
hundreds or thousands of machines as needed. Stateful services make it easy to consistently and reliably store app
state, and Service Fabric automatically manages service partitioning, scaling, and availability for you. Service Fabric
also supports WebAPI with Open Web Interface for .NET (OWIN) and ASP.NET Core. Compared to App Service,
Service Fabric also provides more control over, or direct access to, the underlying infrastructure. You can remote
into your servers or configure server startup tasks. Cloud Services is similar to Service Fabric in degree of control
versus ease of use, but it’s now a legacy service and Service Fabric is recommended for new development.
If you have an existing application that would require substantial modifications to run in App Service or Service
Fabric, you could choose Virtual Machines in order to simplify migrating to the cloud. However, correctly
configuring, securing, and maintaining VMs requires much more time and IT expertise compared to Azure App
Service and Service Fabric. If you are considering Azure Virtual Machines, make sure you take into account the
ongoing maintenance effort required to patch, update, and manage your VM environment. Azure Virtual Machines
is Infrastructure-as-a-Service (IaaS), while App Service and Service Fabric are Platform-as-a-Service (Paas).
Feature Comparison
The following table compares the capabilities of App Service, Cloud Services, Virtual Machines, and Service Fabric
to help you make the best choice. For current information about the SLA for each option, see Azure Service Level
Agreements.
Near-instant X X Deploying an
deployment application or an
application
update to a
Cloud Service, or
creating a VM,
takes several
minutes at least;
deploying an
application to a
web app takes
seconds.
Scale up to larger X X
machines without
redeploy
Web server X X
instances share
content and
configuration,
which means you
don't have to
redeploy or
reconfigure as
you scale.
Seamless X X
platform
switching (easily
move between
32 bit and 64 bit)
WebMatrix X X
support
Access to services X X X X
like Service Bus,
Storage, SQL
Database
Integrated X X
MySQL-as-a-
service support
APP SERVICE (WEB CLOUD SERVICES VIRTUAL
FEATURE APPS) (WEB ROLES) MACHINES SERVICE FABRIC NOTES
Visual Studio X X X X
integration
Remote X X X
Debugging
Support for X X X X
Azure Traffic
Manager
Integrated X X X
Endpoint
Monitoring
Remote desktop X X X
access to servers
Ability to X X X
define/execute
start-up tasks
I'm a web or graphic designer, and I want to design and build websites for my customers
For web developers and designers, Azure App Service integrates easily with a variety of frameworks and tools,
includes deployment support for Git and FTP, and offers tight integration with tools and services such as Visual
Studio and SQL Database. With App Service, you can:
Use command-line tools for automated tasks.
Work with popular languages such as .Net, PHP, Node.js, and Python.
Select three different scaling levels for scaling up to very high capacities.
Integrate with other Azure services, such as SQL Database, Service Bus and Storage, or partner offerings from
the Azure Store, such as MySQL and MongoDB.
Integrate with tools such as Visual Studio, Git, WebMatrix, WebDeploy, TFS, and FTP.
I'm migrating my multi-tier application with a web front-end to the Cloud
If you’re running a multi-tier application, such as a web server that connects to a database, Azure App Service is a
good option that offers tight integration with Azure SQL Database. And you can use the WebJobs feature for
running backend processes.
Choose Service Fabric for one or more of your tiers if you need more control over the server environment, such as
the ability to remote into your server or configure server startup tasks.
Choose Virtual Machines for one or more of your tiers if you want to use your own machine image or run server
software or services that you can't configure on Service Fabric.
My application depends on highly customized Windows or Linux environments and I want to move it to the
cloud.
If your application requires complex installation or configuration of software and the operating system, Virtual
Machines is probably the best solution. With Virtual Machines, you can:
Use the Virtual Machine gallery to start with an operating system, such as Windows or Linux, and then
customize it for your application requirements.
Create and upload a custom image of an existing on-premises server to run on a virtual machine in Azure.
My site uses open source software, and I want to host it in Azure
If your open source framework is supported on App Service, the languages and frameworks needed by your
application are configured for you automatically. App Service enables you to:
Use many popular open source languages, such as .NET, PHP, Node.js, and Python.
Set up WordPress, Drupal, Umbraco, DNN, and many other third-party web applications.
Migrate an existing application or create a new one from the Application Gallery.
If your open source framework is not supported on App Service, you can run it on one of the other Azure web
hosting options. With Virtual Machines, you install and configure the software on the machine image, which can be
Windows or Linux-based.
I have a line -of-business application that needs to connect to the corporate network
If you want to create a line-of-business application, your website might require direct access to services or data on
the corporate network. This is possible on App Service, Service Fabric, and Virtual Machines using the Azure Virtual
Network service. On App Service you can use the VNET integration feature, which allows your Azure applications to
run as if they were on your corporate network.
I want to host a REST API or web service for mobile clients
HTTP-based web services enable you to support a wide variety of clients, including mobile clients. Frameworks like
ASP.NET Web API integrate with Visual Studio to make it easier to create and consume REST services. These
services are exposed from a web endpoint, so it is possible to use any web hosting technique on Azure to support
this scenario. However, App Service is a great choice for hosting REST APIs. With App Service, you can:
Quickly create a mobile app or API app to host the HTTP web service in one of Azure’s globally distributed
datacenters.
Migrate existing services or create new ones.
Achieve SLA for availability with a single instance, or scale out to multiple dedicated machines.
Use the published site to provide REST APIs to any HTTP clients, including mobile clients.
NOTE
If you want to get started with Azure App Service before signing up for an account, go to
https://trywebsites.azurewebsites.net, where you can immediately create a short-lived starter app in Azure App Service for
free. No credit card required, no commitments.
Next Steps
For more information about the three web hosting options, see Introducing Azure.
To get started with the chosen options for your application, see the following resources:
Azure App Service
Azure Cloud Services
Azure Virtual Machines
Service Fabric
Create a .NET Core web app in App Service on Linux
12/18/2017 • 6 min to read • Edit Online
NOTE
This article deploys an app to App Service on Linux. To deploy to App Service on Windows, see Create an ASP.NET Core web
app in Azure.
App Service on Linux provides a highly scalable, self-patching web hosting service using the Linux operating
system. This quickstart shows how to create a .NET Core app on App Service on Linux. You create the web app
using the Azure CLI, and you use Git to deploy the .NET Core code to the web app.
You can follow the steps below using a Mac, Windows, or Linux machine.
Prerequisites
To complete this quickstart:
Install Git
Install .NET Core SDK 1.1
If you don't have an Azure subscription, create a free account before you begin.
md hellodotnetcore
cd hellodotnetcore
In your terminal window, press Ctrl+C to exit the web server. Initialize a Git repository for the .NET Core project.
git init
git add .
git commit -m "first commit"
Click the Cloud Shell button on the menu in the upper right
of the Azure portal.
If you get a 'Conflict'. Details: 409 error, change the username. If you get a 'Bad Request'. Details: 400 error,
use a stronger password.
You create this deployment user only once; you can use it for all your Azure deployments.
NOTE
Record the user name and password. You need them to deploy the web app later.
You generally create your resource group and the resources in a region near you.
When the App Service plan has been created, the Azure CLI shows information similar to the following example:
{
"adminSiteName": null,
"appServicePlanName": "myAppServicePlan",
"geoRegion": "West Europe",
"hostingEnvironmentProfile": null,
"id": "/subscriptions/0000-
0000/resourceGroups/myResourceGroup/providers/Microsoft.Web/serverfarms/myAppServicePlan",
"kind": "linux",
"location": "West Europe",
"maximumNumberOfWorkers": 1,
"name": "myAppServicePlan",
< JSON data removed for brevity. >
"targetWorkerSizeId": 0,
"type": "Microsoft.Web/serverfarms",
"workerTierName": null
}
When the web app has been created, the Azure CLI shows output similar to the following example:
You’ve created an empty web app in a Linux container, with git deployment enabled.
NOTE
The URL of the Git remote is shown in the property, with the format
deploymentLocalGitUrl
https://<username>@<app_name>.scm.azurewebsites.net/<app_name>.git . Save this URL as you'll need it later.
Browse to your newly created web app. Replace <app name> with your web app name.
http://<app name>.azurewebsites.net
Push to Azure from Git
In the local terminal window, add an Azure remote to your local Git repository. This Azure remote was created for
you in Create a web app.
Push to the Azure remote to deploy your app with the following command. When prompted for a password, make
sure that you enter the password you created in Configure a deployment user, not the password you use to log in
to the Azure portal.
This command may take a few minutes to run. While running, it displays information similar to the following
example:
http://<app_name>.azurewebsites.net
The Node.js sample code is running in an web app with built-in image.
Congratulations! You've deployed your first Node.js app to App Service on Linux.
Commit your changes in Git, and then push the code changes to Azure.
Once deployment has completed, switch back to the browser window that opened in the Browse to the app step,
and hit refresh.
The left menu provides different pages for configuring your app.
Clean up resources
In the preceding steps, you created Azure resources in a resource group. If you don't expect to need these
resources in the future, delete the resource group by running the following command in the Cloud Shell:
Next steps
Build a .NET Core and SQL Database web app in Azure App Service on Linux
Create a PHP web app in App Service on Linux
12/14/2017 • 6 min to read • Edit Online
NOTE
This article deploys an app to App Service on Linux. To deploy to App Service on Windows, see Create a PHP web app in
Azure.
App Service on Linux provides a highly scalable, self-patching web hosting service using the Linux operating
system. This quickstart tutorial shows how to deploy a PHP app to Azure App Service on Linux. You create the web
app with built-in image using the Azure CLI in Cloud Shell, and you use Git to deploy the PHP code to the web app.
You can follow the steps below using a Mac, Windows, or Linux machine.
Prerequisites
To complete this quickstart:
Install Git
Install PHP
If you don't have an Azure subscription, create a free account before you begin.
php -S localhost:8080
Click the Cloud Shell button on the menu in the upper right
of the Azure portal.
If you get a 'Conflict'. Details: 409 error, change the username. If you get a 'Bad Request'. Details: 400 error,
use a stronger password.
You create this deployment user only once; you can use it for all your Azure deployments.
NOTE
Record the user name and password. You need them to deploy the web app later.
You generally create your resource group and the resources in a region near you.
When the App Service plan has been created, the Azure CLI shows information similar to the following example:
{
"adminSiteName": null,
"appServicePlanName": "myAppServicePlan",
"geoRegion": "West Europe",
"hostingEnvironmentProfile": null,
"id": "/subscriptions/0000-
0000/resourceGroups/myResourceGroup/providers/Microsoft.Web/serverfarms/myAppServicePlan",
"kind": "linux",
"location": "West Europe",
"maximumNumberOfWorkers": 1,
"name": "myAppServicePlan",
< JSON data removed for brevity. >
"targetWorkerSizeId": 0,
"type": "Microsoft.Web/serverfarms",
"workerTierName": null
}
az webapp create --resource-group myResourceGroup --plan myAppServicePlan --name <app_name> --runtime "PHP|7.0"
--deployment-local-git
When the web app has been created, the Azure CLI shows output similar to the following example:
Local git is configured with url of 'https://<username>@<app_name>.scm.azurewebsites.net/<app_name>.git'
{
"availabilityState": "Normal",
"clientAffinityEnabled": true,
"clientCertEnabled": false,
"cloningInfo": null,
"containerSize": 0,
"dailyMemoryTimeQuota": 0,
"defaultHostName": "<app_name>.azurewebsites.net",
"deploymentLocalGitUrl": "https://<username>@<app_name>.scm.azurewebsites.net/<app_name>.git",
"enabled": true,
< JSON data removed for brevity. >
}
You’ve created an empty new web app, with git deployment enabled.
NOTE
The URL of the Git remote is shown in the property, with the format
deploymentLocalGitUrl
https://<username>@<app_name>.scm.azurewebsites.net/<app_name>.git . Save this URL as you'll need it later.
Browse to the site to see your newly created web app with built-in image. Replace <app name> with your web app
name.
http://<app_name>.azurewebsites.net
Push to the Azure remote to deploy your app with the following command. When prompted for a password, make
sure that you enter the password you created in Configure a deployment user, not the password you use to log in
to the Azure portal.
This command may take a few minutes to run. While running, it displays information similar to the following
example:
http://<app_name>.azurewebsites.net
The PHP sample code is running in a web app with built-in image.
Congratulations! You've deployed your first PHP app to App Service on Linux.
Commit your changes in Git, and then push the code changes to Azure.
Once deployment has completed, switch back to the browser window that opened in the Browse to the app step,
and refresh the page.
You see your web app's Overview page. Here, you can perform basic management tasks like browse, stop, start,
restart, and delete.
The left menu provides different pages for configuring your app.
Clean up resources
In the preceding steps, you created Azure resources in a resource group. If you don't expect to need these resources
in the future, delete the resource group by running the following command in the Cloud Shell:
Next steps
PHP with MySQL
Create a Node.js web app in Azure App Service on
Linux
12/14/2017 • 6 min to read • Edit Online
NOTE
This article deploys an app to App Service on Linux. To deploy to App Service on Windows, see Create a Node.js web app in
Azure.
App Service on Linux provides a highly scalable, self-patching web hosting service using the Linux operating
system. This quickstart shows how to deploy a Node.js app to App Service on Linux using a built-in image. You
create the web app with built-in image using the Azure CLI, and you use Git to deploy the Node.js code to the web
app.
You can follow the steps below using a Mac, Windows, or Linux machine.
Prerequisites
To complete this quickstart:
Install Git
Install Node.js and NPM
If you don't have an Azure subscription, create a free account before you begin.
You use this terminal window to run all the commands in this quickstart.
Change to the directory that contains the sample code.
cd nodejs-docs-hello-world
Run the app locally
Run the application locally by opening a terminal window and using the npm start script to launch the built in
Node.js HTTP server.
npm start
Click the Cloud Shell button on the menu in the upper right
of the Azure portal.
If you get a 'Conflict'. Details: 409 error, change the username. If you get a 'Bad Request'. Details: 400 error,
use a stronger password.
You create this deployment user only once; you can use it for all your Azure deployments.
NOTE
Record the user name and password. You need them to deploy the web app later.
You generally create your resource group and the resources in a region near you.
When the App Service plan has been created, the Azure CLI shows information similar to the following example:
{
"adminSiteName": null,
"appServicePlanName": "myAppServicePlan",
"geoRegion": "West Europe",
"hostingEnvironmentProfile": null,
"id": "/subscriptions/0000-
0000/resourceGroups/myResourceGroup/providers/Microsoft.Web/serverfarms/myAppServicePlan",
"kind": "linux",
"location": "West Europe",
"maximumNumberOfWorkers": 1,
"name": "myAppServicePlan",
< JSON data removed for brevity. >
"targetWorkerSizeId": 0,
"type": "Microsoft.Web/serverfarms",
"workerTierName": null
}
When the web app has been created, the Azure CLI shows output similar to the following example:
NOTE
The URL of the Git remote is shown in the property, with the format
deploymentLocalGitUrl
https://<username>@<app_name>.scm.azurewebsites.net/<app_name>.git . Save this URL as you'll need it later.
Browse to your newly created web app. Replace <app name> with your web app name.
http://<app name>.azurewebsites.net
Push to Azure from Git
In the local terminal window, add an Azure remote to your local Git repository. This Azure remote was created for
you in Create a web app.
Push to the Azure remote to deploy your app with the following command. When prompted for a password, make
sure that you enter the password you created in Configure a deployment user, not the password you use to log in
to the Azure portal.
This command may take a few minutes to run. While running, it displays information similar to the following
example:
http://<app_name>.azurewebsites.net
The Node.js sample code is running in a web app with built-in image.
Congratulations! You've deployed your first Node.js app to App Service on Linux.
response.end("Hello Azure!");
Commit your changes in Git, and then push the code changes to Azure.
Once deployment has completed, switch back to the browser window that opened in the Browse to the app step,
and hit refresh.
The left menu provides different pages for configuring your app.
Clean up resources
In the preceding steps, you created Azure resources in a resource group. If you don't expect to need these resources
in the future, delete the resource group by running the following command in the Cloud Shell:
Next steps
Node.js with MongoDB
1 min to read •
Edit O nline
Create a Ruby App in App Service on Linux
1/4/2018 • 4 min to read • Edit Online
App Service on Linux provides a highly scalable, self-patching web hosting service. This quickstart shows you how
to create a basic Ruby on Rails application you then deploy it to Azure as a Web App on Linux.
Prerequisites
Install Ruby 2.4.1 or higher
Install Git
If you don't have an Azure subscription, create a free account before you begin.
cd hello-world\bin
rails server
Using your web browser, navigate to http://localhost:3000 to test the app locally.
Modify app to display welcome message
Modify the application so it displays a welcome message. First, you must setup a route by modifying the
~/workspace/ruby-docs-hello-world/config/routes.rb file to include a route named hello .
Rails.application.routes.draw do
#For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
root 'application#hello'
end
Change the application's controller so it returns the message as HTML to the browser.
Open ~/workspace/hello-world/app/controllers/application_controller.rb for editing. Modify the
ApplicationController class to look like the following code sample:
Your app is now configured. Using your web browser, navigate to http://localhost:3000 to confirm the root
landing page.
Launch Azure Cloud Shell
The Azure Cloud Shell is a free interactive shell that you can use to run the steps in this article. It has common
Azure tools preinstalled and configured to use with your account. Just click the Copy to copy the code, paste it into
the Cloud Shell, and then press enter to run it. There are two ways to launch the Cloud Shell:
Click the Cloud Shell button on the menu in the upper right
of the Azure portal.
If you get a 'Conflict'. Details: 409 error, change the username. If you get a 'Bad Request'. Details: 400 error,
use a stronger password.
You create this deployment user only once; you can use it for all your Azure deployments.
NOTE
Record the user name and password. You need them to deploy the web app later.
command.
az group create --location westeurope --name myResourceGroup
Use the az appservice plan create command to create an app service plan for your web app.
Next, issue the az webapp create command to create the web app that uses the newly created service plan. Notice
that the runtime is set to ruby|2.3 . Don't forget to replace <app name> with a unique app name.
The output from the command reveals information about the newly created web app as well as the deployment
URL. It should look similar to the following sample. Copy the URL for later use in this tutorial.
Once the web app is created, an Overview page is available to view. Navigate to it. The following splash page is
displayed:
Confirm that the remote deployment operations report success. The commands produce output similar to the
following text:
Once the deployment has completed, restart your web app for the deployment to take effect by using the az
webapp restart command, as shown here:
http://<app name>.azurewebsites.net
NOTE
While the app is restarting, attempting to browse the site results in an HTTP status code Error 503 Server unavailable .
It may take a few minutes to fully restart.
Clean up deployment
After the sample script has been run, the following command can be used to remove the resource group and all
resources associated with it.
App Service provides pre-defined application stacks on Linux with support for specific versions, such as PHP 7.0
and Node.js 4.5. You can also use a custom Docker image to run your web app on an application stack that is not
already defined in Azure. This quickstart shows how to create a web app and deploy the official Nginx Docker
image to it. You create the web app using the Azure CLI.
Click the Cloud Shell button on the menu in the upper right
of the Azure portal.
If you get a 'Conflict'. Details: 409 error, change the username. If you get a 'Bad Request'. Details: 400 error,
use a stronger password.
You create this deployment user only once; you can use it for all your Azure deployments.
NOTE
Record the user name and password. You need them to deploy the web app later.
You generally create your resource group and the resources in a region near you.
When the App Service plan has been created, the Azure CLI shows information similar to the following example:
{
"adminSiteName": null,
"appServicePlanName": "myAppServicePlan",
"geoRegion": "West Europe",
"hostingEnvironmentProfile": null,
"id": "/subscriptions/0000-
0000/resourceGroups/myResourceGroup/providers/Microsoft.Web/serverfarms/myAppServicePlan",
"kind": "linux",
"location": "West Europe",
"maximumNumberOfWorkers": 1,
"name": "myAppServicePlan",
< JSON data removed for brevity. >
"targetWorkerSizeId": 0,
"type": "Microsoft.Web/serverfarms",
"workerTierName": null
}
az webapp create --resource-group myResourceGroup --plan myAppServicePlan --name <app name> --deployment-
container-image-name nginx
In the preceding command, --deployment-container-image-name points to the public Docker Hub image
https://hub.docker.com/r/_/nginx/.
When the web app has been created, the Azure CLI shows output similar to the following example:
{
"availabilityState": "Normal",
"clientAffinityEnabled": true,
"clientCertEnabled": false,
"cloningInfo": null,
"containerSize": 0,
"dailyMemoryTimeQuota": 0,
"defaultHostName": "<app name>.azurewebsites.net",
"deploymentLocalGitUrl": "https://<username>@<app name>.scm.azurewebsites.net/<app name>.git",
"enabled": true,
< JSON data removed for brevity. >
}
http://<app_name>.azurewebsites.net
Congratulations! You've deployed a custom Docker image to Web App for Containers.
Next steps
Use a custom Docker image
Build a .NET Core and SQL Database web app in
Azure App Service on Linux
12/14/2017 • 11 min to read • Edit Online
App Service on Linux provides a highly scalable, self-patching web hosting service using the Linux operating
system. This tutorial shows how to create a .NET Core web app and connect it to a SQL Database. When you're
done, you'll have a .NET Core MVC app running in App Service on Linux.
Prerequisites
To complete this tutorial:
1. Install Git
2. Install .NET Core SDK 1.1.2
If you don't have an Azure subscription, create a free account before you begin.
The sample project contains a basic CRUD (create-read-update-delete) app using Entity Framework Core.
Run the application
Run the following commands to install the required packages, run database migrations, and start the application.
dotnet restore
dotnet ef database update
dotnet run
Navigate to http://localhost:5000 in a browser. Select the Create New link and create a couple to-do items.
Click the Cloud Shell button on the menu in the upper right
of the Azure portal.
Create production SQL Database
In this step, you create a SQL Database in Azure. When your app is deployed to Azure, it uses this cloud database.
For SQL Database, this tutorial uses Azure SQL Database.
Create a resource group
In the Cloud Shell, create a resource group with the az group create command.
A resource group is a logical container into which Azure resources like web apps, databases, and storage accounts
are deployed and managed.
The following example creates a resource group named myResourceGroup in the West Europe location. To see all
supported locations for App Service, run the az appservice list-locations command.
You generally create your resource group and the resources in a region near you.
Create a SQL Database logical server
In the Cloud Shell, create a SQL Database logical server with the az sql server create command.
Replace the <server_name> placeholder with a unique SQL Database name. This name is used as the part of the
SQL Database endpoint, <server_name>.database.windows.net , so the name needs to be unique across all logical
servers in Azure. The name must contain only lowercase letters, numbers, and the hyphen (-) character, and must
be between 3 and 50 characters long. Also, replace <db_username> and <db_password> with a username and
password of your choice.
az sql server create --name <server_name> --resource-group myResourceGroup --location "West Europe" --admin-
user <db_username> --admin-password <db_password>
When the SQL Database logical server is created, the Azure CLI shows information similar to the following
example:
{
"administratorLogin": "sqladmin",
"administratorLoginPassword": null,
"fullyQualifiedDomainName": "<server_name>.database.windows.net",
"id": "/subscriptions/00000000-0000-0000-0000-
000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Sql/servers/<server_name>",
"identity": null,
"kind": "v12.0",
"location": "westeurope",
"name": "<server_name>",
"resourceGroup": "myResourceGroup",
"state": "Ready",
"tags": null,
"type": "Microsoft.Sql/servers",
"version": "12.0"
}
Create a database
Create a database with an S0 performance level in the server using the az sql db create command.
This is the connection string for your .NET Core app. Copy it for use later.
If you get a 'Conflict'. Details: 409 error, change the username. If you get a 'Bad Request'. Details: 400 error,
use a stronger password.
You create this deployment user only once; you can use it for all your Azure deployments.
NOTE
Record the user name and password. You need them to deploy the web app later.
When the App Service plan has been created, the Azure CLI shows information similar to the following example:
{
"adminSiteName": null,
"appServicePlanName": "myAppServicePlan",
"geoRegion": "West Europe",
"hostingEnvironmentProfile": null,
"id": "/subscriptions/0000-
0000/resourceGroups/myResourceGroup/providers/Microsoft.Web/serverfarms/myAppServicePlan",
"kind": "linux",
"location": "West Europe",
"maximumNumberOfWorkers": 1,
"name": "myAppServicePlan",
< JSON data removed for brevity. >
"targetWorkerSizeId": 0,
"type": "Microsoft.Web/serverfarms",
"workerTierName": null
}
When the web app has been created, the Azure CLI shows output similar to the following example:
You’ve created an empty web app in a Linux container, with git deployment enabled.
NOTE
The URL of the Git remote is shown in the property, with the format
deploymentLocalGitUrl
https://<username>@<app_name>.scm.azurewebsites.net/<app_name>.git . Save this URL as you'll need it later.
Next, set ASPNETCORE_ENVIRONMENT app setting to Production. This setting lets you know whether you are running in
Azure, because you use SQLLite for your local development environment and SQL Database for your Azure
environment.
The following example configures a ASPNETCORE_ENVIRONMENT app setting in your Azure web app. Replace the
<app_name> placeholder.
services.AddDbContext<MyDatabaseContext>(options =>
options.UseSqlite("Data Source=localdatabase.db"));
Replace it with the following code, which uses the environment variables that you configured earlier.
If this code detects that it is running in production (which indicates the Azure environment), then it uses the
connection string you configured to connect to the SQL Database.
The Database.Migrate() call helps you when it is run in Azure, because it automatically creates the databases that
your .NET Core app needs, based on its migration configuration.
Save your changes.
Push to Azure from Git
In the local terminal window, add an Azure remote to your local Git repository. This Azure remote was created for
you in Create a web app.
Push to the Azure remote to deploy your app with the following command. When prompted for a password, make
sure that you enter the password you created in Configure a deployment user, not the password you use to log in
to the Azure portal.
This command may take a few minutes to run. While running, it displays information similar to the following
example:
http://<app_name>.azurewebsites.net
Congratulations! You're running a data-driven .NET Core app in App Service on Linux.
Open Views\Todos\Create.cshtml.
In the Razor code, you should see a <div class="form-group"> element for Description , and then another
<div class="form-group"> element for CreatedDate . Immediately following these two elements, add another
<div class="form-group"> element for Done :
<div class="form-group">
<label asp-for="Done" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="Done" class="form-control" />
<span asp-validation-for="Done" class="text-danger"></span>
</div>
</div>
Open Views\Todos\Index.cshtml.
Search for the empty <th></th> element. Just above this element, add the following Razor code:
<th>
@Html.DisplayNameFor(model => model.Done)
</th>
Find the <td> element that contains the asp-action tag helpers. Just above this element, add the following Razor
code:
<td>
@Html.DisplayFor(modelItem => item.CreatedDate)
</td>
That's all you need to see the changes in the Index and Create views.
Test your changes locally
Run the app locally.
dotnet run
In your browser, navigate to http://localhost:5000/ . You can now add a to-do item and check Done. Then it
should show up in your homepage as a completed item. Remember that the Edit view doesn't show the Done
field, because you didn't change the Edit view.
Publish changes to Azure
Once the git push is complete, navigate to your Azure web app and try out the new functionality.
All your existing to-do items are still displayed. When you republish your .NET Core app, existing data in your SQL
Database is not lost. Also, Entity Framework Core Migrations only changes the data schema and leaves your
existing data intact.
Clean up resources
In the preceding steps, you created Azure resources in a resource group. If you don't expect to need these
resources in the future, delete the resource group by running the following command in the Cloud Shell:
Next steps
What you learned:
Create a SQL Database in Azure
Connect a .NET Core app to SQL Database
Deploy the app to Azure
Update the data model and redeploy the app
Stream logs from Azure to your terminal
Manage the app in the Azure portal
Advance to the next tutorial to learn how to map a custom DNS name to your web app.
Map an existing custom DNS name to Azure Web Apps
Build a Ruby and MySQL web app in Azure App
Service on Linux
1/4/2018 • 13 min to read • Edit Online
App Service on Linux provides a highly scalable, self-patching web hosting service using the Linux operating
system. This tutorial shows how to create a Ruby web app and connect it to a MySQL database. When you're
finished, you'll have a Ruby on Rails app running on App Service on Linux.
Prerequisites
To complete this tutorial:
Install Git
Install Ruby 2.3
Install Ruby on Rails 5.1
Install and start MySQL
If you don't have an Azure subscription, create a free account before you begin.
mysql -u root -p
If you're prompted for a password, enter the password for the root account. If you don't remember your root
account password, see MySQL: How to Reset the Root Password.
If your command runs successfully, then your MySQL server is running. If not, make sure that your local MySQL
server is started by following the MySQL post-installation steps.
Exit your server connection by typing quit .
quit
cd rubyrails-tasks
bundle install --path vendor/bundle
default: &default
adapter: mysql2
encoding: utf8
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
username: root
password:
socket: /tmp/mysql.sock
rake db:create
rake db:migrate
Click the Cloud Shell button on the menu in the upper right
of the Azure portal.
You generally create your resource group and the resources in a region near you.
Create a MySQL server
Create a server in Azure Database for MySQL (Preview) with the az mysql server create command.
In the following command, substitute your MySQL server name where you see the <mysql_server_name>
placeholder (valid characters are a-z , 0-9 , and - ). This name is part of the MySQL server's hostname (
<mysql_server_name>.mysql.database.azure.com ), it needs to be globally unique.
az mysql server create --name <mysql_server_name> --resource-group myResourceGroup --location "North Europe" -
-admin-user adminuser --admin-password My5up3r$tr0ngPa$w0rd!
When the MySQL server is created, the Azure CLI shows information similar to the following example:
{
"administratorLogin": "adminuser",
"administratorLoginPassword": null,
"fullyQualifiedDomainName": "<mysql_server_name>.database.mysql.database.azure.com",
"id": "/subscriptions/00000000-0000-0000-0000-
000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DBforMySQL/servers/<mysql_server_name>",
"location": "northeurope",
"name": "<mysql_server_name>",
"resourceGroup": "myResourceGroup",
...
}
NOTE
Azure Database for MySQL (Preview) doesn't currently limit connections only to Azure services. As IP addresses in Azure are
dynamically assigned, it is better to enable all IP addresses. The service is in preview. Better methods for securing your
database are planned.
When prompted for a password, use My5up3r$tr0ngPa$w0rd!, which you specified when you created the
database server.
Create a production database
At the mysql prompt, create a database.
quit
production:
<<: *default
host: <%= ENV['DB_HOST'] %>
port: 3306
database: <%= ENV['DB_DATABASE'] %>
username: <%= ENV['DB_USERNAME'] %>
password: <%= ENV['DB_PASSWORD'] %>
sslca: ssl/BaltimoreCyberTrustRoot.crt.pem
NOTE
The sslca is added and points to an existing .pem file in the sample repository. By default, Azure Database for MySQL
enforces SSL connections from clients. This .pem certificate is how you make SSL connections to Azure Database for MySQL.
For more information, see Configure SSL connectivity in your application to securely connect to Azure Database for MySQL.
export DB_HOST=<mysql_server_name>.mysql.database.azure.com
export DB_DATABASE=sampledb
export DB_USERNAME=railsappuser@<mysql_server_name>
export DB_PASSWORD=MySQLAzure2017
Run Rails database migrations with the production values you just configured to create the tables in your MySQL
database in Azure Database for MySQL (Preview).
When running in the production environment, the Rails application needs precompiled assets. Generate the
required assets with the following command:
rake assets:precompile
The Rails production environment also uses secrets to manage security. Generate a secret key.
rails secret
Save the secret key to the respective variables used by the Rails production environment. For convenience, you use
the same key for both variables.
export RAILS_MASTER_KEY=<output_of_rails_secret>
export SECRET_KEY_BASE=<output_of_rails_secret>
Enable the Rails production environment to serve JavaScript and CSS files.
export RAILS_SERVE_STATIC_FILES=true
Navigate to http://localhost:3000 . If the page loads without errors, the Ruby on Rails application is connecting to
the MySQL database in Azure.
Add a few tasks in the page.
git add .
git commit -m "database.yml updates"
If you get a 'Conflict'. Details: 409 error, change the username. If you get a 'Bad Request'. Details: 400 error,
use a stronger password.
You create this deployment user only once; you can use it for all your Azure deployments.
NOTE
Record the user name and password. You need them to deploy the web app later.
When the App Service plan has been created, the Azure CLI shows information similar to the following example:
{
"adminSiteName": null,
"appServicePlanName": "myAppServicePlan",
"geoRegion": "West Europe",
"hostingEnvironmentProfile": null,
"id": "/subscriptions/0000-
0000/resourceGroups/myResourceGroup/providers/Microsoft.Web/serverfarms/myAppServicePlan",
"kind": "linux",
"location": "West Europe",
"maximumNumberOfWorkers": 1,
"name": "myAppServicePlan",
< JSON data removed for brevity. >
"targetWorkerSizeId": 0,
"type": "Microsoft.Web/serverfarms",
"workerTierName": null
}
When the web app has been created, the Azure CLI shows output similar to the following example:
You’ve created an empty new web app, with git deployment enabled.
NOTE
The URL of the Git remote is shown in the property, with the format
deploymentLocalGitUrl
https://<username>@<app_name>.scm.azurewebsites.net/<app_name>.git . Save this URL as you'll need it later.
az webapp config appsettings set --name <app_name> --resource-group myResourceGroup --settings DB_HOST="
<mysql_server_name>.mysql.database.azure.com" DB_DATABASE="sampledb"
DB_USERNAME="railsappuser@<mysql_server_name>" DB_PASSWORD="MySQLAzure2017"
rails secret
Push to the Azure remote to deploy the Ruby on Rails application. You are prompted for the password you
supplied earlier as part of the creation of the deployment user.
During deployment, Azure App Service communicates its progress with Git.
Congratulations, you're running a data-driven Ruby on Rails app in Azure App Service.
rake db:migrate
params.require(:task).permit(:Description)
params.require(:task).permit(:Description, :Done)
Open the app/views/tasks/index.html.erb file, which is the Index page for all records.
Find the line <th><%= model_class.human_attribute_name(:Description) %></th> and insert the following code directly
below it:
In the same file, find the line <td><%= task.Description %></td> and insert the following code directly below it:
<td><%= check_box "task", "Done", {:checked => task.Done, :disabled => true} %></td>
Test the changes locally
In the local terminal, run the Rails server.
rails server
To see the task status change, navigate to http://localhost:3000 and add or edit items.
Commit all the changes in Git, and then push the code changes to Azure.
git add .
git commit -m "added complete checkbox"
git push azure master
Once the git push is complete, navigate to the Azure web app and test the new functionality.
If you added any tasks, they are retained in the database. Updates to the data schema leave existing data intact.
You see your web app's Overview page. Here, you can perform basic management tasks like stop, start, restart,
browse, and delete.
The left menu provides pages for configuring your app.
Clean up resources
In the preceding steps, you created Azure resources in a resource group. If you don't expect to need these
resources in the future, delete the resource group by running the following command in the Cloud Shell:
Next steps
In this tutorial, you learned how to:
Create a MySQL database in Azure
Connect a Ruby on Rails app to MySQL
Deploy the app to Azure
Update the data model and redeploy the app
Stream diagnostic logs from Azure
Manage the app in the Azure portal
Advance to the next tutorial to learn how to map a custom DNS name to a web app.
Map an existing custom DNS name to Azure Web Apps
Build a PHP and MySQL web app in Azure App
Service on Linux
1/4/2018 • 15 min to read • Edit Online
NOTE
This article deploys an app to App Service on Linux. To deploy to App Service on Windows, see Build a PHP and MySQL web
app in Azure.
App Service on Linux provides a highly scalable, self-patching web hosting service using the Linux operating
system. This tutorial shows how to create a PHP web app and connect it to a MySQL database. When you're
finished, you'll have a Laravel app running on App Service on Linux.
mysql -u root -p
If you're prompted for a password, enter the password for the root account. If you don't remember your root
account password, see MySQL: How to Reset the Root Password.
If your command runs successfully, then your MySQL server is running. If not, make sure that your local MySQL
server is started by following the MySQL post-installation steps.
Create a database locally
At the mysql prompt, create a database.
quit
APP_ENV=local
APP_DEBUG=true
APP_KEY=SomeRandomString
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_DATABASE=sampledb
DB_USERNAME=root
DB_PASSWORD=<root_password>
For information on how Laravel uses the .env file, see Laravel Environment Configuration.
Run the sample locally
Run Laravel database migrations to create the tables the application needs. To see which tables are created in the
migrations, look in the database/migrations directory in the Git repository.
Click the Cloud Shell button on the menu in the upper right
of the Azure portal.
You generally create your resource group and the resources in a region near you.
Create a MySQL server
Create a server in Azure Database for MySQL (Preview) with the az mysql server create command.
In the following command, substitute your MySQL server name where you see the <mysql_server_name>
placeholder (valid characters are a-z , 0-9 , and - ). This name is part of the MySQL server's hostname (
<mysql_server_name>.database.windows.net ), it needs to be globally unique.
az mysql server create --name <mysql_server_name> --resource-group myResourceGroup --location "North Europe" -
-admin-user adminuser --admin-password My5up3r$tr0ngPa$w0rd! --ssl-enforcement Disabled
When the MySQL server is created, the Azure CLI shows information similar to the following example:
{
"administratorLogin": "adminuser",
"administratorLoginPassword": null,
"fullyQualifiedDomainName": "<mysql_server_name>.database.windows.net",
"id": "/subscriptions/00000000-0000-0000-0000-
000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DBforMySQL/servers/<mysql_server_name>",
"location": "northeurope",
"name": "<mysql_server_name>",
"resourceGroup": "myResourceGroup",
...
}
NOTE
Azure Database for MySQL (Preview) doesn't currently limit connections only to Azure services. As IP addresses in Azure are
dynamically assigned, it is better to enable all IP addresses. The service is in preview. Better methods for securing your
database are planned.
When prompted for a password, use $tr0ngPa$w0rd!, which you specified when you created the database server.
Create a production database
At the mysql prompt, create a database.
quit
APP_ENV=production
APP_DEBUG=true
APP_KEY=SomeRandomString
DB_CONNECTION=mysql
DB_HOST=<mysql_server_name>.mysql.database.azure.com
DB_DATABASE=sampledb
DB_USERNAME=phpappuser@<mysql_server_name>
DB_PASSWORD=MySQLAzure2017
TIP
To secure your MySQL connection information, this file is already excluded from the Git repository (See .gitignore in the
repository root). Later, you learn how to configure environment variables in App Service to connect to your database in
Azure Database for MySQL (Preview). With environment variables, you don't need the .env file in App Service.
.env.production doesn't have a valid application key yet. Generate a new one for it in the terminal.
php artisan key:generate --env=production --force
Navigate to http://localhost:8000 . If the page loads without errors, the PHP application is connecting to the
MySQL database in Azure.
Add a few tasks in the page.
git add .
git commit -m "database.php updates"
Deploy to Azure
In this step, you deploy the MySQL-connected PHP application to Azure App Service.
Configure a deployment user
In the Cloud Shell, create deployment credentials with the az webapp deployment user set command. A
deployment user is required for FTP and local Git deployment to a web app. The user name and password are
account level. They are different from your Azure subscription credentials.
In the following example, replace <username> and <password> (including brackets) with a new user name and
password. The user name must be unique. The password must be at least eight characters long, with two of the
following three elements: letters, numbers, symbols.
If you get a 'Conflict'. Details: 409 error, change the username. If you get a 'Bad Request'. Details: 400 error,
use a stronger password.
You create this deployment user only once; you can use it for all your Azure deployments.
NOTE
Record the user name and password. You need them to deploy the web app later.
When the App Service plan has been created, the Azure CLI shows information similar to the following example:
{
"adminSiteName": null,
"appServicePlanName": "myAppServicePlan",
"geoRegion": "West Europe",
"hostingEnvironmentProfile": null,
"id": "/subscriptions/0000-
0000/resourceGroups/myResourceGroup/providers/Microsoft.Web/serverfarms/myAppServicePlan",
"kind": "linux",
"location": "West Europe",
"maximumNumberOfWorkers": 1,
"name": "myAppServicePlan",
< JSON data removed for brevity. >
"targetWorkerSizeId": 0,
"type": "Microsoft.Web/serverfarms",
"workerTierName": null
}
You’ve created an empty new web app, with git deployment enabled.
NOTE
The URL of the Git remote is shown in the property, with the format
deploymentLocalGitUrl
https://<username>@<app_name>.scm.azurewebsites.net/<app_name>.git . Save this URL as you'll need it later.
az webapp config appsettings set --name <app_name> --resource-group myResourceGroup --settings DB_HOST="
<mysql_server_name>.database.windows.net" DB_DATABASE="sampledb" DB_USERNAME="phpappuser@<mysql_server_name>"
DB_PASSWORD="MySQLAzure2017"
You can use the PHP getenv method to access the settings. the Laravel code uses an env wrapper over the PHP
getenv . For example, the MySQL configuration in config/database.php looks like the following code:
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
...
],
Set the application key in the App Service web app by using the az webapp config appsettings set command.
Replace the placeholders <appname> and <outputofphpartisankey:generate>.
az webapp config appsettings set --name <app_name> --resource-group myResourceGroup --settings APP_KEY="
<output_of_php_artisan_key:generate>" APP_DEBUG="true"
APP_DEBUG="true" tells Laravel to return debugging information when the deployed web app encounters errors.
When running a production application, set it to false , which is more secure.
Set the virtual application path
Set the virtual application path for the web app. This step is required because the Laravel application lifecycle
begins in the public directory instead of the application's root directory. Other PHP frameworks whose lifecycle
start in the root directory can work without manual configuration of the virtual application path.
Set the virtual application path by using the az resource update command. Replace the <appname> placeholder.
By default, Azure App Service points the root virtual application path (/) to the root directory of the deployed
application files (sites\wwwroot).
Push to Azure from Git
Add an Azure remote to your local Git repository.
Push to the Azure remote to deploy the PHP application. You are prompted for the password you supplied earlier
as part of the creation of the deployment user.
During deployment, Azure App Service communicates its progress with Git.
You can use this approach to add any step to your Git-based deployment to App Service. For more information, see Custom
Deployment Script.
This command shows you the name of the migration file that's generated. Find this file in database/migrations and
open it.
Replace the up method with the following code:
The preceding code adds a boolean column in the tasks table called complete .
Replace the down method with the following code for the rollback action:
In the terminal, run Laravel database migrations to make the change in the local database.
Based on the Laravel naming convention, the model Task (see app/Task.php) maps to the tasks table by default.
Update application logic
Open the routes/web.php file. The application defines its routes and business logic here.
At the end of the file, add a route with the following code:
/**
* Toggle Task completeness
*/
Route::post('/task/{id}', function ($id) {
error_log('INFO: post /task/'.$id);
$task = Task::findOrFail($id);
$task->complete = !$task->complete;
$task->save();
return redirect('/');
});
The preceding code makes a simple update to the data model by toggling the value of complete .
Update the view
Open the resources/views/tasks.blade.php file. Find the <tr> opening tag and replace it with:
<tr class="{{ $task->complete ? 'success' : 'active' }}" >
The preceding code changes the row color depending on whether the task is complete.
In the next line, you have the following code:
<td>
<form action="{{ url('task/'.$task->id) }}" method="POST">
{{ csrf_field() }}
The preceding code adds the submit button that references the route that you defined earlier.
Test the changes locally
From the root directory of the Git repository, run the development server.
To see the task status change, navigate to http://localhost:8000 and select the checkbox.
To stop PHP, type Ctrl + C in the terminal.
Publish changes to Azure
In the terminal, run Laravel database migrations with the production connection string to make the change in the
Azure database.
Commit all the changes in Git, and then push the code changes to Azure.
git add .
git commit -m "added complete checkbox"
git push azure master
Once the git push is complete, navigate to the Azure web app and test the new functionality.
If you added any tasks, they are retained in the database. Updates to the data schema leave existing data intact.
You see your web app's Overview page. Here, you can perform basic management tasks like stop, start, restart,
browse, and delete.
The left menu provides pages for configuring your app.
Clean up resources
In the preceding steps, you created Azure resources in a resource group. If you don't expect to need these
resources in the future, delete the resource group by running the following command in the Cloud Shell:
Next steps
In this tutorial, you learned how to:
Create a MySQL database in Azure
Connect a PHP app to MySQL
Deploy the app to Azure
Update the data model and redeploy the app
Stream diagnostic logs from Azure
Manage the app in the Azure portal
Advance to the next tutorial to learn how to map a custom DNS name to a web app.
Map an existing custom DNS name to Azure Web Apps
Build a Node.js and MongoDB web app in Azure
App Service on Linux
12/14/2017 • 14 min to read • Edit Online
NOTE
This article deploys an app to App Service on Linux. To deploy to App Service on Windows, see Build a Node.js and MongoDB
web app in Azure.
App Service on Linux provides a highly scalable, self-patching web hosting service using the Linux operating
system. This tutorial shows how to create a Node.js web app, connect it locally to a MongoDB database, then
deploy to Azure connected to a CosmosDB database using the MongoDB API. When you're done, you'll have a
MEAN application (MongoDB, Express, AngularJS, and Node.js) running in App Service on Linux. For simplicity, the
sample application uses the MEAN.js web framework.
Prerequisites
To complete this tutorial:
1. Install Git
2. Install Node.js v6.0 or above and NPM
3. Install Gulp.js (required by MEAN.js)
4. Install and run MongoDB Community Edition
If you don't have an Azure subscription, create a free account before you begin.
mongo
If your connection is successful, then your MongoDB database is already running. If not, make sure that your local
MongoDB database is started by following the steps at Install MongoDB Community Edition. Often, MongoDB is
installed, but you still need to start it by running mongod .
When you're done testing your MongoDB database, type Ctrl+C in the terminal.
This sample repository contains a copy of the MEAN.js repository. It is modified to run on App Service (for more
information, see the MEAN.js repository README file).
Run the application
Run the following commands to install the required packages and start the application.
cd meanjs
npm install
npm start
Ignore the config.domain warning. When the app is fully loaded, you see something similar to the following
message:
--
MEAN.JS - Development Environment
Environment: development
Server: http://0.0.0.0:3000
Database: mongodb://localhost/mean-dev
App version: 0.5.0
MEAN.JS version: 0.5.0
--
Navigate to http://localhost:3000 in a browser. Click Sign Up in the top menu and create a test user.
The MEAN.js sample application stores user data in the database. If you are successful at creating a user and
signing in, then your app is writing data to the local MongoDB database.
Select Admin > Manage Articles to add some articles.
To stop Node.js at any time, press Ctrl+C in the terminal.
Click the Cloud Shell button on the menu in the upper right
of the Azure portal.
You generally create your resource group and the resources in a region near you.
Create a Cosmos DB account
In the Cloud Shell, create a Cosmos DB account with the az cosmosdb create command.
In the following command, substitute a unique Cosmos DB name for the <cosmosdb_name> placeholder. This
name is used as the part of the Cosmos DB endpoint, https://<cosmosdb_name>.documents.azure.com/ , so the name
needs to be unique across all Cosmos DB accounts in Azure. The name must contain only lowercase letters,
numbers, and the hyphen (-) character, and must be between 3 and 50 characters long.
{
"consistencyPolicy":
{
"defaultConsistencyLevel": "Session",
"maxIntervalInSeconds": 5,
"maxStalenessPrefix": 100
},
"databaseAccountOfferType": "Standard",
"documentEndpoint": "https://<cosmosdb_name>.documents.azure.com:443/",
"failoverPolicies":
...
< Output truncated for readability >
}
{
"primaryMasterKey":
"RS4CmUwzGRASJPMoc0kiEvdnKmxyRILC9BWisAYh3Hq4zBYKr0XQiSE4pqx3UchBeO4QRCzUt1i7w0rOkitoJw==",
"primaryReadonlyMasterKey":
"HvitsjIYz8TwRmIuPEUAALRwqgKOzJUjW22wPL2U8zoMVhGvregBkBk9LdMTxqBgDETSq7obbwZtdeFY7hElTg==",
"secondaryMasterKey":
"Lu9aeZTiXU4PjuuyGBbvS1N9IRG3oegIrIh95U6VOstf9bJiiIpw3IfwSUgQWSEYM3VeEyrhHJ4rn3Ci0vuFqA==",
"secondaryReadonlyMasterKey":
"LpsCicpVZqHRy7qbMgrzbRKjbYCwCKPQRl0QpgReAOxMcggTvxJFA94fTi0oQ7xtxpftTJcXkjTirQ0pT7QFrQ=="
}
Copy the value of primaryMasterKey . You need this information in the next step.
Configure the connection string in your Node.js application
In your local MEAN.js repository, in the config/env/ folder, create a file named local-production.js. .gitignore is
configured to keep this file out of the repository.
Copy the following code into it. Be sure to replace the two <cosmosdb_name> placeholders with your Cosmos DB
database name, and replace the <primary_master_key> placeholder with the key you copied in the previous step.
module.exports = {
db: {
uri: 'mongodb://<cosmosdb_name>:<primary_master_key>@<cosmosdb_name>.documents.azure.com:10250/mean?
ssl=true&sslverifycertificate=false'
}
};
gulp prod
In a local terminal window, run the following command to use the connection string you configured in
config/env/local-production.js. Ignore the certificate error and the config.domain warning.
NODE_ENV=production sets the environment variable that tells Node.js to run in the production environment.
node server.js starts the Node.js server with server.js in your repository root. This is how your Node.js
application is loaded in Azure.
When the app is loaded, check to make sure that it's running in the production environment:
--
MEAN.JS
Environment: production
Server: http://0.0.0.0:8443
Database: mongodb://<cosmosdb_name>:
<primary_master_key>@<cosmosdb_name>.documents.azure.com:10250/mean?ssl=true&sslverifycertificate=false
App version: 0.5.0
MEAN.JS version: 0.5.0
Navigate to http://localhost:8443 in a browser. Click Sign Up in the top menu and create a test user. If you are
successful creating a user and signing in, then your app is writing data to the Cosmos DB database in Azure.
In the terminal, stop Node.js by typing Ctrl+C .
If you get a 'Conflict'. Details: 409 error, change the username. If you get a 'Bad Request'. Details: 400 error,
use a stronger password.
You create this deployment user only once; you can use it for all your Azure deployments.
NOTE
Record the user name and password. You need them to deploy the web app later.
When the App Service plan has been created, the Azure CLI shows information similar to the following example:
{
"adminSiteName": null,
"appServicePlanName": "myAppServicePlan",
"geoRegion": "West Europe",
"hostingEnvironmentProfile": null,
"id": "/subscriptions/0000-
0000/resourceGroups/myResourceGroup/providers/Microsoft.Web/serverfarms/myAppServicePlan",
"kind": "linux",
"location": "West Europe",
"maximumNumberOfWorkers": 1,
"name": "myAppServicePlan",
< JSON data removed for brevity. >
"targetWorkerSizeId": 0,
"type": "Microsoft.Web/serverfarms",
"workerTierName": null
}
When the web app has been created, the Azure CLI shows output similar to the following example:
Local git is configured with url of 'https://<username>@<app_name>.scm.azurewebsites.net/<app_name>.git'
{
"availabilityState": "Normal",
"clientAffinityEnabled": true,
"clientCertEnabled": false,
"cloningInfo": null,
"containerSize": 0,
"dailyMemoryTimeQuota": 0,
"defaultHostName": "<app_name>.azurewebsites.net",
"deploymentLocalGitUrl": "https://<username>@<app_name>.scm.azurewebsites.net/<app_name>.git",
"enabled": true,
< JSON data removed for brevity. >
}
NOTE
The URL of the Git remote is shown in the property, with the format
deploymentLocalGitUrl
https://<username>@<app_name>.scm.azurewebsites.net/<app_name>.git . Save this URL as you'll need it later.
In Node.js code, you access this app setting with process.env.MONGODB_URI , just like you would access any
environment variable.
In your local MEAN.js repository, open config/env/production.js (not config/env/local-production.js), which has
production-environment specific configuration. Note that the default MEAN.js app is already configured to use the
MONGODB_URI environment variable that you created.
db: {
uri: ... || process.env.MONGODB_URI || ...,
...
},
Push to the Azure remote to deploy your app with the following command. When prompted for a password, make
sure that you enter the password you created in Configure a deployment user, not the password you use to log in
to the Azure portal.
git push azure master
This command may take a few minutes to run. While running, it displays information similar to the following
example:
You may notice that the deployment process runs Gulp after npm install . App Service does not run Gulp or Grunt
tasks during deployment, so this sample repository has two additional files in its root directory to enable it:
.deployment - This file tells App Service to run bash deploy.sh as the custom deployment script.
deploy.sh - The custom deployment script. If you review the file, you will see that it runs gulp prod after
npm install and bower install .
You can use this approach to add any step to your Git-based deployment. If you restart your Azure web app at any
point, App Service doesn't rerun these automation tasks.
Browse to the Azure web app
Browse to the deployed web app using your web browser.
http://<app_name>.azurewebsites.net
article.title = req.body.title;
article.content = req.body.content;
article.comment = req.body.comment;
...
};
Open modules/articles/client/views/view-article.client.view.html.
Just above the closing </section> tag, add the following line to display comment along with the rest of the article
data:
Open modules/articles/client/views/list-articles.client.view.html.
Just above the closing </a> tag, add the following line to display comment along with the rest of the article data:
Open modules/articles/client/views/admin/list-articles.client.view.html.
Inside the <div class="list-group"> element and just above the closing </a> tag, add the following line to display
comment along with the rest of the article data:
Open modules/articles/client/views/admin/form-article.client.view.html.
Find the <div class="form-group"> element that contains the submit button, which looks like this:
<div class="form-group">
<button type="submit" class="btn btn-default">{{vm.article._id ? 'Update' : 'Create'}}</button>
</div>
Just above this tag, add another <div class="form-group"> element that lets people edit the comment field. Your
new element should look like this:
<div class="form-group">
<label class="control-label" for="comment">Comment</label>
<textarea name="comment" data-ng-model="vm.article.comment" id="comment" class="form-control" cols="30"
rows="10" placeholder="Comment"></textarea>
</div>
NOTE
Remember that your config/env/production.js has been reverted, and the MONGODB_URI environment variable is only set in
your Azure web app and not on your local machine. If you look at the config file, you find that the production configuration
defaults to use a local MongoDB database. This makes sure that you don't touch production data when you test your code
changes locally.
Navigate to http://localhost:8443 in a browser and make sure that you're signed in.
Select Admin > Manage Articles, then add an article by selecting the + button.
You see the new Comment textbox now.
Once the git push is complete, navigate to your Azure web app and try out the new functionality.
If you added any articles earlier, you still can see them. Existing data in your Cosmos DB is not lost. Also, your
updates to the data schema and leaves your existing data intact.
By default, the portal shows your web app's Overview page. This page gives you a view of how your app is doing.
Here, you can also perform basic management tasks like browse, stop, start, restart, and delete. The tabs on the left
side of the page show the different configuration pages you can open.
Clean up resources
In the preceding steps, you created Azure resources in a resource group. If you don't expect to need these
resources in the future, delete the resource group by running the following command in the Cloud Shell:
Next steps
What you learned:
Create a CosmosDB database using the MongoDB API in Azure
Connect a Node.js app to MongoDB
Deploy the app to Azure
Update the data model and redeploy the app
Stream logs from Azure to your terminal
Manage the app in the Azure portal
Advance to the next tutorial to learn how to map a custom DNS name to your web app.
Map an existing custom DNS name to Azure Web Apps
Build a Docker Python and PostgreSQL web app in
Azure
12/14/2017 • 11 min to read • Edit Online
Web App for Containers provides a highly scalable, self-patching web hosting service. This tutorial shows how to
create a basic Docker Python web app in Azure. You connect this app to a PostgreSQL database. When you are
done, you have a Python Flask application running within a Docker container on App Service on Linux.
You can follow the steps below on macOS. Linux and Windows instructions are the same in most cases, but the
differences are not detailed in this tutorial.
Prerequisites
To complete this tutorial:
1. Install Git
2. Install Python
3. Install and run PostgreSQL
4. Install Docker Community Edition
If you don't have an Azure subscription, create a free account before you begin.
Click the Cloud Shell button on the menu in the upper right
of the Azure portal.
If you choose to install and use the CLI locally, this article requires that you are running the Azure CLI version 2.0 or
later. Run az --version to find the version. If you need to install or upgrade, see Install Azure CLI 2.0.
psql postgres
If your connection is successful, your PostgreSQL database is running. If not, make sure that your local PostgresQL
database is started by following the steps at Downloads - PostgreSQL Core Distribution.
Create a database called eventregistration and set up a separate database user named manager with password
supersecretpass.
NOTE
In a later step you simplify this process by building a Docker container to use with the production database.
When the app is fully loaded, you see something similar to the following message:
INFO [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO [alembic.runtime.migration] Will assume transactional DDL.
INFO [alembic.runtime.migration] Running upgrade -> 791cd7d80402, empty message
* Serving Flask app "app"
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
The Flask sample application stores user data in the database. If you are successful at registering a user, your app is
writing data to the local PostgreSQL database.
To stop the Flask server at anytime, type Ctrl+C in the terminal.
az login
Use the az appservice list-locations Azure CLI command to list available locations.
Create an Azure Database for PostgreSQL server
Create a PostgreSQL server with the az postgres server create command.
In the following command, substitute a unique server name for the <postgresql_name> placeholder and a user
name for the <admin_username> placeholder. The server name is used as part of your PostgreSQL endpoint (
https://<postgresql_name>.postgres.database.azure.com ), so the name needs to be unique across all servers in
Azure. The user name is for the initial database admin user account. You are prompted to pick a password for this
user.
When the Azure Database for PostgreSQL server is created, the Azure CLI shows information similar to the
following example:
{
"administratorLogin": "<my_admin_username>",
"fullyQualifiedDomainName": "<postgresql_name>.postgres.database.azure.com",
"id": "/subscriptions/00000000-0000-0000-0000-
000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/<postgresql_name>",
"location": "westus",
"name": "<postgresql_name>",
"resourceGroup": "myResourceGroup",
"sku": {
"capacity": 100,
"family": null,
"name": "PGSQLS3M100",
"size": null,
"tier": "Basic"
},
"sslEnforcement": null,
"storageMb": 2048,
"tags": null,
"type": "Microsoft.DBforPostgreSQL/servers",
"userVisibleState": "Ready",
"version": null
}
Create a firewall rule for the Azure Database for PostgreSQL server
Run the following Azure CLI command to allow access to the database from all IP addresses.
The Azure CLI confirms the firewall rule creation with output similar to the following example:
{
"endIpAddress": "255.255.255.255",
"id": "/subscriptions/00000000-0000-0000-0000-
000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/<postgresql_name>/firew
allRules/AllowAllIPs",
"name": "AllowAllIPs",
"resourceGroup": "myResourceGroup",
"startIpAddress": "0.0.0.0",
"type": "Microsoft.DBforPostgreSQL/servers/firewallRules"
}
Connect your Python Flask application to the database
In this step, you connect your Python Flask sample application to the Azure Database for PostgreSQL server you
created.
Create an empty database and set up a new database application user
Create a database user with access to a single database only. You use these credentials to avoid giving the
application full access to the server.
Connect to the database (you're prompted for your admin password).
When the app is fully loaded, you see something similar to the following message:
Navigate to http://127.0.0.1:5000 in a browser. Click Register! and create a test registration. You are now writing
data to the database in Azure.
Running the application from a Docker Container
Build the Docker container image.
cd ..
docker build -t flask-postgresql-sample .
Add database environment variables to an environment variable file db.env. The app connects to the Azure
Database for PostgreSQL production database.
DBHOST="<postgresql_name>.postgres.database.azure.com"
DBUSER="manager@<postgresql_name>"
DBNAME="eventregistration"
DBPASS="supersecretpass"
Run the app from within the Docker container. The following command specifies the environment variable file and
maps the default Flask port 5000 to local port 5000.
The output is similar to what you saw earlier. However, the initial database migration no longer needs to be
performed and therefore is skipped.
az acr create --name <registry_name> --resource-group myResourceGroup --location "West US" --sku Basic
Output
{
"adminUserEnabled": false,
"creationDate": "2017-05-04T08:50:55.635688+00:00",
"id": "/subscriptions/00000000-0000-0000-0000-
000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/<registry_name>",
"location": "westus",
"loginServer": "<registry_name>.azurecr.io",
"name": "<registry_name>",
"provisioningState": "Succeeded",
"sku": {
"name": "Basic",
"tier": "Basic"
},
"storageAccount": {
"name": "<registry_name>01234"
},
"tags": {},
"type": "Microsoft.ContainerRegistry/registries"
}
Retrieve the registry credentials for pushing and pulling Docker images
To show registry credentials, enable admin mode first.
You see two passwords. Make note of the user name and the first password.
{
"passwords": [
{
"name": "password",
"value": "<registry_password>"
},
{
"name": "password2",
"value": "<registry_password2>"
}
],
"username": "<registry_name>"
}
When the App Service plan is created, the Azure CLI shows information similar to the following example:
{
"adminSiteName": null,
"appServicePlanName": "myAppServicePlan",
"geoRegion": "West US",
"hostingEnvironmentProfile": null,
"id": "/subscriptions/00000000-0000-0000-0000-
000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Web/serverfarms/myAppServicePlan",
"kind": "linux",
"location": "West US",
"maximumNumberOfWorkers": 10,
"name": "myAppServicePlan",
"numberOfSites": 0,
"perSiteScaling": false,
"provisioningState": "Succeeded",
"reserved": true,
"resourceGroup": "myResourceGroup",
"sku": {
"capabilities": null,
"capacity": 1,
"family": "S",
"locations": null,
"name": "S1",
"size": "S1",
"skuCapacity": null,
"tier": "Standard"
},
"status": "Ready",
"subscription": "00000000-0000-0000-0000-000000000000",
"tags": null,
"targetWorkerCount": 0,
"targetWorkerSizeId": 0,
"type": "Microsoft.Web/serverfarms",
"workerTierName": null
}
When the web app has been created, the Azure CLI shows information similar to the following example:
{
"availabilityState": "Normal",
"clientAffinityEnabled": true,
"clientCertEnabled": false,
"cloningInfo": null,
"containerSize": 0,
"dailyMemoryTimeQuota": 0,
"defaultHostName": "<app_name>.azurewebsites.net",
"enabled": true,
...
< Output has been truncated for readability >
}
Configure the database environment variables
Earlier in the tutorial, you defined environment variables to connect to your PostgreSQL database.
In App Service, you set environment variables as app settings by using the az webapp config appsettings set
command.
The following example specifies the database connection details as app settings. It also uses the PORT variable to
map PORT 5000 from your Docker Container to receive HTTP traffic on PORT 80.
az webapp config appsettings set --name <app_name> --resource-group myResourceGroup --settings DBHOST="
<postgresql_name>.postgres.database.azure.com" DBUSER="manager@<postgresql_name>" DBPASS="supersecretpass"
DBNAME="eventregistration" PORT=5000
Whenever you update the Docker container or change the settings, restart the app. Restarting ensures that all
settings are applied and the latest container is pulled from the registry.
http://<app_name>.azurewebsites.net
NOTE
The web app takes longer to load because the container has to be downloaded and started after the container configuration
is changed.
You see previously registered guests that were saved to the Azure production database in the previous step.
Congratulations! You're running a Docker container-based Python Flask app in Azure App Service.
Update data model and redeploy
In this step, you add the number of attendees to each event registration by updating the Guest model.
Check out the 0.2-migration release with the following git command:
This release already made the necessary changes to views, controllers, and model. It also includes a database
migration generated via alembic ( flask db migrate ). You can see all changes made via the following git command:
source venv/bin/activate
cd app
FLASK_APP=app.py DBHOST="localhost" DBUSER="manager" DBNAME="eventregistration" DBPASS="supersecretpass" flask
db upgrade
FLASK_APP=app.py DBHOST="localhost" DBUSER="manager" DBNAME="eventregistration" DBPASS="supersecretpass" flask
run
Navigate to http://127.0.0.1:5000 in your browser to view the changes. Create a test registration.
Navigate to your Azure web app and try out the new functionality again. Create another event registration.
http://<app_name>.azurewebsites.net
By default, the portal shows your web app's Overview page. This page gives you a view of how your app is doing.
Here, you can also perform basic management tasks like browse, stop, start, restart, and delete. The tabs on the left
side of the page show the different configuration pages you can open.
Next steps
Advance to the next tutorial to learn how to map a custom DNS name to your web app.
Map an existing custom DNS name to Azure Web Apps
Use a custom Docker image for Web App for
Containers
12/14/2017 • 14 min to read • Edit Online
Web App for Containers provides built-in Docker images on Linux with support for specific versions, such as PHP
7.0 and Node.js 4.5. Web App for Containers uses the Docker container technology to host both built-in images
and custom images as a platform as a service. In this tutorial, you learn how to build a custom Docker image and
deploy it to Web App for Containers. This pattern is useful when the built-in images don't include your language of
choice, or when your application requires a specific configuration that isn't provided within the built-in images.
Prerequisites
To complete this tutorial, you need:
Git
An active Azure subscription
Docker
A Docker Hub account
If you don't have an Azure subscription, create a free account before you begin.
# ssh
ENV SSH_PASSWD "root:Docker!"
RUN apt-get update \
&& apt-get install -y --no-install-recommends dialog \
&& apt-get update \
&& apt-get install -y --no-install-recommends openssh-server \
&& echo "$SSH_PASSWD" | chpasswd
To build the Docker image, run the docker build command, and provide a name, mydockerimage , and tag, v1.0.0 .
Replace <docker-id> with your Docker Hub account ID.
# The output from the commands in this article has been shortened for brevity.
Test that the build works by running the Docker container. Issue the docker run command and pass the name and
tag of the image to it. Be sure to specify the port using the -p argument.
Verify the web app and container are functioning correctly by browsing to http://localhost:2222 .
Push the Docker image to Docker Hub
A registry is an application that hosts images and provides services image and container services. In order to share
your image, you must push it to a registry.
NOTE
Pushing to a Private Docker Registry? See the optional instructions to Push a Docker image to Private Registry.
Docker Hub is a registry for Docker images that allows you to host your own repositories, either public or private.
To push a custom Docker image to the public Docker Hub, use the docker push command and provide a full image
name and tag. A full image name and tag looks like the following sample:
<docker-id>/image-name:tag
If you haven't logged in to Docker Hub, do so using the docker login command before attempting to push an
image.
A "login succeeded" message confirms that you are logged in. Once logged in, you can push the image to Docker
Hub using the docker push command.
Click the Cloud Shell button on the menu in the upper right
of the Azure portal.
You generally create your resource group and the resources in a region near you.
Create a Linux App Service plan
In the Cloud Shell, create an App Service plan in the resource group with the az appservice plan create command.
The following example creates an App Service plan named myAppServicePlan in the Standard pricing tier (
--sku S1 ) and in a Linux container ( --is-linux ).
az appservice plan create --name myAppServicePlan --resource-group myResourceGroup --sku S1 --is-linux
When the App Service plan has been created, the Azure CLI shows information similar to the following example:
{
"adminSiteName": null,
"appServicePlanName": "myAppServicePlan",
"geoRegion": "West Europe",
"hostingEnvironmentProfile": null,
"id": "/subscriptions/0000-
0000/resourceGroups/myResourceGroup/providers/Microsoft.Web/serverfarms/myAppServicePlan",
"kind": "linux",
"location": "West Europe",
"maximumNumberOfWorkers": 1,
"name": "myAppServicePlan",
< JSON data removed for brevity. >
"targetWorkerSizeId": 0,
"type": "Microsoft.Web/serverfarms",
"workerTierName": null
}
When the web app has been created, the Azure CLI shows output similar to the following example:
{
"availabilityState": "Normal",
"clientAffinityEnabled": true,
"clientCertEnabled": false,
"cloningInfo": null,
"containerSize": 0,
"dailyMemoryTimeQuota": 0,
"defaultHostName": "<app_name>.azurewebsites.net",
"deploymentLocalGitUrl": "https://<username>@<app_name>.scm.azurewebsites.net/<app_name>.git",
"enabled": true,
< JSON data removed for brevity. >
}
Once you've modified the Python file and saved it, you must rebuild and push the new Docker image. Then restart
the web app for the changes to take effect. Use the same commands that you have previously used in this tutorial.
You can refer to Build the image from the Docker file and Push the Docker image to Docker Hub. Test the web app
by following the instructions in Test the web app.
NOTE
This configuration does not allow external connections to the container. SSH is available only through the Kudu/SCM
Site. The Kudu/SCM site is authenticated with the publishing credentials.
A COPY instruction that instructs the Docker engine to copy the sshd_config file to the /etc/ssh/ directory.
Your configuration file should be based on this sshd_config file.
NOTE
The sshd_config file must include the following items:
Ciphers must include at least one item in this list: aes128-cbc,3des-cbc,aes256-cbc .
MACs must include at least one item in this list: hmac-sha1,hmac-sha1-96 .
An EXPOSE instruction that exposes port 2222 in the container. Although the root password is known, port
2222 cannot be accessed from the internet. It is an internal port accessible only by containers within the
bridge network of a private virtual network. After that, commands copy SSH configuration details and start
the ssh service.
Make sure to start the ssh service by using a shell script in the /bin directory.
#!/bin/bash
service ssh start
top
The top command exposes all running processes in a container.
Congratulations! You've configured a custom Docker image for a Web App for Containers.
The command reveals output similar to the following JSON string, showing that the configuration change
succeeded:
[
{
"name": "WEBSITES_ENABLE_APP_SERVICE_STORAGE",
"slotSetting": false,
"value": "false"
},
{
"name": "DOCKER_REGISTRY_SERVER_USERNAME",
"slotSetting": false,
"value": "<docker-id>"
},
{
"name": "DOCKER_REGISTRY_SERVER_PASSWORD",
"slotSetting": false,
"value": null
},
{
"name": "DOCKER_CUSTOM_IMAGE_NAME",
"value": "DOCKER|<image-name-and-tag>"
}
]
- Finished ..
Create a new service principal and assign access:
az ad sp create-for-rbac --scopes
/subscriptions/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/<azure-
container-registry-name> --role Owner --password <password>
The command reveals two passwords that can be used with the user name.
<
"passwords": [
{
"name": "password",
"value": "{password}"
},
{
"name": "password2",
"value": "{password}"
}
],
"username": "<registry-username>"
}
From your local terminal window, log in to the Azure Container Registry using the docker login command. The
server name is required to log in. Use the format {azure-container-registry-name>.azurecr.io .
NOTE
If you're using your own image, tag the image as follows:
Push the image by using the docker push command. Tag the image with the name of the registry, followed by
your image name and tag.
Verify that the push successfully added a container to the registry by listing the ACR repositories.
Listing the images in the registry confirms that mydockerimage is in the registry.
[
"mydockerimage"
]
Configure Web App to use the image from Azure Container Registry (or any private registry)
You can configure Web App for Containers so that it runs a container stored in the Azure Container Registry. Using
the Azure Container Registry is just like using any private registry, so if you need to use your own private registry,
the steps to complete this task are similar.
In the Cloud Shell, run az acr credential show to display the username and password for the Azure Container
Registry. Copy the username and one of the passwords so you can use it to configure the web app in the next step.
az acr credential show --name <azure-container-registry-name>
{
"passwords": [
{
"name": "password",
"value": "password"
},
{
"name": "password2",
"value": "password2"
}
],
"username": "<registry-username>"
}
In the Cloud Shell, run the az webapp config container set command to assign the custom Docker image to the
web app. Replace <app_name>, <docker-registry-server-url>, <registry-username>, and <password>. For Azure
Container Registry, <docker-registry-server-url> is in the format
https://<azure-container-registry-name>.azurecr.io .
NOTE
https:// is required in <docker-registry-server-url>.
The command reveals output similar to the following JSON string, showing that the configuration change
succeeded:
[
{
"name": "DOCKER_CUSTOM_IMAGE_NAME",
"slotSetting": false,
"value": "mydockerimage"
},
{
"name": "DOCKER_REGISTRY_SERVER_URL",
"slotSetting": false,
"value": "<azure-container-registry-name>.azurecr.io"
},
{
"name": "DOCKER_REGISTRY_SERVER_USERNAME",
"slotSetting": false,
"value": "<registry-username>"
},
{
"name": "DOCKER_REGISTRY_SERVER_PASSWORD",
"slotSetting": false,
"value": null
}
]
Clean up deployment
After the sample script has been run, the following command can be used to remove the resource group and all
resources associated with it.
Next steps
Build a Docker Python and PostgreSQL web app in Azure
Map an existing custom DNS name to Azure Web
Apps
1/2/2018 • 10 min to read • Edit Online
Azure Web Apps provides a highly scalable, self-patching web hosting service. This tutorial shows you how to
map an existing custom DNS name to Azure Web Apps.
NOTE
We recommend that you use a CNAME for all custom DNS names except a root domain (for example, contoso.com ).
To migrate a live site and its DNS domain name to App Service, see Migrate an active DNS name to Azure App
Service.
Prerequisites
To complete this tutorial:
Create an App Service app, or use an app that you created for another tutorial.
Purchase a domain name and make sure you have access to the DNS registry for your domain provider
(such as GoDaddy).
For example, to add DNS entries for contoso.com and www.contoso.com , you must be able to configure the
DNS settings for the contoso.com root domain.
NOTE
If you don't have an existing domain name, consider purchasing a domain using the Azure portal.
NOTE
App Service Free and Shared (preview) hosting plans are base tiers that run on the same Azure VM as other App Service
apps. Some apps may belong to other customers. These tiers are intended to be used only for development and testing
purposes.
Sign in to Azure
Open the Azure portal and sign in with your Azure account.
Navigate to the app in the Azure portal
From the left menu, select App Services, and then select the name of the app.
The app's current tier is highlighted by a blue border. Check to make sure that the app is not in the Free tier.
Custom DNS is not supported in the Free tier.
If the App Service plan is not Free, close the Choose your pricing tier page and skip to Map a CNAME record.
Scale up the App Service plan
Select any of the non-free tiers (Shared, Basic, Standard, or Premium).
Click Select.
When you see the following notification, the scale operation is complete.
In the example screenshot, you select Add to create a record. Some providers have different links to add different
record types. Again, consult the provider's documentation.
NOTE
For certain providers, such as GoDaddy, changes to DNS records don't become effective until you select a separate Save
Changes link.
For the domain example, add a CNAME record that maps the name
www.contoso.com www to
<app_name>.azurewebsites.net .
After you add the CNAME, the DNS records page looks like the following example:
Type the fully qualified domain name that you added a CNAME record for, such as www.contoso.com .
Select Validate.
The Add hostname button is activated.
Make sure that Hostname record type is set to CNAME (www.example.com or any subdomain).
Select Add hostname.
It might take some time for the new hostname to be reflected in the app's Custom domains page. Try
refreshing the browser to update the data.
If you missed a step or made a typo somewhere earlier, you see a verification error at the bottom of the page.
Map an A record
In the tutorial example, you add an A record for the root domain (for example, contoso.com ).
Copy the app's IP address
To map an A record, you need the app's external IP address. You can find this IP address in the app's Custom
domains page in the Azure portal.
In the left navigation of the app page in the Azure portal, select Custom domains.
In the example screenshot, you select Add to create a record. Some providers have different links to add different
record types. Again, consult the provider's documentation.
NOTE
For certain providers, such as GoDaddy, changes to DNS records don't become effective until you select a separate Save
Changes link.
TXT @ <app_name>.azurewebsites.net
When the records are added, the DNS records page looks like the following example:
Type the fully qualified domain name that you configured the A record for, such as contoso.com .
Select Validate.
The Add hostname button is activated.
Make sure that Hostname record type is set to A record (example.com).
Select Add hostname.
It might take some time for the new hostname to be reflected in the app's Custom domains page. Try
refreshing the browser to update the data.
If you missed a step or made a typo somewhere earlier, you see a verification error at the bottom of the page.
In the example screenshot, you select Add to create a record. Some providers have different links to add different
record types. Again, consult the provider's documentation.
NOTE
For certain providers, such as GoDaddy, changes to DNS records don't become effective until you select a separate Save
Changes link.
Type a fully qualified domain name that matches the wildcard domain (for example, sub1.contoso.com ), and then
select Validate.
The Add hostname button is activated.
Make sure that Hostname record type is set to CNAME record (www.example.com or any subdomain).
Select Add hostname.
It might take some time for the new hostname to be reflected in the app's Custom domains page. Try
refreshing the browser to update the data.
Select the + icon again to add another hostname that matches the wildcard domain. For example, add
sub2.contoso.com .
Test in browser
Browse to the DNS name(s) that you configured earlier (for example, contoso.com , www.contoso.com ,
sub1.contoso.com , and sub2.contoso.com ).
Once the operation completes, you app should return the right page at the root path (for example,
http://contoso.com).
Next steps
In this tutorial, you learned how to:
Map a subdomain by using a CNAME record
Map a root domain by using an A record
Map a wildcard domain by using a CNAME record
Automate domain mapping with scripts
Advance to the next tutorial to learn how to bind a custom SSL certificate to a web app.
Bind an existing custom SSL certificate to Azure Web Apps
Bind an existing custom SSL certificate to Azure Web
Apps
12/1/2017 • 7 min to read • Edit Online
Azure Web Apps provides a highly scalable, self-patching web hosting service. This tutorial shows you how to bind
a custom SSL certificate that you purchased from a trusted certificate authority to Azure Web Apps. When you're
finished, you'll be able to access your web app at the HTTPS endpoint of your custom DNS domain.
NOTE
If you need to get a custom SSL certificate, you can get one in the Azure portal directly and bind it to your web app. Follow
the App Service Certificates tutorial.
Prerequisites
To complete this tutorial:
Create an App Service app
Map a custom DNS name to your web app
Acquire an SSL certificate from a trusted certificate authority
Have the private key you used to sign the SSL certificate request
Requirements for your SSL certificate
To use a certificate in App Service, the certificate must meet all the following requirements:
Signed by a trusted certificate authority
Exported as a password-protected PFX file
Contains private key at least 2048 bits long
Contains all intermediate certificates in the certificate chain
NOTE
Elliptic Curve Cryptography (ECC) certificates can work with App Service but are not covered by this article. Work with
your certificate authority on the exact steps to create ECC certificates.
Check to make sure that your web app is not in the Free or Shared tier. Your web app's current tier is highlighted
by a dark blue box.
Custom SSL is not supported in the Free or Shared tier. If you need to scale up, follow the steps in the next
section. Otherwise, close the Choose your pricing tier page and skip to Upload and bind your SSL certificate.
Scale up your App Service plan
Select one of the Basic, Standard, or Premium tiers.
Click Select.
When you see the following notification, the scale operation is complete.
-----BEGIN CERTIFICATE-----
<your entire Base64 encoded SSL certificate>
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
<The entire Base64 encoded intermediate certificate 1>
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
<The entire Base64 encoded intermediate certificate 2>
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
<The entire Base64 encoded root certificate>
-----END CERTIFICATE-----
When prompted, define an export password. You'll use this password when uploading your SSL certificate to App
Service later.
If you used IIS or Certreq.exe to generate your certificate request, install the certificate to your local machine, and
then export the certificate to PFX.
Upload your SSL certificate
To upload your SSL certificate, click SSL certificates in the left navigation of your web app.
Click Upload Certificate.
In PFX Certificate File, select your PFX file. In Certificate password, type the password that you created when
you exported the PFX file.
Click Upload.
When App Service finishes uploading your certificate, it appears in the SSL certificates page.
NOTE
If you have uploaded your certificate but don't see the domain name(s) in the Hostname dropdown, try refreshing the
browser page.
In SSL Type, select whether to use Server Name Indication (SNI) or IP-based SSL.
SNI-based SSL - Multiple SNI-based SSL bindings may be added. This option allows multiple SSL certificates
to secure multiple domains on the same IP address. Most modern browsers (including Internet Explorer,
Chrome, Firefox, and Opera) support SNI (find more comprehensive browser support information at Server
Name Indication).
IP-based SSL - Only one IP-based SSL binding may be added. This option allows only one SSL certificate to
secure a dedicated public IP address. To secure multiple domains, you must secure them all using the same SSL
certificate. This is the traditional option for SSL binding.
Click Add Binding.
When App Service finishes uploading your certificate, it appears in the SSL bindings sections.
NOTE
If your web app gives you certificate validation errors, you're probably using a self-signed certificate.
If that's not the case, you may have left out intermediate certificates when you export your certificate to the PFX file.
Enforce HTTPS
By default, anyone can still access your web app using HTTP. You can redirect all HTTP requests to the HTTPS port.
In your web app page, in the left navigation, select Custom domains. Then, in HTTPS Only, select On.
When the operation is complete, navigate to any of the HTTP URLs that point to your app. For example:
http://<app_name>.azurewebsites.net
http://contoso.com
http://www.contoso.com
The following command adds an SNI-based SSL binding, using the thumbprint from the previous command.
Azure PowerShell
The following command uploads an exported PFX file and adds an SNI-based SSL binding.
New-AzureRmWebAppSSLBinding `
-WebAppName <app_name> `
-ResourceGroupName <resource_group_name> `
-Name <dns_name> `
-CertificateFilePath <path_to_PFX_file> `
-CertificatePassword <PFX_password> `
-SslState SniEnabled
Azure Content Delivery Network (CDN) caches static web content at strategically placed locations to provide
maximum throughput for delivering content to users. The CDN also decreases server load on your web app. This
tutorial shows how to add Azure CDN to a web app in Azure App Service.
Here's the home page of the sample static HTML site that you'll work with:
Prerequisites
To complete this tutorial:
Install Git
Install Azure CLI 2.0
If you don't have an Azure subscription, create a free account before you begin.
In the App Service page, in the Settings section, select Networking > Configure Azure CDN for your app.
In the Azure Content Delivery Network page, provide the New endpoint settings as specified in the table.
SETTING SUGGESTED VALUE DESCRIPTION
Pricing tier Standard Akamai The pricing tier specifies the provider
and available features. In this tutorial,
we are using Standard Akamai.
CDN endpoint name Any name that is unique in the You access your cached resources at the
azureedge.net domain domain
<endpointname>.azureedge.net.
Select Create.
Azure creates the profile and endpoint. The new endpoint appears in the Endpoints list on the same page, and
when it's provisioned the status is Running.
Test the CDN endpoint
If you selected Verizon pricing tier, it typically takes about 90 minutes for endpoint propagation. For Akamai, it
takes a couple minutes for propagation
The sample app has an index.html file and css, img, and js folders that contain other static assets. The content
paths for all of these files are the same at the CDN endpoint. For example, both of the following URLs access the
bootstrap.css file in the css folder:
http://<appname>.azurewebsites.net/css/bootstrap.css
http://<endpointname>.azureedge.net/css/bootstrap.css
http://<endpointname>.azureedge.net/index.html
You see the same page that you ran earlier in an Azure web app. Azure CDN has retrieved the origin web app's
assets and is serving them from the CDN endpoint
To ensure that this page is cached in the CDN, refresh the page. Two requests for the same asset are sometimes
required for the CDN to cache the requested content.
For more information about creating Azure CDN profiles and endpoints, see Getting started with Azure CDN.
Purge the CDN
The CDN periodically refreshes its resources from the origin web app based on the time-to-live (TTL) configuration.
The default TTL is seven days.
At times you might need to refresh the CDN before the TTL expiration -- for example, when you deploy updated
content to the web app. To trigger a refresh, you can manually purge the CDN resources.
In this section of the tutorial, you deploy a change to the web app and purge the CDN to trigger the CDN to refresh
its cache.
Deploy a change to the web app
Open the index.html file and add "- V2" to the H1 heading, as shown in the following example:
Once deployment has completed, browse to the web app URL and you see the change.
http://<appname>.azurewebsites.net/index.html
Browse to the CDN endpoint URL for the home page and you don't see the change because the cached version in
the CDN hasn't expired yet.
http://<endpointname>.azureedge.net/index.html
Enter the content paths you wish to purge. You can pass a complete file path to purge an individual file, or a path
segment to purge and refresh all content in a folder. Since you changed index.html , make sure that is one of the
paths.
At the bottom of the page, select Purge.
Verify that the CDN is updated
Wait until the purge request finishes processing, typically a couple of minutes. To see the current status, select the
bell icon at the top of the page.
Browse to the CDN endpoint URL for index.html , and now you see the V2 that you added to the title on the home
page. This shows that the CDN cache has been refreshed.
http://<endpointname>.azureedge.net/index.html
http://<endpointname>.azureedge.net/index.html?q=1
The CDN returns the current web app content, which includes "V2" in the heading.
To ensure that this page is cached in the CDN, refresh the page.
Open index.html and change "V2" to "V3", and deploy the change.
In a browser, go to the CDN endpoint URL with a new query string such as q=2 . The CDN gets the current
index.html file and displays "V3". But if you navigate to the CDN endpoint with the q=1 query string, you see
"V2".
http://<endpointname>.azureedge.net/index.html?q=2
http://<endpointname>.azureedge.net/index.html?q=1
If you don't have a custom domain, consider following the App Service domain tutorial to purchase a domain using
the Azure portal.
Find the hostname to use with the CNAME
In the Azure portal Endpoint page, make sure Overview is selected in the left navigation, and then select the +
Custom Domain button at the top of the page.
In the Add a custom domain page, you see the endpoint host name to use in creating a CNAME record. The host
name is derived from your CDN endpoint URL: <EndpointName>.azureedge.net.
For more information, see Map Azure CDN content to a custom domain.
Clean up resources
In the preceding steps, you created Azure resources in a resource group. If you don't expect to need these resources
in the future, delete the resource group by running the following command in the Cloud Shell:
Next steps
What you learned:
Create a CDN endpoint.
Refresh cached assets.
Use query strings to control cached versions.
Use a custom domain for the CDN endpoint.
Learn how to optimize CDN performance in the following articles:
Improve performance by compressing files in Azure CDN
Pre-load assets on an Azure CDN endpoint
Azure CLI Samples
12/12/2017 • 2 min to read • Edit Online
The following table includes links to bash scripts built using the Azure CLI.
Create app
Create a web app and deploy files with FTP Creates an Azure web app and deploys a file to it using FTP.
Create a web app and deploy code from GitHub Creates an Azure web app and deploys code from a public
GitHub repository.
Create a web app with continuous deployment from GitHub Creates an Azure web app with continuous publishing from a
GitHub repository you own.
Create a web app and deploy code from a local Git repository Creates an Azure web app and configures code push from a
local Git repository.
Create a web app and deploy code to a staging environment Creates an Azure web app with a deployment slot for staging
code changes.
Create an ASP.NET Core web app in a Docker container Creates an Azure web app on Linux and loads a Docker image
from Docker Hub.
Configure app
Map a custom domain to a web app Creates an Azure web app and maps a custom domain name
to it.
Bind a custom SSL certificate to a web app Creates an Azure web app and binds the SSL certificate of a
custom domain name to it.
Scale app
Scale a web app manually Creates an Azure web app and scales it across 2 instances.
Scale a web app worldwide with a high-availability architecture Creates two Azure web apps in two different geographical
regions and makes them available through a single endpoint
using Azure Traffic Manager.
Connect a web app to a SQL Database Creates an Azure web app and a SQL database, then adds the
database connection string to the app settings.
Connect a web app to a storage account Creates an Azure web app and a storage account, then adds
the storage connection string to the app settings.
Connect a web app to a redis cache Creates an Azure web app and a redis cache, then adds the
redis connection details to the app settings.)
Connect a web app to Cosmos DB Creates an Azure web app and a Cosmos DB, then adds the
Cosmos DB connection details to the app settings.
Back up a web app Creates an Azure web app and creates a one-time backup for
it.
Create a scheduled backup for a web app Creates an Azure web app and creates a scheduled backup for
it.
Restores a web app from a backup Restores an Azure web app from a backup.
Monitor app
Monitor a web app with web server logs Creates an Azure web app, enables logging for it, and
downloads the logs to your local machine.
Azure PowerShell Samples
1/9/2018 • 1 min to read • Edit Online
The following table includes links to PowerShell scripts built using the Azure PowerShell.
Create app
Create a web app with deployment from GitHub Creates an Azure web app that pulls code from GitHub.
Create a web app with continuous deployment from GitHub Creates an Azure web app that continuously deploys code
from GitHub.
Create a web app and deploy code with FTP Creates an Azure web app and upload files from a local
directory using FTP.
Create a web app and deploy code from a local Git repository Creates an Azure web app and configures code push from a
local Git repository.
Create a web app and deploy code to a staging environment Creates an Azure web app with a deployment slot for staging
code changes.
Configure app
Map a custom domain to a web app Creates an Azure web app and maps a custom domain name
to it.
Bind a custom SSL certificate to a web app Creates an Azure web app and binds the SSL certificate of a
custom domain name to it.
Scale app
Scale a web app manually Creates an Azure web app and scales it across 2 instances.
Scale a web app worldwide with a high-availability architecture Creates two Azure web apps in two different geographical
regions and makes them available through a single endpoint
using Azure Traffic Manager.
Connect a web app to a SQL Database Creates an Azure web app and a SQL database, then adds the
database connection string to the app settings.
Connect a web app to a storage account Creates an Azure web app and a storage account, then adds
the storage connection string to the app settings.
Back up a web app Creates an Azure web app and creates a one-time backup for
it.
Create a scheduled backup for a web app Creates an Azure web app and creates a scheduled backup for
it.
Delete a backup for a web app Deletes an existing backup for a web app.
Monitor app
Monitor a web app with web server logs Creates an Azure web app, enables logging for it, and
downloads the logs to your local machine.
1 min to read •
Edit O nline
Azure App Service plan overview
1/2/2018 • 7 min to read • Edit Online
In App Service, an app runs in an App Service plan. An App Service plan defines a set of compute resources for a
web app to run. These compute resources are analogous to the server farm in conventional web hosting. One or
more apps can be configured to run on the same computing resources (or in the same App Service plan).
When you create an App Service plan in a certain region (for example, West Europe), a set of compute resources is
created for that plan in that region. Whatever apps you put into this App Service plan run on these compute
resources as defined by your App Service plan. Each App Service plan defines:
Region (West US, East US, etc.)
Number of VM instances
Size of VM instances (Small, Medium, Large)
Pricing tier (Free, Shared, Basic, Standard, Premium, PremiumV2, Isolated, Consumption)
The pricing tier of an App Service plan determines what App Service features you get and how much you pay for
the plan. There are a few categories of pricing tiers:
Shared compute: Free and Shared, the two base tiers, runs an app on the same Azure VM as other App
Service apps, including apps of other customers. These tiers allocate CPU quotas to each app that runs on the
shared resources, and the resources cannot scale out.
Dedicated compute: The Basic, Standard, Premium, and PremiumV2 tiers run apps on dedicated Azure
VMs. Only apps in the same App Service plan share the same compute resources. The higher the tier, the more
VM instances are available to you for scale-out.
Isolated: This tier runs dedicated Azure VMs on dedicated Azure Virtual Networks, which provides network
isolation on top of compute isolation to your apps. It provides the maximum scale-out capabilities.
Consumption: This tier is only available to function apps. It scales the functions dynamically depending on
workload. For more information, see Azure Functions hosting plans comparison.
NOTE
App Service Free and Shared (preview) hosting plans are base tiers that run on the same Azure VM as other App Service
apps. Some apps may belong to other customers. These tiers are intended to be used only for development and testing
purposes.
Each tier also provides a specific subset of App Service features. These features include custom domains and SSL
certificates, autoscaling, deployment slots, backups, Traffic Manager integration, and more. The higher the tier, the
more features are available. To find out which features are supported in each pricing tier, see App Service plan
details.
NOTE
The new PremiumV2 pricing tier provides Dv2-series VMs with faster processors, SSD storage, and double memory-to-core
ratio compared to Standard tier. PremiumV2 also supports higher scale via increased instance count while still providing all
the advanced capabilities found in the Standard plan. All features available in the existing Premium tier are included in
PremiumV2.
Similar to other dedicated tiers, three VM sizes are available for this tier:
Small (one CPU core, 3.5 GiB of memory)
Medium (two CPU cores, 7 GiB of memory)
Large (four CPU cores, 14 GiB of memory)
For PremiumV2 pricing information, see App Service Pricing.
To get started with the new PremiumV2 pricing tier, see Configure PremiumV2 tier for App Service.
NOTE
If you integrate App Service with another Azure service, you may need to consider charges from these other services. For
example, if you use Azure Traffic Manager to scale your app geographically, Azure Traffic Manager also charges you based on
your usage. To estimate your cross-services cost in Azure, see Pricing calculator.
Overview
Azure App Service Environment is an Azure App Service feature that provides a fully isolated and dedicated
environment for securely running App Service apps at high scale. This capability can host your web apps, mobile
apps, API apps, and functions.
App Service environments (ASEs) are appropriate for application workloads that require:
Very high scale.
Isolation and secure network access.
High memory utilization.
Customers can create multiple ASEs within a single Azure region or across multiple Azure regions. This flexibility
makes ASEs ideal for horizontally scaling stateless application tiers in support of high RPS workloads.
ASEs are isolated to running only a single customer's applications and are always deployed into a virtual network.
Customers have fine-grained control over inbound and outbound application network traffic. Applications can
establish high-speed secure connections over VPNs to on-premises corporate resources.
ASEs enable high-scale app hosting with secure network access. For more information, see the AzureCon Deep
Dive on ASEs.
Multiple ASEs can be used to scale horizontally. For more information, see how to set up a geo-distributed app
footprint.
ASEs can be used to configure security architecture, as shown in the AzureCon Deep Dive. To see how the
security architecture shown in the AzureCon Deep Dive was configured, see the article on how to implement a
layered security architecture with App Service environments.
Apps running on ASEs can have their access gated by upstream devices, such as web application firewalls
(WAFs). For more information, see Configure a WAF for App Service environments.
Dedicated environment
An ASE is dedicated exclusively to a single subscription and can host 100 instances. The range can span 100
instances in a single App Service plan to 100 single-instance App Service plans, and everything in between.
An ASE is composed of front ends and workers. Front ends are responsible for HTTP/HTTPS termination and
automatic load balancing of app requests within an ASE. Front ends are automatically added as the App Service
plans in the ASE are scaled out.
Workers are roles that host customer apps. Workers are available in three fixed sizes:
One vCPU/3.5 GB RAM
Two vCPU/7 GB RAM
Four vCPU/14 GB RAM
Customers do not need to manage front ends and workers. All infrastructure is automatically added as customers
scale out their App Service plans. As App Service plans are created or scaled in an ASE, the required infrastructure
is added or removed as appropriate.
There is a flat monthly rate for an ASE that pays for the infrastructure and doesn't change with the size of the ASE.
In addition, there is a cost per App Service plan vCPU. All apps hosted in an ASE are in the Isolated pricing SKU. For
information on pricing for an ASE, see the App Service pricing page and review the available options for ASEs.
When you use a provider SDK, users can sign in to an experience that integrates more tightly with the operating
system that the app is running on. This also gives you a provider token and some user information on the client,
which makes it much easier to consume graph APIs and customize the user experience. Occasionally on blogs and
forums, you will see this referred to as the "client flow" or "client-directed flow" because code on the client signs in
users, and the client code has access to a provider token.
After a provider token is obtained, it needs to be sent to App Service for validation. After App Service validates the
token, App Service creates a new App Service token that is returned to the client. The Mobile Apps client SDK has
helper methods to manage this exchange and automatically attach the token to all requests to the application
backend. Developers can also keep a reference to the provider token if they so choose.
Mobile authentication without a provider SDK
If you do not want to set up a provider SDK, you can allow the Mobile Apps feature of Azure App Service to sign in
for you. The Mobile Apps client SDK will open a web view to the provider of your choosing and sign in the user.
Occasionally on blogs and forums, you will see this referred to as the "server flow" or "server-directed flow"
because the server manages the process that signs in users, and the client SDK never receives the provider token.
Code to start this flow is included in the authentication tutorial for each platform. At the end of the flow, the client
SDK has an App Service token, and the token is automatically attached to all requests to the application backend.
Service -to -service authentication
Although you can give users access to your application, you can also trust another application to call your own API.
For example, you could have one web app call an API in another web app. In this scenario, you use credentials for a
service account instead of user credentials to get a token. A service account is also known as a service principal in
Azure Active Directory parlance, and authentication that uses such an account is also known as a service-to-service
scenario.
IMPORTANT
Because mobile apps run on customer devices, mobile applications do not count as trusted applications and should not use
a service principal flow. Instead, they should use a user flow that was detailed earlier.
For service-to-service scenarios, App Service can protect your application by using Azure Active Directory. The
calling application just needs to provide an Azure Active Directory service principal authorization token that is
obtained by providing the client ID and client secret from Azure Active Directory. An example of this scenario that
uses ASP.NET API apps is explained by the tutorial, [Service principal authentication for API Apps][apia-service].
If you want to use App Service authentication to handle a service-to-service scenario, you can use client certificates
or basic authentication. For information about client certificates in Azure, see How To Configure TLS Mutual
Authentication for Web Apps. For information about basic authentication in ASP.NET, see Authentication Filters in
ASP.NET Web API 2.
Service account authentication from an App Service logic app to an API app is a special case that is detailed in
Using your custom API hosted on App Service with Logic apps.
App Service on Linux offers two different paths to getting your application published to the web:
Custom image deployment: "Dockerize" your app into a Docker image that contains all of your files and
dependencies in a ready-to-run package.
App deployment with a built-in platform image: Our built-in platform images contain common web app
runtimes and dependencies, such as Node and PHP. Use any one of the Azure App Service deployment methods
to deploy your app to your web app's storage, and then use a built-in platform image to run it.
Which method is right for your app? The primary factors to consider are:
Availability of Docker in your development workflow: Custom image development requires basic
knowledge of the Docker development workflow. Deployment of a custom image to a web app requires
publication of your custom image to a repository host like Docker Hub. If you are familiar with Docker and can
add Docker tasks to your build workflow, or if you are already publishing your app as a Docker image, a custom
image is almost certainly the best choice.
Unique runtime requirements: The built-in platform images are designed to meet the needs of most web
apps, but are limited in their customizability. Your app may have unique dependencies or other runtime
requirements that exceed what the built-in images are capable of.
Build requirements: With continuous deployment, you can get your app up and running on Azure directly
from source code. No external build or publication process is required. However, there is a limit to the
customizability and availability of build tools within the Kudu deployment engine. Your app may outgrow
Kudu's capabilities as it grows in its dependencies or requirements for custom build logic.
Disk read/write requirements: All web apps are allocated a storage volume for web content. This volume,
backed by Azure Storage, is mounted to /home in the app's filesystem. Unlike files in the container filesystem,
files in the content volume are accessible across all scale instances of an app, and modifications will persist
across app restarts. However, the disk latency of the content volume is higher and more variable than the
latency of the local container filesystem, and access can be impacted by platform upgrades, unplanned
downtime, and network connectivity issues. Apps that require heavy read-only access to content files may
benefit from custom image deployment, which places files in the image filesystem instead of on the content
volume.
Build resource usage: When an app is deployed from source, the deployment scripts run by Kudu use the
same App Service Plan compute and storage resources as the running app. Large app deployments may
consume more resources or time than desired. In particular, many deployment workflows generate heavy disk
activity on the app content volume, which is not optimized for such activity. A custom image delivers all of your
app's files and dependencies to Azure in a single package with no need for additional file transfers or
deployment actions.
Need for rapid iteration: Dockerizing an app requires additional build steps. For changes to take effect, you
must push your new image to a repository with each update. These updates are then pulled to the Azure
environment. If one of the built-in containers meets your app's needs, deploying from source may offer a faster
development workflow.
Configure web apps in Azure App Service
1/2/2018 • 6 min to read • Edit Online
This topic explains how to configure a web app using the Azure Portal.
NOTE
Although this article refers to web apps, it also applies to API apps and mobile apps.
Application settings
1. In the Azure Portal, open the blade for the web app.
2. Click Application settings.
The Application settings blade has settings grouped under several categories.
General settings
Framework versions. Set these options if your app uses any these frameworks:
.NET Framework: Set the .NET framework version.
PHP: Set the PHP version, or OFF to disable PHP.
Java: Select the Java version or OFF to disable Java. Use the Web Container option to choose between Tomcat
and Jetty versions.
Python: Select the Python version, or OFF to disable Python.
For technical reasons, enabling Java for your app disables the .NET, PHP, and Python options.
Platform. Selects whether your web app runs in a 32-bit or 64-bit environment. The 64-bit environment requires
Basic or Standard mode. Free and Shared modes always run in a 32-bit environment.
NOTE
App Service Free and Shared (preview) hosting plans are base tiers that run on the same Azure VM as other App Service
apps. Some apps may belong to other customers. These tiers are intended to be used only for development and testing
purposes.
Web Sockets. Set ON to enable the WebSocket protocol; for example, if your web app uses ASP.NET SignalR or
socket.io.
Always On. By default, web apps are unloaded if they are idle for some period of time. This lets the system
conserve resources. In Basic or Standard mode, you can enable Always On to keep the app loaded all the time. If
your app runs continuous WebJobs or runs WebJobs triggered using a CRON expression, you should enable
Always On, or the web jobs may not run reliably.
Managed Pipeline Version. Sets the IIS pipeline mode. Leave this set to Integrated (the default) unless you have a
legacy app that requires an older version of IIS.
Auto Swap. If you enable Auto Swap for a deployment slot, App Service will automatically swap the web app into
production when you push an update to that slot. For more information, see Deploy to staging slots for web apps
in Azure App Service.
Debugging
Remote Debugging. Enables remote debugging. When enabled, you can use the remote debugger in Visual
Studio to connect directly to your web app. Remote debugging will remain enabled for 48 hours.
App settings
This section contains name/value pairs that you web app will load on start up.
For .NET apps, these settings are injected into your .NET configuration AppSettings at runtime, overriding
existing settings.
PHP, Python, Java and Node applications can access these settings as environment variables at runtime. For
each app setting, two environment variables are created; one with the name specified by the app setting entry,
and another with a prefix of APPSETTING_. Both contain the same value.
Connection strings
Connection strings for linked resources.
For .NET apps, these connection strings are injected into your .NET configuration connectionStrings settings at
runtime, overriding existing entries where the key equals the linked database name.
For PHP, Python, Java and Node applications, these settings will be available as environment variables at runtime,
prefixed with the connection type. The environment variable prefixes are as follows:
SQL Server: SQLCONNSTR_
MySQL: MYSQLCONNSTR_
SQL Database: SQLAZURECONNSTR_
Custom: CUSTOMCONNSTR_
For example, if a MySql connection string were named connectionstring1 , it would be accessed through the
environment variable MYSQLCONNSTR_connectionString1 .
Default documents
The default document is the web page that is displayed at the root URL for a website. The first matching file in the
list is used.
Web apps might use modules that route based on URL, rather than serving static content, in which case there is no
default document as such.
Handler mappings
Use this area to add custom script processors to handle requests for specific file extensions.
Extension. The file extension to be handled, such as *.php or handler.fcgi.
Script Processor Path. The absolute path of the script processor. Requests to files that match the file extension
will be processed by the script processor. Use the path D:\home\site\wwwroot to refer to your app's root
directory.
Additional Arguments. Optional command-line arguments for the script processor
Virtual applications and directories
To configure virtual applications and directories, specify each virtual directory and its corresponding physical path
relative to the website root. Optionally, you can select the Application checkbox to mark a virtual directory as an
application.
The full FTP user name is “app\username” where app is the name of your web app. The username is listed in the
web app blade, under Essentials.
NOTE
If you want to get started with Azure App Service before signing up for an Azure account, go to Try App Service, where you
can immediately create a short-lived starter web app in App Service. No credit cards required; no commitments.
Next steps
Configure a custom domain name in Azure App Service
Enable HTTPS for an app in Azure App Service
Scale a web app in Azure App Service
Monitoring basics for Web Apps in Azure App Service
Deploy your app to Azure App Service using FTP/S
9/19/2017 • 2 min to read • Edit Online
This article shows you how to use FTP or FTPS to deploy your web app, mobile app backend, or API app to Azure
App Service.
The FTP/S endpoint for your app is already active. No configuration is necessary to enable FTP/S deployment.
IMPORTANT
We are continuously taking steps to improve Microsoft Azure Platform security. As part of this ongoing effort an upgrade of
Web Applications is planned for Germany Central and Germany Northeast regions. During this Web Apps will be disabling
the use of plain text FTP protocol for deployments. Our recommendation to our customers is to switch to FTPS for
deployments. We do not expect any disruption to your service during this upgrade which is planned for 9/5. We appreciate
you support in this effort.
NOTE
The FTP/Deployment User user value as displayed by the Azure Portal including the app name in order to provide
proper context for the FTP server. You can find the same information when you select Properties in the left menu.
Also, the deployment password is never shown. If you forget your deployment password, go back to step 1 and reset
your deployment password.
Step 3: Deploy files to Azure
1. From your FTP client (Visual Studio, FileZilla, etc), use the connection information you gathered to connect to
your app.
2. Copy your files and their respective directory structure to the /site/wwwroot directory in Azure (or the
/site/wwwroot/App_Data/Jobs/ directory for WebJobs).
3. Browse to your app's URL to verify the app is running properly.
NOTE
Unlike Git-based deployments, FTP deployment doesn't support the following deployment automations:
dependency restore (such as NuGet, NPM, PIP, and Composer automations)
compilation of .NET binaries
generation of web.config (here is a Node.js example)
You must restore, build, and generate these necessary files manually on your local machine and deploy them together with
your app.
Next steps
For more advanced deployment scenarios, try deploying to Azure with Git. Git-based deployment to Azure enables
version control, package restore, MSBuild, and more.
More Resources
Azure App Service Deployment Credentials
Sync content from a cloud folder to Azure App
Service
11/7/2017 • 1 min to read • Edit Online
This tutorial shows you how to deploy to Azure App Service by syncing your content from popular cloud storage
services like Dropbox and OneDrive.
NOTE
Because of underlying differences in the APIs, OneDrive for Business is not supported at this time.
2. Complete the authorization workflow to enable App Service to access a specific pre-defined designated path
for OneDrive or Dropbox where all of your App Service content will be stored.
After authorization the App Service platform will give you the option to create a content folder under the
designated content path, or to choose an existing content folder under this designated content path. The
designated content paths under your cloud storage accounts used for App Service sync are the following:
OneDrive: Apps\Azure Web Apps
Dropbox: Dropbox\Apps\Azure
3. After the initial content sync the content sync can be initiated on demand from the Azure portal. Deployment
history is available with the Deployments blade.
More information for Dropbox deployment is available under Deploy from Dropbox.
Continuous Deployment to Azure App Service
9/19/2017 • 3 min to read • Edit Online
This tutorial shows you how to configure a continuous deployment workflow for your Azure Web Apps. App
Service integration with BitBucket, GitHub, and Visual Studio Team Services (VSTS) enables a continuous
deployment workflow where Azure pulls in the most recent updates from your project published to one of these
services. Continuous deployment is a great option for projects where multiple and frequent contributions are
being integrated.
To find out how to configure continuous deployment manually from a cloud repository not listed by the Azure
Portal (such as GitLab), see Setting up continuous deployment using manual steps.
NOTE
To configure a VSTS account for App Service deployment please see this tutorial.
App Service creates an association with the selected repository, pulls in the files from the specified branch,
and maintains a clone of your repository for your App Service app. When you configure VSTS continuous
deployment from the Azure portal, the integration uses the App Service Kudu deployment engine, which
already automates build and deployment tasks with every git push . You do not need to separately set up
continuous deployment in VSTS. After this process completes, the Deployment options app blade will
show an active deployment that indicates deployment has succeeded.
5. To verify the app is successfully deployed, click the URL at the top of the app's blade in the Azure portal.
6. To verify that continuous deployment is occurring from the repository of your choice, push a change to the
repository. Your app should update to reflect the changes shortly after the push to the repository completes.
You can verify that it has pulled in the update in the Deployment options blade of your app.
2. After answering Yes to the confirmation message, you can return to your app's blade and click APP
DEPLOYMENT > Deployment options if you would like to set up publishing from another source.
Additional Resources
How to investigate common issues with continuous deployment
How to use PowerShell for Azure
How to use the Azure Command-Line Tools for Mac and Linux
Git documentation
Project Kudu
Use Azure to automatically generate a CI/CD pipeline to deploy an ASP.NET 4 app
NOTE
If you want to get started with Azure App Service before signing up for an Azure account, go to Try App Service, where you
can immediately create a short-lived starter web app in App Service. No credit cards required; no commitments.
Local Git Deployment to Azure App Service
1/9/2018 • 5 min to read • Edit Online
This tutorial shows you how to deploy your app to Azure Web Apps from a Git repository on your local computer.
App Service supports this approach with the Local Git deployment option in the Azure Portal.
Many of the Git commands described in this article are performed automatically when creating an App Service
app using the Azure Command-Line Interface as described here.
Prerequisites
To complete this tutorial, you need:
Git. You can download the installation binary here.
Basic knowledge of Git.
A Microsoft Azure account. If you don't have an account, you can sign up for a free trial or activate your Visual
Studio subscriber benefits.
NOTE
If you want to get started with Azure App Service before signing up for an Azure account, go to Try App Service, where you
can immediately create a short-lived starter app in App Service. No credit cards required; no commitments.
git init
git add -A
1. Next, commit the changes to the repository by using the following command:
git commit -m "Hello Azure App Service"
3. If this is your first time setting up a repository in Azure, you need to create login credentials for it. You will
use them to log into the Azure repository and push changes from your local Git repository. From your
app's blade, click Deployment > Deployment credentials, then configure your deployment username
and password. When you're done, click Save.
NOTE
The remote command adds a named reference to a remote repository. In this example, it creates a reference named
'azure' for your web app's repository.
4. Push your content to App Service using the new azure remote you just created.
You will be prompted for the password you created earlier when you reset your deployment credentials in the
Azure Portal. Enter the password (note that Gitbash does not echo asterisks to the console as you type your
password).
1. Go back to your app in the Azure Portal. A log entry of your most recent push should be displayed in the
Deployments blade.
2. Click the Browse button at the top of the app's blade to verify the content has been deployed.
Troubleshooting
The following are errors or problems commonly encountered when using Git to publish to an App Service app in
Azure:
Symptom: No refs in common and none specified; doing nothing. Perhaps you should specify a branch such as
'master'.
Cause: This error can occur if you do not specify a branch when performing a git push operation, and have not set
the push.default value used by Git.
Resolution: Perform the push operation again, specifying the master branch. For example:
Symptom: Error - Changes committed to remote repository but your web app not updated.
Cause: This error can occur if you are deploying a Node.js app containing a package.json file that specifies
additional required modules.
Resolution: Additional messages containing 'npm ERR!' should be logged prior to this error, and can provide
additional context on the failure. The following are known causes of this error and the corresponding 'npm ERR!'
message:
Malformed package.json file: npm ERR! Couldn't read dependencies.
Native module that does not have a binary distribution for Windows:
npm ERR! `cmd "/c" "node-gyp rebuild"` failed with 1
OR
npm ERR! [modulename@version] preinstall: `make || gmake`
Additional Resources
Git documentation
Project Kudu documentation
Continuous Deployment to Azure App Service
How to use PowerShell for Azure
How to use the Azure Command-Line Interface
Provision and deploy microservices predictably in
Azure
9/28/2017 • 14 min to read • Edit Online
This tutorial shows how to provision and deploy an application composed of microservices in Azure App Service as
a single unit and in a predictable manner using JSON resource group templates and PowerShell scripting.
When provisioning and deploying high-scale applications that are composed of highly decoupled microservices,
repeatability and predictability are crucial to success. Azure App Service enables you to create microservices that
include web apps, mobile apps, API apps, and logic apps. Azure Resource Manager enables you to manage all the
microservices as a unit, together with resource dependencies such as database and source control settings. Now,
you can also deploy such an application using JSON templates and simple PowerShell scripting.
NOTE
Although this article refers to web apps, it also applies to API apps and mobile apps.
4. Next, click Deploy to start the deployment process. Once the process runs to completion, click the
http://todoappXXXX.azurewebsites.net link to browse the deployed application.
The UI would be a little slow when you first browse to it because the apps are just starting up, but convince
yourself that it’s a fully-functional application.
5. Back in the Deploy page, click the Manage link to see the new application in the Azure Portal.
6. In the Essentials dropdown, click the resource group link. Note also that the web app is already connected to
the GitHub repository under External Project.
7. In the resource group blade, note that there are already two web apps and one SQL Database in the resource
group.
Everything that you just saw in a few short minutes is a fully deployed two-microservice application, with all the
components, dependencies, settings, database, and continuous publishing, set up by an automated orchestration in
Azure Resource Manager. All this was done by two things:
The Deploy to Azure button
azuredeploy.json in the repo root
You can deploy this same application tens, hundreds, or thousands of times and have the exact same configuration
every time. The repeatability and the predictability of this approach enables you to deploy high-scale applications
with ease and confidence.
2. From the repository root, open azuredeploy.json in Visual Studio. If you don’t see the JSON Outline pane,
you need to install Azure .NET SDK.
I’m not going to describe every detail of the JSON format, but the More Resources section has links for learning the
resource group template language. Here, I’m just going to show you the interesting features that can help you get
started in making your own custom template for app deployment.
Parameters
Take a look at the parameters section to see that most of these parameters are what the Deploy to Azure button
prompts you to input. The site behind the Deploy to Azure button populates the input UI using the parameters
defined in azuredeploy.json. These parameters are used throughout the resource definitions, such as resource
names, property values, etc.
Resources
In the resources node, you can see that 4 top-level resources are defined, including a SQL Server instance, an App
Service plan, and two web apps.
App Service plan
Let’s start with a simple root-level resource in the JSON. In the JSON Outline, click the App Service plan named
[hostingPlanName] to highlight the corresponding JSON code.
Note that the type element specifies the string for an App Service plan (it was called a server farm a long, long
time ago), and other elements and properties are filled in using the parameters defined in the JSON file, and this
resource doesn’t have any nested resources.
NOTE
Note also that the value of apiVersion tells Azure which version of the REST API to use the JSON resource definition with,
and it can affect how the resource should be formatted inside the {} .
SQL Server
Next, click on the SQL Server resource named SQLServer in the JSON Outline.
Note the following about the highlighted JSON code:
The use of parameters ensures that the created resources are named and configured in a way that makes them
consistent with one another.
The SQLServer resource has two nested resources, each has a different value for type .
The nested resources inside “resources”: […] , where the database and the firewall rules are defined, have a
dependsOn element that specifies the resource ID of the root-level SQLServer resource. This tells Azure
Resource Manager, “before you create this resource, that other resource must already exist; and if that other
resource is defined in the template, then create that one first”.
NOTE
For detailed information on how to use the resourceId() function, see Azure Resource Manager Template
Functions.
The effect of the dependsOn element is that Azure Resource Manager can know which resources can be created
in parallel and which resources must be created sequentially.
Web app
Now, let’s move on to the actual web apps themselves, which are more complicated. Click the
[variables(‘apiSiteName’)] web app in the JSON Outline to highlight its JSON code. You’ll notice that things are
getting much more interesting. For this purpose, I’ll talk about the features one by one:
R o o t r e so u r c e
The web app depends on two different resources. This means that Azure Resource Manager will create the web app
only after both the App Service plan and the SQL Server instance are created.
A p p se t t i n g s
C o n n e c t i o n st r i n g s
In the properties element for config/connectionstrings , each connection string is also defined as a name:value
pair, with the specific format of “<name>” : {“value”: “…”, “type”: “…”} . For the type element, possible values are
MySql , SQLServer , SQLAzure , and Custom .
TIP
For a definitive list of the connection string types, run the following command in Azure PowerShell:
[Enum]::GetNames("Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities.DatabaseType")
So u r c e c o n t r o l
The source control settings are also defined as a nested resource. Azure Resource Manager uses this resource to
configure continuous publishing (see caveat on IsManualIntegration later) and also to kick off the deployment of
application code automatically during the processing of the JSON file.
RepoUrl and branch should be pretty intuitive and should point to the Git repository and the name of the branch
to publish from. Again, these are defined by input parameters.
Note in the dependsOn element that, in addition to the web app resource itself, sourcecontrols/web also depends on
config/appsettings and config/connectionstrings . This is because once sourcecontrols/web is configured, the
Azure deployment process will automatically attempt to deploy, build, and start the application code. Therefore,
inserting this dependency helps you make sure that the application has access to the required app settings and
connection strings before the application code is run.
NOTE
Note also that IsManualIntegration is set to true . This property is necessary in this tutorial because you do not actually
own the GitHub repository, and thus cannot actually grant permission to Azure to configure continuous publishing from
ToDoApp (i.e. push automatic repository updates to Azure). You can use the default value false for the specified repository
only if you have configured the owner’s GitHub credentials in the Azure portal before. In other words, if you have set up
source control to GitHub or BitBucket for any app in the Azure Portal previously, using your user credentials, then Azure will
remember the credentials and use them whenever you deploy any app from GitHub or BitBucket in the future. However, if
you haven’t done this already, deployment of the JSON template will fail when Azure Resource Manager tries to configure the
web app’s source control settings because it cannot log into GitHub or BitBucket with the repository owner’s credentials.
If you drill down to a web app, you should be able to see web app configuration details similar to the below
screenshot:
Again, the nested resources should have a hierarchy very similar to those in your JSON template file, and you
should see the app settings, connection strings, etc., properly reflected in the JSON pane. The absence of settings
here may indicate an issue with your JSON file and can help you troubleshoot your JSON template file.
7. Select Application Insights for Web Apps, then make sure an existing App Service plan and web app is
selected, and then click Add.
You’ll now be able to see several new resources that, depending on the resource and what it does, have
dependencies on either the App Service plan or the web app. These resources are not enabled by their
existing definition and you’re going to change that.
8. In the JSON Outline, click appInsights AutoScale to highlight its JSON code. This is the scaling setting for your
App Service plan.
9. In the highlighted JSON code, locate the location and enabled properties and set them as shown below.
10. In the JSON Outline, click CPUHigh appInsights to highlight its JSON code. This is an alert.
11. Locate the location and isEnabled properties and set them as shown below. Do the same for the other
three alerts (purple bulbs).
12. You’re now ready to deploy. Right-click the project and select Deploy > New Deployment.
13. Log into your Azure account if you haven’t already done so.
14. Select an existing resource group in your subscription or create a new one, select azuredeploy.json, and
then click Edit Parameters.
You’ll now be able to edit all the parameters defined in the template file in a nice table. Parameters that
define defaults will already have their default values, and parameters that define a list of allowed values will
be shown as dropdowns.
15. Fill in all the empty parameters, and use the GitHub repo address for ToDoApp in repoUrl. Then, click Save.
NOTE
Autoscaling is a feature offered in Standard tier or higher, and plan-level alerts are features offered in Basic tier or
higher, you’ll need to set the sku parameter to Standard or Premium in order to see all your new App Insights
resources light up.
16. Click Deploy. If you selected Save passwords, the password will be saved in the parameter file in plain text.
Otherwise, you’ll be asked to input the database password during the deployment process.
That’s it! Now you just need to go to the Azure Portal and the Azure Resource Explorer tool to see the new alerts
and autoscale settings added to your JSON deployed application.
Your steps in this section mainly accomplished the following:
1. Prepared the template file
2. Created a parameter file to go with the template file
3. Deployed the template file with the parameter file
The last step is easily done by a PowerShell cmdlet. To see what Visual Studio did when it deployed your
application, open Scripts\Deploy-AzureResourceGroup.ps1. There’s a lot of code there, but I’m just going to
highlight all the pertinent code you need to deploy the template file with the parameter file.
The last cmdlet, New-AzureResourceGroup , is the one that actually performs the action. All this should demonstrate to
you that, with the help of tooling, it is relatively straightforward to deploy your cloud application predictably. Every
time you run the cmdlet on the same template with the same parameter file, you’re going to get the same result.
Summary
In DevOps, repeatability and predictability are keys to any successful deployment of a high-scale application
composed of microservices. In this tutorial, you have deployed a two-microservice application to Azure as a single
resource group using the Azure Resource Manager template. Hopefully, it has given you the knowledge you need in
order to start converting your application in Azure into a template and can provision and deploy it predictably.
More resources
Azure Resource Manager Template Language
Authoring Azure Resource Manager Templates
Azure Resource Manager Template Functions
Deploy an application with Azure Resource Manager template
Using Azure PowerShell with Azure Resource Manager
Troubleshooting Resource Group Deployments in Azure
Configure deployment credentials for Azure App
Service
1/11/2018 • 2 min to read • Edit Online
Azure App Service supports two types of credentials for local Git deployment and FTP/S deployment. These are not
the same as your Azure Active Directory credentials.
User-level credentials: one set of credentials for the entire Azure account. It can be used to deploy to App
Service for any app, in any subscription, that the Azure account has permission to access. These are the
default credentials set that you configure in App Services > <app_name> > Deployment credentials.
This is also the default set that's surfaced in the portal GUI (such as the Overview and Properties of your
app's resource page).
NOTE
When you delegate access to Azure resources via Role Based Access Control (RBAC) or co-admin permissions, each
Azure user that receives access to an app can use his/her personal user-level credentials until access is revoked. These
deployment credentials should not be shared with other Azure users.
App-level credentials: one set of credentials for each app. It can be used to deploy to that app only. The
credentials for each app is generated automatically at app creation, and is found in the app's publish profile.
You cannot manually configure the credentials, but you can reset them for an app anytime.
NOTE
In order to give someone access to these credentials via Role Based Access Control (RBAC), you need to make them
contributor or higher on the Web App. Readers are not allowed to publish, and hence can't access those credentials.
NOTE
In the portal, you must have at least one app before you can access the deployment credentials page. However, with
the Azure CLI, you can configure user-level credentials without an existing app.
2. Configure the user name and password, and then click Save.
Once you have set your deployment credentials, you can find the Git deployment username in your app's
Overview,
3. Open the .PublishSettings file and find the <publishProfile> tag with the attribute publishMethod="FTP" .
Then, get its userName and password attributes. These are the app-level credentials.
Similar to the user-level credentials, the FTP deployment username is in the format of
<app_name>\<username> , and the Git deployment username is just <username> without the preceding
<app_name>\ .
Next steps
Find out how to use these credentials to deploy your app from local Git or using FTP/S.
Set up staging environments in Azure App Service
9/19/2017 • 10 min to read • Edit Online
When you deploy your web app, web app on Linux, mobile back end, and API app to App Service, you can deploy
to a separate deployment slot instead of the default production slot when running in the Standard or Premium
App Service plan mode. Deployment slots are actually live apps with their own hostnames. App content and
configurations elements can be swapped between two deployment slots, including the production slot. Deploying
your application to a deployment slot has the following benefits:
You can validate app changes in a staging deployment slot before swapping it with the production slot.
Deploying an app to a slot first and swapping it into production ensures that all instances of the slot are
warmed up before being swapped into production. This eliminates downtime when you deploy your app. The
traffic redirection is seamless, and no requests are dropped as a result of swap operations. This entire
workflow can be automated by configuring Auto Swap when pre-swap validation is not needed.
After a swap, the slot with previously staged app now has the previous production app. If the changes swapped
into the production slot are not as you expected, you can perform the same swap immediately to get your "last
known good site" back.
Each App Service plan mode supports a different number of deployment slots. To find out the number of slots
your app's mode supports, see App Service Pricing.
When your app has multiple slots, you cannot change the mode.
Scaling is not available for non-production slots.
Linked resource management is not supported for non-production slots. In the Azure Portal only, you can
avoid this potential impact on a production slot by temporarily moving the non-production slot to a different
App Service plan mode. Note that the non-production slot must once again share the same mode with the
production slot before you can swap the two slots.
3. In the Add a slot blade, give the slot a name, and select whether to clone app configuration from another
existing deployment slot. Click the check mark to continue.
The first time you add a slot, you will only have two choices: clone configuration from the default slot in
production or not at all. After you have created several slots, you will be able to clone configuration from a
slot other than the one in production:
4. In your app's resource blade, click Deployment slots, then click a deployment slot to open that slot's
resource blade, with a set of metrics and configuration just like any other app. The name of the slot is
shown at the top of the blade to remind you that you are viewing the deployment slot.
5. Click the app URL in the slot's blade. Notice the deployment slot has its own hostname and is also a live app.
To limit public access to the deployment slot, see App Service Web App – block web access to non-production
deployment slots.
There is no content after deployment slot creation. You can deploy to the slot from a different repository branch,
or an altogether different repository. You can also change the slot's configuration. Use the publish profile or
deployment credentials associated with the deployment slot for content updates. For example, you can publish to
this slot with git.
IMPORTANT
Before you swap an app from a deployment slot into production, make sure that all non-slot specific settings are configured
exactly as you want to have it in the swap target.
1. To swap deployment slots, click the Swap button in the command bar of the app or in the command bar of
a deployment slot.
2. Make sure that the swap source and swap target are set properly. Usually, the swap target is the production
slot. Click OK to complete the operation. When the operation finishes, the deployment slots have been
swapped.
For the Swap with preview swap type, see Swap with preview (multi-phase swap).
NOTE
Swap with preview is not supported in web apps on Linux.
When you use the Swap with preview option (see Swap deployment slots), App Service does the following:
Keeps the destination slot unchanged so existing workload on that slot (e.g. production) is not impacted.
Applies the configuration elements of the destination slot to the source slot, including the slot-specific
connection strings and app settings.
Restarts the worker processes on the source slot using these aforementioned configuration elements.
When you complete the swap: Moves the pre-warmed-up source slot into the destination slot. The destination
slot is moved into the source slot as in a manual swap.
When you cancel the swap: Reapplies the configuration elements of the source slot to the source slot.
You can preview exactly how the app will behave with the destination slot's configuration. Once you complete
validation, you complete the swap in a separate step. This step has the added advantage that the source slot is
already warmed up with the desired configuration, and clients will not experience any downtime.
Samples for the Azure PowerShell cmdlets available for multi-phase swap are included in the Azure PowerShell
cmdlets for deployment slots section.
IMPORTANT
When you enable Auto Swap for a slot, make sure the slot configuration is exactly the configuration intended for the target
slot (usually the production slot).
NOTE
Auto swap is not supported in web apps on Linux.
Configuring Auto Swap for a slot is easy. Follow the steps below:
1. In Deployment Slots, select a non-production slot, and choose Application Settings in that slot's
resource blade.
2. Select On for Auto Swap, select the desired target slot in Auto Swap Slot, and click Save in the command
bar. Make sure configuration for the slot is exactly the configuration intended for the target slot.
The Notifications tab will flash a green SUCCESS once the operation is complete.
NOTE
To test Auto Swap for your app, you can first select a non-production target slot in Auto Swap Slot to become
familiar with the feature.
3. Execute a code push to that deployment slot. Auto Swap will happen after a short time and the update will be
reflected at your target slot's URL.
<applicationInitialization>
<add initializationPage="/" hostName="[app hostname]" />
<add initializationPage="/Home/About" hostname="[app hostname]" />
</applicationInitialization>
New-AzureRmWebApp -ResourceGroupName [resource group name] -Name [app name] -Location [location] -
AppServicePlan [app service plan name]
New-AzureRmWebAppSlot -ResourceGroupName [resource group name] -Name [app name] -Slot [deployment slot name]
-AppServicePlan [app service plan name]
Initiate a swap with review (multi-phase swap) and apply destination slot configuration to source slot
Cancel a pending swap (swap with review) and restore source slot configuration
NOTE
For Azure CLI 2.0 commands for deployment slots, see az appservice web deployment slot.
To enable source control for the new slot, use the --git option, as in the following example.
azure site create --git webappslotstest --slot staging
Next Steps
Azure App Service Web App – block web access to non-production deployment slots Introduction to App Service
on Linux Microsoft Azure Free Trial
Buy a custom domain name for Azure Web Apps
1/2/2018 • 8 min to read • Edit Online
App Service domains (preview) are top-level domains that are managed directly in Azure. They make it easy to
manage custom domains for Azure Web Apps. This tutorial shows you how to buy an App Service domain and
assign DNS names to Azure Web Apps.
This article is for Azure App Service (Web Apps, API Apps, Mobile Apps, Logic Apps). For Azure VM or Azure
Storage, see Assign App Service domain to Azure VM or Azure Storage. For Cloud Services, see Configuring a
custom domain name for an Azure cloud service.
Prerequisites
To complete this tutorial:
Create an App Service app, or use an app that you created for another tutorial.
Remove the spending limit on your subscription. You cannot buy App Service domains with free subscription
credits.
To use custom domains in Azure Web Apps, your web app's App Service plan must be a paid tier (Shared, Basic,
Standard, or Premium). In this step, you make sure that the web app is in the supported pricing tier.
Sign in to Azure
Open the Azure portal and sign in with your Azure account.
Navigate to the app in the Azure portal
From the left menu, select App Services, and then select the name of the app.
The app's current tier is highlighted by a blue border. Check to make sure that the app is not in the Free tier.
Custom DNS is not supported in the Free tier.
If the App Service plan is not Free, close the Choose your pricing tier page and skip to Buy the domain.
Scale up the App Service plan
Select any of the non-free tiers (Shared, Basic, Standard, or Premium).
Click Select.
When you see the following notification, the scale operation is complete.
Buy the domain
Sign in to Azure
Open the Azure portal and sign in with your Azure account.
Launch Buy domains
In the Web Apps tab, click the name of your web app, select Settings, and then select Custom domains
NOTE
If you cannot see the App Service Domains section, you need to remove the spending limit on your Azure account (see
Prerequisites).
Click the Contact Information and fill out the domain's contact information form. When finished, click OK to
return to the App Service Domain page.
It is important that you fill out all required fields with as much accuracy as possible. Incorrect data for contact
information can result in failure to purchase domains.
Next, select the desired options for your domain. See the following table for explanations:
Assign default hostnames www and @ Select the desired hostname bindings, if
desired. When the domain purchase
operation is complete, your web app
can be accessed at the selected
hostnames. If the web app is behind
Azure Traffic Manager, you don't see
the option to assign the root domain
(@), because Traffic Manager does not
support A records. You can make
changes to the hostname assignments
after the domain purchase completes.
Accept terms and purchase
Click Legal Terms to review the terms and the charges, then click Buy.
NOTE
App Service Domains use Azure DNS to host the domains. In addition to the domain registration fee, usage charges for
Azure DNS apply. For information, see Azure DNS Pricing.
Back in the App Service Domain page, click OK. While the operation is in progress, you see the following
notifications:
You also see the selected hostnames in the Custom domains page, in the Custom Hostnames section.
To test the hostnames, navigate to the listed hostnames in the browser. In the example in the preceding
screenshot, try navigating to kontoso.net and www.kontoso.net.
Make sure that your purchased domain is listed in the App Service Domains section, but don't select it.
NOTE
All App Service Domains in the same subscription are shown in the web app's Custom domains page. If your domain is in
the web app's subscription, but you cannot see it in the web app's Custom domains page, try reopening the Custom
domains page or refresh the webpage. Also, check the notification bell at the top of the Azure portal for progress or
creation failures.
In the App Service Domains section, select the domain you want to configure.
From the left navigation of the domain, select Domain renewal. To stop renewing your domain automatically,
select Off, and then Save.
To manually renew your domain, select Renew domain. However, this button is not active until 90 days before
the domain's expiration.
Cancel or delete
In the domain's left menu, select Overview.
If the cancellation period on the purchased domain has not elapsed, select Cancel purchase. Otherwise, you see a
Delete button instead. To delete the domain without a refund, select Delete.
More resources
FAQ : App Service Domain (preview) and Custom Domains
Configuring a custom domain name for a web app in
Azure App Service using Traffic Manager
1/9/2018 • 7 min to read • Edit Online
When you use a Microsoft Azure Traffic Manager to load balance traffic to your Azure Website, that website can
then be accessed using the *.trafficmanager.net domain name assigned by Azure. You can also associate a
custom domain name, such as www.contoso.com, with your website in order to provide a more recognizable
domain name for your users.
This article provides generic instructions for using a custom domain name with an App Service app that is
integrated with Traffic Manager for load balancing.
If you do not already have a Traffic Manager profile, use the information in Create a Traffic Manager profile using
Quick Create to create one. Note the .trafficmanager.net domain name associated with your Traffic Manager
profile, as this will be used later by later steps in this document.
This article is for Azure App Service (Web Apps, API Apps, Mobile Apps, Logic Apps); for Cloud Services, see
Configuring a custom domain name for an Azure cloud service.
NOTE
If you app is load-balanced by Azure Traffic Manager, click the selector at the top of this article to get specific steps.
Custom domain names are not enabled for Free tier. You must scale up to a higher pricing tier, which may change how
much you are billed for your subscription. See App Service Pricing for more information.
NOTE
When your website is configured as a Traffic Manager endpoint, you will use the .trafficmanager.net address when creating
DNS records.
You can only use CNAME records with Traffic Manager
There are also multiple types of records, each with their own functions and limitations, but for websites configured
to as Traffic Manager endpoints, we only care about one; CNAME records.
CNAME or Alias record
A CNAME record maps a specific DNS name, such as mail.contoso.com or www.contoso.com, to another
(canonical) domain name. In the case of Azure Websites using Traffic Manager, the canonical domain name is the
<myapp>.trafficmanager.net domain name of your Traffic Manager profile. Once created, the CNAME creates
an alias for the <myapp>.trafficmanager.net domain name. The CNAME entry will resolve to the IP address of
your <myapp>.trafficmanager.net domain name automatically, so if the IP address of the website changes, you
do not have to take any action.
Once traffic arrives at Traffic Manager, it then routes the traffic to your website, using the load balancing method it
is configured for. This is completely transparent to visitors to your website. They will only see the custom domain
name in their browser.
NOTE
Some domain registrars only allow you to map subdomains when using a CNAME record, such as www.contoso.com, and
not root names, such as contoso.com. For more information on CNAME records, see the documentation provided by your
registrar, the Wikipedia entry on CNAME record, or the IETF Domain Names - Implementation and Specification document.
To associate your custom domain with a web app in Azure App Service, you must add a new entry in the DNS table
for your custom domain. You do this by using the management tools from your domain provider.
Sign in to the website of your domain provider.
Find the page for managing DNS records. Every domain provider has its own DNS records interface, so consult the
provider's documentation. Look for areas of the site labeled Domain Name, DNS, or Name Server
Management.
Often, you can find the DNS records page by viewing your account information, and then looking for a link such as
My domains. Go to that page and then look for a link that is named something like Zone file, DNS Records, or
Advanced configuration.
The following screenshot is an example of a DNS records page:
In the example screenshot, you select Add to create a record. Some providers have different links to add different
record types. Again, consult the provider's documentation.
NOTE
For certain providers, such as GoDaddy, changes to DNS records don't become effective until you select a separate Save
Changes link.
While the specifics of each domain provider vary, you map from your custom domain name (such as
contoso.com) to the Traffic Manager domain name (contoso.trafficmanager.net) that is integrated with your
web app.
NOTE
If a record is already in use and you need to preemptively bind your apps to it, you can create an additional CNAME record.
For example, to preemptively bind www.contoso.com to your web app, create a CNAME record from awverify.www to
contoso.trafficmanager.net. You can then add "www.contoso.com" to your Web App without changing the "www" CNAME
record. For more information, see Create DNS records for a web app in a custom domain.
Once you have finished adding or modifying DNS records at your domain provider, save the changes.
NOTE
It can take some time for your CNAME to propagate through the DNS system. You can use a service such as
http://www.digwebinterface.com/ to verify that the CNAME is available.
If you have not already added your web app as a Traffic Manager endpoint, you must do this before name
resolution will work, as the custom domain name routes to Traffic Manager. Traffic Manager then routes to your
web app. Use the information in Add or Delete Endpoints to add your web app as an endpoint in your Traffic
Manager profile.
NOTE
If your web app is not listed when adding an endpoint, verify that it is configured for Standard App Service plan mode. You
must use Standard mode for your web app in order to work with Traffic Manager.
1. In your browser, open the Azure Portal.
2. In the Web Apps tab, click the name of your web app, select Settings, and then select Custom domains
Next steps
For more information, see the Node.js Developer Center.
NOTE
If you want to get started with Azure App Service before signing up for an Azure account, go to Try App Service, where you
can immediately create a short-lived starter web app in App Service. No credit cards required; no commitments.
Migrate an active DNS name to Azure App Service
1/2/2018 • 3 min to read • Edit Online
This article shows you how to migrate an active DNS name to Azure App Service without any downtime.
When you migrate a live site and its DNS domain name to App Service, that DNS name is already serving live
traffic. You can avoid downtime in DNS resolution during the migration by binding the active DNS name to your
App Service app preemptively.
If you're not worried about downtime in DNS resolution, see Map an existing custom DNS name to Azure Web
Apps.
Prerequisites
To complete this how-to:
Make sure that your App Service app is not in FREE tier.
NOTE
For certain providers, such as GoDaddy, changes to DNS records don't become effective until you select a separate Save
Changes link.
In your DNS records page, note the record type of the DNS name you want to migrate. App Service supports
mappings from CNAME and A records.
Enable the domain for your app
In the Azure portal, in the left navigation of the app page, select Custom domains.
In the Custom domains page, select the + icon next to Add hostname.
Type the fully qualified domain name that you added the TXT record for, such as www.contoso.com . For a wildcard
domain (like *.contoso.com), you can use any DNS name that matches the wildcard domain.
Select Validate.
The Add hostname button is activated.
Make sure that Hostname record type is set to the DNS record type you want to migrate.
Select Add hostname.
It might take some time for the new hostname to be reflected in the app's Custom domains page. Try refreshing
the browser to update the data.
Next steps
Learn how to bind a custom SSL certificate to App Service.
Bind an existing custom SSL certificate to Azure Web Apps
Buy and Configure an SSL Certificate for your Azure
App Service
12/7/2017 • 8 min to read • Edit Online
This tutorial shows you how to secure your web app by purchasing an SSL certificate for your Azure App Service,
securely storing it in Azure Key Vault, and associating it with a custom domain.
Enter a friendly Name for your SSL certificate and enter the Domain Name
NOTE
This step is one of the most critical parts of the purchase process. Make sure to enter correct host name (custom domain)
that you want to protect with this certificate. DO NOT append the Host name with WWW.
WARNING
App Service Certificates can only be used by other App Services within the same subscription.
Step 3 - Store the certificate in Azure Key Vault
NOTE
Key Vault is an Azure service that helps safeguard cryptographic keys and secrets used by cloud applications and services.
Once the SSL Certificate purchase is complete, you need to open the App Service Certificates page.
The certificate status is “Pending Issuance” as there are few more steps you need to complete before you can
start using this certificate.
Click Certificate Configuration inside the Certificate Properties page and Click on Step 1: Store to store this
certificate in Azure Key Vault.
From the Key Vault Status page, click Key Vault Repository to choose an existing Key Vault to store this
certificate OR Create New Key Vault to create new Key Vault inside same subscription and resource group.
NOTE
Azure Key Vault has minimal charges for storing this certificate. For more information, see Azure Key Vault Pricing Details.
Once you have selected the Key Vault Repository to store this certificate in, the Store option should show success.
Step 4 - Verify the Domain Ownership
From the same Certificate Configuration page you used in Step 3, click Step 2: Verify.
Choose the preferred domain verification method.
There are four types of domain verification supported by App Service Certificates: App Service, Domain, Mail, and
Manual Verification. These verification types are explained in more details in the Advanced section.
NOTE
App Service Verification is the most convenient option when the domain you want to verify is already mapped to an App
Service app in the same subscription. It takes advantage of the fact that the App Service app has already verified the domain
ownership.
In the Azure portal, click the App Service option on the left of the page.
Click the name of your app to which you want to assign this certificate.
In the Settings, click SSL certificates.
Click Import App Service Certificate and select the certificate that you just purchased.
In the ssl bindings section Click on Add bindings, and use the dropdowns to select the domain name to secure
with SSL, and the certificate to use. You may also select whether to use Server Name Indication (SNI) or IP based
SSL.
Click Add Binding to save the changes and enable SSL.
NOTE
If you selected IP based SSL and your custom domain is configured using an A record, you must perform the following
additional steps. These are explained in more details in the Advanced section.
At this point, you should be able to visit your app using HTTPS:// instead of HTTP:// to verify that the certificate
has been configured correctly.
fqdn=<replace-with-www.{yourdomain}>
pfxPath=<replace-with-path-to-your-.PFX-file>
pfxPassword=<replace-with-your=.PFX-password>
resourceGroup=myResourceGroup
webappname=mywebapp$RANDOM
# Create an App Service plan in Basic tier (minimum required by custom domains).
az appservice plan create --name $webappname --resource-group $resourceGroup --sku B1
# Before continuing, go to your DNS configuration UI for your custom domain and follow the
# instructions at https://aka.ms/appservicecustomdns to configure a CNAME record for the
# hostname "www" and point it your web app's default domain name.
PowerShell
$fqdn="<Replace with your custom domain name>"
$pfxPath="<Replace with path to your .PFX file>"
$pfxPassword="<Replace with your .PFX password>"
$webappname="mywebapp$(Get-Random)"
$location="West Europe"
# Before continuing, go to your DNS configuration UI for your custom domain and follow the
# instructions at https://aka.ms/appservicecustomdns to configure a CNAME record for the
# hostname "www" and point it your web app's default domain name.
# Upgrade App Service plan to Basic tier (minimum required by custom SSL certificates)
Set-AzureRmAppServicePlan -Name $webappname -ResourceGroupName $webappname `
-Tier Basic
Advanced
Verifying Domain Ownership
There are two more types of domain verification supported by App service Certificates: Mail, and Manual
Verification.
Mail Verification
Verification email has already been sent to the Email Address(es) associated with this custom domain. To complete
the Email verification step, open the email and click the verification link.
If you need to resend the verification email, click the Resend Email button.
Domain Verification
Choose this option only for an App Service domain that you purchased from Azure.. Azure automatically adds the
verification TXT record for you and completes the process.
Manual Verification
IMPORTANT
HTML Web Page Verification (only works with Standard Certificate SKU)
4. Click Refresh to update the certificate status after verification is completed. It might take few minutes for
verification to complete.
TIP
Verify in a terminal using curl -G http://<domain>/.well-known/pki-validation/starfield.html the response should
contain the <verification-token> .
TIP
You need to create a TXT record on @.<domain> with value <verification-token> .
Assign Certificate to App Service App
If you selected IP based SSL and your custom domain is configured using an A record, you must perform the
following additional steps:
After you have configured an IP based SSL binding, a dedicated IP address is assigned to your app. You can find
this IP address on the Custom domain page under settings of your app, right above the Hostnames section. It is
listed as External IP Address
This IP address is different than the virtual IP address used previously to configure the A record for your domain. If
you are configured to use SNI based SSL, or are not configured to use SSL, no address is listed for this entry.
Using the tools provided by your domain name registrar, modify the A record for your custom domain name to
point to the IP address from the previous step.
Rekeying your certificate rolls the certificate with a new certificate issued from the certificate authority.
Why is my SSL certificate not auto-renewed?
If your SSL certificate is configured for auto-renewal, but it is not automatically renewed, you may have a pending
domain verification. Note the following:
GoDaddy, which generates App Service certificates, requires domain verification once every three years. The
domain administrator receives an email once every three years to verify the domain. Failure to check the email
or verify your domain prevents the App Service certificate from being automatically renewed.
All App Service certificates issued prior to March 31 2017 require reverification of domain at the time of next
renewal (even if the auto-renewal is enabled for the certificate). This is a result of change in GoDaddy policy.
Check your email and complete this one-time domain verification to continue the auto-renewal of the App
Service certificate.
More resources
Use an SSL certificate in your application code in Azure App Service
FAQ : App Service Certificates
Configure your App Service app to use Azure Active
Directory login
11/22/2017 • 5 min to read • Edit Online
This article shows you how to configure Azure App Services to use Azure Active Directory as an authentication
provider.
Related Content
App Service Authentication / Authorization overview
Add authentication to your Mobile App: iOS, Android, Windows Universal, Xamarin.Android, Xamarin.iOS,
Xamarin.Forms, Cordova
Learn how to add App Service authenication to your mobile app.
How to configure your App Service application to
use Facebook login
9/19/2017 • 2 min to read • Edit Online
This topic shows you how to configure Azure App Service to use Facebook as an authentication provider.
To complete the procedure in this topic, you must have a Facebook account that has a verified email address and a
mobile phone number. To create a new Facebook account, go to facebook.com.
NOTE
Your redirect URI is the URL of your application appended with the path, /.auth/login/facebook/callback. For
example, https://contoso.azurewebsites.net/.auth/login/facebook/callback . Make sure that you are using
the HTTPS scheme.
7. In the left-hand navigation, click Settings. On the App Secret field, click Show, provide your password if
requested, then make a note of the values of App ID and App Secret. You use these later to configure your
application in Azure.
IMPORTANT
The app secret is an important security credential. Do not share this secret with anyone or distribute it within a client
application.
8. The Facebook account which was used to register the application is an administrator of the app. At this point,
only administrators can sign into this application. To authenticate other Facebook accounts, click App Review
and enable Make public to enable general public access using Facebook authentication.
By default, App Service provides authentication but does not restrict authorized access to your site content
and APIs. You must authorize users in your app code.
3. (Optional) To restrict access to your site to only users authenticated by Facebook, set Action to take when
request is not authenticated to Facebook. This requires that all requests be authenticated, and all
unauthenticated requests are redirected to Facebook for authentication.
4. When done configuring authentication, click Save.
You are now ready to use Facebook for authentication in your app.
Related Content
App Service Authentication / Authorization overview
Add authentication to your Mobile App: iOS, Android, Windows Universal, Xamarin.Android, Xamarin.iOS,
Xamarin.Forms, Cordova
Learn how to add App Service authenication to your mobile app.
How to configure your App Service application to
use Google login
9/19/2017 • 2 min to read • Edit Online
This topic shows you how to configure Azure App Service to use Google as an authentication provider.
To complete the procedure in this topic, you must have a Google account that has a verified email address. To
create a new Google account, go to accounts.google.com.
IMPORTANT
The client secret is an important security credential. Do not share this secret with anyone or distribute it within a
client application.
Related Content
App Service Authentication / Authorization overview
Add authentication to your Mobile App: iOS, Android, Windows Universal, Xamarin.Android, Xamarin.iOS,
Xamarin.Forms, Cordova
Learn how to add App Service authenication to your mobile app.
How to configure your App Service application to
use Microsoft Account login
9/19/2017 • 1 min to read • Edit Online
This topic shows you how to configure Azure App Service to use Microsoft Account as an authentication provider.
NOTE
Your redirect URI is the URL of your application appended with the path, /.auth/login/microsoftaccount/callback.
For example, https://contoso.azurewebsites.net/.auth/login/microsoftaccount/callback .
Make sure that you are using the HTTPS scheme.
7. Under "Application Secrets," click Generate New Password. Make note of the value that appears. Once
you leave the page, it will not be displayed again.
IMPORTANT
The password is an important security credential. Do not share the password with anyone or distribute it within a
client application.
Related content
App Service Authentication / Authorization overview
Add authentication to your Mobile App: iOS, Android, Windows Universal, Xamarin.Android, Xamarin.iOS,
Xamarin.Forms, Cordova
Learn how to add App Service authenication to your mobile app.
How to configure your App Service application to
use Twitter login
9/19/2017 • 2 min to read • Edit Online
This topic shows you how to configure Azure App Service to use Twitter as an authentication provider.
To complete the procedure in this topic, you must have a Twitter account that has a verified email address and
phone number. To create a new Twitter account, go to twitter.com.
NOTE
The consumer secret is an important security credential. Do not share this secret with anyone or distribute it with
your app.
Related Content
App Service Authentication / Authorization overview
Add authentication to your Mobile App: iOS, Android, Windows Universal, Xamarin.Android, Xamarin.iOS,
Xamarin.Forms, Cordova
Learn how to add App Service authenication to your mobile app.
How To Configure TLS Mutual Authentication for
Web App
9/19/2017 • 4 min to read • Edit Online
Overview
You can restrict access to your Azure web app by enabling different types of authentication for it. One way to do so
is to authenticate using a client certificate when the request is over TLS/SSL. This mechanism is called TLS mutual
authentication or client certificate authentication and this article will detail how to setup your web app to use client
certificate authentication.
Note: If you access your site over HTTP and not HTTPS, you will not receive any client certificate. So if your
application requires client certificates you should not allow requests to your application over HTTP.
NOTE
Although this article refers to web apps, it also applies to API apps and mobile apps.
replacing everything in {} with information for your web app and creating a file called enableclientcert.json with the
following JSON content:
{
"location": "My Web App Location",
"properties": {
"clientCertEnabled": true
}
}
Make sure to change the value of "location" to wherever your web app is located e.g. North Central US or West US
etc.
You can also use https://resources.azure.com to flip the clientCertEnabled property to true .
Note: If you run ARMClient from Powershell, you will need to escape the @ symbol for the JSON file with a
back tick `.
Accessing the Client Certificate From Your Web App
If you are using ASP.NET and configure your app to use client certificate authentication, the certificate will be
available through the HttpRequest.ClientCertificate property. For other application stacks, the client cert will be
available in your app through a base64 encoded value in the "X-ARR-ClientCert" request header. Your application
can create a certificate from this value and then use it for authentication and authorization purposes in your
application.
using System;
using System.Collections.Specialized;
using System.Security.Cryptography.X509Certificates;
using System.Web;
namespace ClientCertificateUsageSample
{
public partial class cert : System.Web.UI.Page
{
public string certHeader = "";
public string errorString = "";
private X509Certificate2 certificate = null;
public string certThumbprint = "";
public string certSubject = "";
public string certIssuer = "";
public string certSignatureAlg = "";
public string certIssueDate = "";
public string certExpiryDate = "";
public bool isValidCert = false;
//
// Read the certificate from the header into an X509Certificate2 object
// Display properties of the certificate on the page
//
protected void Page_Load(object sender, EventArgs e)
{
NameValueCollection headers = base.Request.Headers;
certHeader = headers["X-ARR-ClientCert"];
if (!String.IsNullOrEmpty(certHeader))
{
try
{
byte[] clientCertBytes = Convert.FromBase64String(certHeader);
certificate = new X509Certificate2(clientCertBytes);
certSubject = certificate.Subject;
certIssuer = certificate.Issuer;
certThumbprint = certificate.Thumbprint;
certSignatureAlg = certificate.SignatureAlgorithm.FriendlyName;
certIssueDate = certificate.NotBefore.ToShortDateString() + " " +
certificate.NotBefore.ToShortTimeString();
certExpiryDate = certificate.NotAfter.ToShortDateString() + " " +
certificate.NotAfter.ToShortTimeString();
}
catch (Exception ex)
{
errorString = ex.ToString();
}
finally
{
isValidCert = IsValidClientCertificate();
if (!isValidCert) Response.StatusCode = 403;
if (!isValidCert) Response.StatusCode = 403;
else Response.StatusCode = 200;
}
}
else
{
certHeader = "";
}
}
//
// This is a SAMPLE verification routine. Depending on your application logic and security
requirements,
// you should modify this method
//
private bool IsValidClientCertificate()
{
// In this example we will only accept the certificate as a valid certificate if all the
conditions below are met:
// 1. The certificate is not expired and is active for the current time on server.
// 2. The subject name of the certificate has the common name nildevecc
// 3. The issuer name of the certificate has the common name nildevecc and organization name
Microsoft Corp
// 4. The thumbprint of the certificate is 30757A2E831977D8BD9C8496E4C99AB26CB9622B
//
// This example does NOT test that this certificate is chained to a Trusted Root Authority (or
revoked) on the server
// and it allows for self signed certificates
//
// If you also want to test if the certificate chains to a Trusted Root Authority you can
uncomment the code below
//
//X509Chain certChain = new X509Chain();
//certChain.Build(certificate);
//bool isValidCertChain = true;
//foreach (X509ChainElement chElement in certChain.ChainElements)
//{
// if (!chElement.Certificate.Verify())
// {
// isValidCertChain = false;
// break;
// }
//}
//if (!isValidCertChain) return false;
return true;
}
}
}
Scale up an app in Azure
9/25/2017 • 3 min to read • Edit Online
NOTE
The new PremiumV2 tier gives you faster CPUs, SSD storage, and double the memory-to-core ratio than the existing
pricing tiers. To scale up to PremiumV2 tier, see Configure PremiumV2 tier for App Service.
This article shows you how to scale your app in Azure App Service. There are two workflows for scaling, scale up
and scale out, and this article explains the scale up workflow.
Scale up: Get more CPU, memory, disk space, and extra features like dedicated virtual machines (VMs), custom
domains and certificates, staging slots, autoscaling, and more. You scale up by changing the pricing tier of the
App Service plan that your app belongs to.
Scale out: Increase the number of VM instances that run your app. You can scale out to as many as 20
instances, depending on your pricing tier. App Service Environments in Isolated tier further increases your
scale-out count to 100 instances. For more information about scaling out, see Scale instance count manually
or automatically. There you find out how to use autoscaling, which is to scale instance count automatically
based on predefined rules and schedules.
The scale settings take only seconds to apply and affect all apps in your App Service plan. They do not require
you to change your code or redeploy your application.
For information about the pricing and features of individual App Service plans, see App Service Pricing Details.
NOTE
Before you switch an App Service plan from the Free tier, you must first remove the spending limits in place for your Azure
subscription. To view or change options for your Microsoft Azure App Service subscription, see Microsoft Azure
Subscriptions.
2. In the Summary part of the Resource group page, click a resource that you want to scale. The following
screenshot shows a SQL Database resource and an Azure Storage resource.
3. For a SQL Database resource, click Settings > Pricing tier to scale the pricing tier.
You can also turn on geo-replication for your SQL Database instance.
For an Azure Storage resource, click Settings > Configuration to scale up your storage options.
Compare pricing tiers
For detailed information, such as VM sizes for each pricing tier, see App Service Pricing Details. For a table of
service limits, quotas, and constraints, and supported features in each tier, see App Service limits.
NOTE
If you want to get started with Azure App Service before you sign up for an Azure account, go to Try App Service where
you can immediately create a short-lived starter web app in App Service. No credit cards are required and there are no
commitments.
Next steps
For information about pricing, support, and SLA, visit the following links:
Data Transfers Pricing Details
Microsoft Azure Support Plans
Service Level Agreements
SQL Database Pricing Details
Virtual Machine and Cloud Service Sizes for Microsoft Azure
For information about Azure App Service best practices, including building a scalable and resilient
architecture, see Best Practices: Azure App Service Web Apps.
For videos about scaling App Service apps, see the following resources:
When to Scale Azure Websites - with Stefan Schackow
Auto Scaling Azure Websites, CPU or Scheduled - with Stefan Schackow
How Azure Websites Scale - with Stefan Schackow
Scale instance count manually or automatically
12/13/2017 • 6 min to read • Edit Online
In the Azure Portal, you can manually set the instance count of your service, or, you can set parameters to have it
automatically scale based on demand. This is typically referred to as Scale out or Scale in.
Before scaling based on instance count, you should consider that scaling is affected by Pricing tier in addition to
instance count. Different pricing tiers can have different numbers cores and memory, and so they will have better
performance for the same number of instances (which is Scale up or Scale down). This article specifically covers
Scale in and out.
You can scale in the portal, and you can also use the REST API or .NET SDK to adjust scale manually or
automatically.
Scaling manually
1. In the Azure Portal, click Browse, then navigate to the resource you want to scale, such as an App Service plan.
2. Click Settings > Scale out (App Service plan).
3. At the top of the Scale blade you can see a history of autoscale actions of the service.
NOTE
Only actions that are performed by autoscale will show up in this chart. If you manually adjust the instance count, the
change will not be reflected in this chart.
Autoscale will never take your service below or above the boundaries that you set, no matter your load.
2. Second, you choose the target range for the metric. For example, if you chose CPU percentage, you can set a
target for the average CPU across all of the instances in your service. A scale out will happen when the average
CPU exceeds the maximum you define, likewise, a scale in will happen whenever the average CPU drops below
the minimum.
3. Click the Save command. Autoscale will check every few minutes to make sure that you are in the instance
range and target for your metric. When your service receives additional traffic, you will get more instances
without doing anything.
Scale based on other metrics
You can scale based on metrics other than the presets that appear in the Scale by dropdown, and can even have a
complex set of scale out and scale in rules.
Adding or changing a rule
1. Choose the schedule and performance rules in the Scale by dropdown:
2. If you previously had autoscale, on you'll see a view of the exact rules that you had.
3. To scale based on another metric click the Add Rule row. You can also click one of the existing rows to change
from the metric you previously had to the metric you want to scale by.
4. Now you need to select which metric you want to scale by. When choosing a metric there are a couple
things to consider:
The resource the metric comes from. Typically, this will be the same as the resource you are scaling.
However, if you want to scale by the depth of a Storage queue, the resource is the queue that you want to
scale by.
The metric name itself.
The time aggregation of the metric. This is how the data is combine over the duration.
5. After choosing your metric you choose the threshold for the metric, and the operator. For example, you could
say Greater than 80%.
6. Then choose the action that you want to take. There are a couple different type of actions:
Increase or decrease by - this will add or remove the Value number of instances you define
Increase or decrease percent - this will change the instance count by a percent. For example, you could
put 25 in the Value field, and if you currently had 8 instances, 2 would be added.
Increase or decrease to - this will set the instance count to the Value you define.
7. Finally, you can choose cool down - how long this rule should wait after the previous scale action to scale again.
8. After configuring your rule hit OK.
9. Once you have configured all of the rules you want, be sure to hit the Save command.
Scaling with multiple steps
The examples above are pretty basic. However, if you want to be more agressive about scaling up (or down), you
can even add multiple scale rules for the same metric. For example, you can define two scale rules on CPU
percentage:
1. Scale out by 1 instance if CPU percentage is above 60%
2. Scale out by 3 instances if CPU percentage is above 85%
With this additional rule, if your load exceeds 85% before a scale action, you will get two additional instances
instead of one.
6. Name your new, second, profile, for example you could call it Off work.
7. Then select recurrence again, and choose the instance count range you want during this time.
8. As with the Default profile, choose the Days you want this profile to apply to, and the Start time during the
day.
NOTE
Autoscale will use the Daylight savings rules for whichever Time zone you select. However, during Daylight savings
time the UTC offset will show the base Time zone offset, not the Daylight savings UTC offset.
9. Click OK.
10. Now, you will need to add whatever rules you want to apply during your second profile. Click Add Rule, and
then you could construct the same rule you have during the Default profile.
11. Be sure to create both a rule for scale out and scale in, or else during the profile the instance count will only
grow (or decrease).
12. Finally, click Save.
Next steps
Monitor service metrics to make sure your service is available and responsive.
Enable monitoring and diagnostics to collect detailed high-frequency metrics on your service.
Receive alert notifications whenever operational events happen or metrics cross a threshold.
Monitor application performance if you want to understand exactly how your code is performing in the cloud.
View events and activity log to learn everything that has happened in your service.
Monitor availability and responsiveness of any web page with Application Insights so you can find out if your
page is down.
How to: Monitor Apps in Azure App Service
1/2/2018 • 5 min to read • Edit Online
App Service provides built in monitoring functionality in the Azure portal. The Azure portal includes the ability to
review quotas and metrics for an app as well as the App Service plan, setting up alerts and even scaling
automatically based on these metrics.
NOTE
Although this article refers to web apps, it also applies to API apps and mobile apps.
NOTE
App Service Free and Shared (preview) hosting plans are base tiers that run on the same Azure VM as other App Service
apps. Some apps may belong to other customers. These tiers are intended to be used only for development and testing
purposes.
If the application is hosted in a Free or Shared plan, then the limits on the resources the app can use are defined
by Quotas.
If the application is hosted in a Basic, Standard or Premium plan, then the limits on the resources they can use
are set by the size (Small, Medium, Large) and instance count (1, 2, 3, ...) of the App Service plan.
Quotas for Free or Shared apps are:
CPU(Short)
Amount of CPU allowed for this application in a 5-minute interval. This quota resets every five minutes.
CPU(Day)
Total amount of CPU allowed for this application in a day. This quota resets every 24 hours at midnight
UTC.
Memory
Total amount of memory allowed for this application.
Bandwidth
Total amount of outgoing bandwidth allowed for this application in a day. This quota resets every 24
hours at midnight UTC.
Filesystem
Total amount of storage allowed.
The only quota applicable to apps hosted on Basic, Standard, and Premium plans is Filesystem.
More information about the specific quotas, limits, and features available to the different App Service SKUs can be
found here: Azure Subscription Service Limits
Quota Enforcement
If an application exceeds the CPU (short), CPU (Day), or bandwidth quota then the application is stopped until
the quota resets. During this time, all incoming requests result in an HTTP 403.
NOTE
App Service plan metrics are only available for plans in Basic, Standard, and Premium tiers.
CPU Percentage
The average CPU used across all instances of the plan.
Memory Percentage
The average memory used across all instances of the plan.
Data In
The average incoming bandwidth used across all instances of the plan.
Data Out
The average outgoing bandwidth used across all instances of the plan.
Disk Queue Length
The average number of both read and write requests that were queued on storage. A high disk queue
length is an indication of an application that might be slowing down due to excessive disk I/O.
Http Queue Length
The average number of HTTP requests that had to sit on the queue before being fulfilled. A high or
increasing HTTP Queue length is a symptom of a plan under heavy load.
CPU time vs CPU percentage
There are two metrics that reflect CPU usage. CPU time and CPU percentage
CPU Time is useful for apps hosted in Free or Shared plans since one of their quotas is defined in CPU minutes
used by the app.
CPU percentage is useful for apps hosted in basic, standard, and premium plans since they can be scaled out.
CPU percentage is a good indication of the overall usage across all instances.
Quotas can be found under Settings>Quotas. The UX allows you to review: (1) the quotas name, (2) its reset
interval, (3) its current limit, and (4) current value.
Metrics can be access directly from the resource page. You can also customize the chart by: (1) click on it, and
select (2) edit chart. From here you can change the (3) time range, (4) chart type, and (5) metrics to display.
You can learn more about metrics here: Monitor service metrics.
NOTE
If you want to get started with Azure App Service before signing up for an Azure account, go to Try App Service, where you
can immediately create a short-lived starter web app in App Service. No credit cards required; no commitments.
Enable diagnostics logging for web apps in Azure
App Service
12/6/2017 • 12 min to read • Edit Online
Overview
Azure provides built-in diagnostics to assist with debugging an App Service web app. In this article, you learn how
to enable diagnostic logging and add instrumentation to your application, as well as how to access the information
logged by Azure.
This article uses the Azure portal, Azure PowerShell, and the Azure Command-Line Interface (Azure CLI) to work
with diagnostic logs. For information on working with diagnostic logs using Visual Studio, see Troubleshooting
Azure in Visual Studio.
NOTE
Although this article refers to web apps, it also applies to API apps and mobile apps.
At runtime, you can retrieve these logs to help with troubleshooting. For more information, see Troubleshooting
Azure web apps in Visual Studio.
App Service web apps also log deployment information when you publish content to a web app. It happens
automatically and there are no configuration settings for deployment logging. Deployment logging allows you to
determine why a deployment failed. For example, if you are using a custom deployment script, you might use
deployment logging to determine why the script is failing.
How to enable diagnostics
To enable diagnostics in the Azure portal, go to the page for your web app and click Settings > Diagnostics logs.
When you enable application diagnostics, you also choose the Level. This setting allows you to filter the
information captured to informational, warning, or error information. Setting it to verbose logs all information
produced by the application.
NOTE
Unlike changing the web.config file, enabling Application diagnostics or changing diagnostic log levels does not recycle the
app domain that the application runs within.
For Application logging, you can turn on the file system option temporarily for debugging purposes. This option
turns off automatically in 12 hours. You can also turn on the blob storage option to select a blob container to write
logs to.
For Web server logging, you can select storage or file system. Selecting storage allows you to select a storage
account, and then a blob container that the logs are written to.
If you store logs on the file system, the files can be accessed by FTP, or downloaded as a Zip archive by using the
Azure PowerShell or Azure Command-Line Interface (Azure CLI).
By default, logs are not automatically deleted (with the exception of Application Logging (Filesystem)). To
automatically delete logs, set the Retention Period (Days) field.
NOTE
If you regenerate your storage account's access keys, you must reset the respective logging configuration to use the updated
keys. To do this:
1. In the Configure tab, set the respective logging feature to Off. Save your setting.
2. Enable logging to the storage account blob or table again. Save your setting.
Any combination of file system, table storage, or blob storage can be enabled at the same time, and have individual
log level configurations. For example, you may wish to log errors and warnings to blob storage as a long-term
logging solution, while enabling file system logging with a level of verbose.
While all three storage locations provide the same basic information for logged events, table storage and blob
storage log additional information such as the instance ID, thread ID, and a more granular timestamp (tick format)
than logging to file system.
NOTE
Information stored in table storage or blob storage can only be accessed using a storage client or an application that can
directly work with these storage systems. For example, Visual Studio 2013 contains a Storage Explorer that can be used to
explore table or blob storage, and HDInsight can access data stored in blob storage. You can also write an application that
accesses Azure Storage by using one of the Azure SDKs.
NOTE
Diagnostics can also be enabled from Azure PowerShell using the Set-AzureWebsite cmdlet. If you have not installed Azure
PowerShell, or have not configured it to use your Azure Subscription, see How to Use Azure PowerShell.
This command saves the logs for the web app specified by the -Name parameter to a file named logs.zip in the
current directory.
NOTE
If you have not installed Azure PowerShell, or have not configured it to use your Azure Subscription, see How to Use Azure
PowerShell.
This command saves the logs for the web app named 'webappname' to a file named diagnostics.zip in the current
directory.
NOTE
If you have not installed the Azure Command-Line Interface (Azure CLI), or have not configured it to use your Azure
Subscription, see How to Use Azure CLI.
NOTE
Some types of logging buffer write to the log file, which can result in out of order events in the stream. For example, an
application log entry that occurs when a user visits a page may be displayed in the stream before the corresponding HTTP
log entry for the page request.
NOTE
Log streaming also streams information written to any text file stored in the D:\home\LogFiles\ folder.
This command connects to the web app specified by the -Name parameter and begin streaming information to the
PowerShell window as log events occur on the web app. Any information written to files ending in .txt, .log, or .htm
that are stored in the /LogFiles directory (d:/home/logfiles) is streamed to the local console.
To filter specific events, such as errors, use the -Message parameter. For example:
To filter specific log types, such as HTTP, use the -Path parameter. For example:
NOTE
If you have not installed Azure PowerShell, or have not configured it to use your Azure Subscription, see How to Use Azure
PowerShell.
This command connects to the web app named 'webappname' and begin streaming information to the window as
log events occur on the web app. Any information written to files ending in .txt, .log, or .htm that are stored in the
/LogFiles directory (d:/home/logfiles) is streamed to the local console.
To filter specific events, such as errors, use the --Filter parameter. For example:
To filter specific log types, such as HTTP, use the --Path parameter. For example:
NOTE
If you have not installed the Azure Command-Line Interface, or have not configured it to use your Azure Subscription, see
How to Use Azure Command-Line Interface.
For example, an error event would appear similar to the following sample:
Logging to the file system provides the most basic information of the three available methods, providing only the
time, process ID, event level, and message.
Table storage
When logging to table storage, additional properties are used to facilitate searching the data stored in the table as
well as more granular information on the event. The following properties (columns) are used for each entity (row)
stored in the table.
EventTickCount The date and time that the event occurred, in Tick format
(greater precision)
PROPERTY NAME VALUE/FORMAT
Pid Process ID
Blob storage
When logging to blob storage, data is stored in comma-separated values (CSV) format. Similar to table storage,
additional fields are logged to provide more granular information about the event. The following properties are
used for each row in the CSV:
EventTickCount The date and time that the event occurred, in Tick format
(greater precision)
Pid Process ID
The data stored in a blob would look similar to the following example:
date,level,applicationName,instanceId,eventTickCount,eventId,pid,tid,message
2014-01-30T16:36:52,Error,mywebapp,6ee38a,635266966128818593,0,3096,9,An error occurred
NOTE
The first line of the log contains the column headers as represented in this example.
NOTE
The logs produced by Azure web apps do not support the s-computername, s-ip, or cs-version fields.
Next steps
How to Monitor Web Apps
Troubleshooting Azure web apps in Visual Studio
Analyze web app Logs in HDInsight
NOTE
If you want to get started with Azure App Service before signing up for an Azure account, go to Try App Service, where you
can immediately create a short-lived starter web app in App Service. No credit cards required; no commitments.
Back up your app in Azure
11/20/2017 • 5 min to read • Edit Online
The Backup and Restore feature in Azure App Service lets you easily create app backups manually or on a schedule.
You can restore the app to a snapshot of a previous state by overwriting the existing app or restoring to another
app.
For information on restoring an app from backup, see Restore an app in Azure.
NOTE
Each backup is a complete offline copy of your app, not an incremental update.
3. In the Backup Configuration page, click Storage: Not configured to configure a storage account.
4. Choose your backup destination by selecting a Storage Account and Container. The storage account must
belong to the same subscription as the app you want to back up. If you wish, you can create a new storage
account or a new container in the respective pages. When you're done, click Select.
5. In the Backup Configuration page that is still left open, you can configure Backup Database, then select
the databases you want to include in the backups (SQL database or MySQL), then click OK.
NOTE
For a database to appear in this list, its connection string must exist in the Connection strings section of the
Application settings page for your app.
2. Backup schedule options will show up, set Scheduled Backup to On, then configure the backup schedule
as desired and click OK.
Identify the folders that you want to exclude from your backups. For example, you want to filter out the highlighted
folder and files.
Create a file called _backup.filter and put the preceding list in the file, but remove D:\home . List one directory or
file per line. So the content of the file should be:
\site\wwwroot\Images\brand.png
\site\wwwroot\Images\2014
\site\wwwroot\Images\2013
Upload _backup.filter file to the D:\home\site\wwwroot\ directory of your site using ftp or any other method. If
you wish, you can create the file directly using Kudu DebugConsole and insert the content there.
Run backups the same way you would normally do it, manually or automatically. Now, any files and folders that
are specified in _backup.filter is excluded from the future backups scheduled or manually initiated.
NOTE
You restore partial backups of your site the same way you would restore a regular backup. The restore process does the
right thing.
When a full backup is restored, all content on the site is replaced with whatever is in the backup. If a file is on the site, but
not in the backup it gets deleted. But when a partial backup is restored, any content that is located in one of the blacklisted
directories, or any blacklisted file, is left as is.
WARNING
Altering any of the files in your websitebackups container can cause the backup to become invalid and therefore non-
restorable.
Next Steps
For information on restoring an app from a backup, see Restore an app in Azure.
Restore an app in Azure
11/20/2017 • 2 min to read • Edit Online
This article shows you how to restore an app in Azure App Service that you have previously backed up (see Back
up your app in Azure). You can restore your app with its linked databases on-demand to a previous state, or create
a new app based on one of your original app's backups. Azure App Service supports the following databases for
backup and restore:
SQL Database
Azure Database for MySQL (Preview)
Azure Database for PostgreSQL (Preview)
MySQL in-app
Restoring from backups is available to apps running in Standard and Premium tier. For information about
scaling up your app, see Scale up an app in Azure. Premium tier allows a greater number of daily backups to be
performed than Standard tier.
The App backup option shows you all the existing backups of the current app, and you can easily select
one. The Storage option lets you select any backup ZIP file from any existing Azure Storage account and
container in your subscription. If you're trying to restore a backup of another app, use the Storage option.
3. Then, specify the destination for the app restore in Restore destination.
WARNING
If you choose Overwrite, all existing data in your current app is erased and overwritten. Before you click OK, make
sure that it is exactly what you want to do.
You can select Existing App to restore the app backup to another app in the same resoure group. Before
you use this option, you should have already created another app in your resource group with mirroring
database configuration to the one defined in the app backup. You can also Create a New app to restore
your content to.
4. Click OK.
With the release of Microsoft Azure PowerShell version 1.1.0 a new option has been added to New-
AzureRMWebApp that would give the user the ability to clone an existing Web App to a newly created app in a
different region or in the same region. This will enable customers to deploy a number of apps across different
regions quickly and easily.
App cloning is currently only supported for premium tier app service plans. The new feature uses the same
limitations as Web Apps Backup feature, see Back up a web app in Azure App Service.
NOTE
Although this article refers to web apps, it also applies to API apps and mobile apps.
To create a new App Service Plan, we can use New-AzureRmAppServicePlan command as in the following example
Using the New-AzureRmWebApp command, we can create the new web app in the North Central US region, and
tie it to an existing premium tier App Service Plan, moreover we can use the same resource group as the source
web app, or define a new resource group, the following demonstrates that:
To clone an existing web app including all associated deployment slots, the user will need to use the
IncludeSourceWebAppSlots parameter, the following PowerShell command demonstrates the use of that
parameter with the New-AzureRmWebApp command:
To clone an existing web app within the same region, the user will need to create a new resource group and a new
app service plan in the same region, and then using the following PowerShell command to clone the web app
$destapp = New-AzureRmWebApp -ResourceGroupName NewAzureResourceGroup -Name dest-webapp -Location "South
Central US" -AppServicePlan NewAppServicePlan -SourceWebApp $srcap
Knowing the ASE's name, and the resource group name that the ASE belongs to, the user can use the New-
AzureRmWebApp command to create the new web app in the existing ASE, the following demonstrates that:
The Location parameter is required due to legacy reason, but in the case of creating an app in an ASE it will be
ignored.
The following demonstrates creating a clone of the source web app to a new web app:
After having the traffic manger id, the following demonstrates creating a clone of the source web app to a new web
app while adding them to an existing Traffic Manager profile:
$destapp = New-AzureRmWebApp -ResourceGroupName <Resource group name> -Name dest-webapp -Location "South
Central US" -AppServicePlan DestinationAppServicePlan -SourceWebApp $srcapp -TrafficManagerProfileId
$TMProfileID
Current Restrictions
This feature is currently in preview, we are working to add new capabilities over time, the following list are the
known restrictions on the current version of app cloning:
Auto scale settings are not cloned
Backup schedule settings are not cloned
VNET settings are not cloned
App Insights are not automatically set up on the destination web app
Easy Auth settings are not cloned
Kudu Extension are not cloned
TiP rules are not cloned
Database content are not cloned
Outbound IP Addresses will change if cloning to a different scale unit
References
Web App Cloning
Back up a web app in Azure App Service
Azure Resource Manager support for Azure Traffic Manager Preview
Introduction to App Service Environment
Using Azure PowerShell with Azure Resource Manager
Move an Azure Web App to another resource group
10/19/2017 • 1 min to read • Edit Online
You can move a Web App and/or its related resources to another resource group in the same subscription, or to a
resource group in a different subscription. This is done as part of standard resource management in Azure. For
more information, see Move Azure resources to new subscription or resource group.
This document lists some of the most common Microsoft Azure limits, which are also sometimes called quotas. This
document doesn't currently cover all Azure services. Over time, the list will be expanded and updated to cover more
of the platform.
Please visit Azure Pricing Overview to learn more about Azure pricing. There, you can estimate your costs using the
Pricing Calculator or by visiting the pricing details page for a service (for example, Windows VMs). For tips to help
manage your costs, see Prevent unexpected costs with Azure billing and cost management.
NOTE
If you want to raise the limit or quota above the Default Limit, open an online customer support request at no charge. The
limits can't be raised above the Maximum Limit value shown in the following tables. If there is no Maximum Limit column,
then the resource doesn't have adjustable limits.
Free Trial subscriptions are not eligible for limit or quota increases. If you have a Free Trial subscription, you can upgrade to a
Pay-As-You-Go subscription. For more information, see Upgrade Azure Free Trial to Pay-As-You-Go and Free Trial
subscription FAQ.
NOTE
It is important to emphasize that quotas for resources in Azure Resource Groups are per-region accessible by your
subscription, and are not per-subscription, as the service management quotas are. Let's use vCPU quotas as an example. If
you need to request a quota increase with support for vCPUs, you need to decide how many vCPUs you want to use in which
regions, and then make a specific request for Azure Resource Group vCPU quotas for the amounts and regions that you
want. Therefore, if you need to use 30 vCPUs in West Europe to run your application there, you should specifically request 30
vCPUs in West Europe. But you will not have a vCPU quota increase in any other region -- only West Europe will have the
30-vCPU quota.
As a result, you may find it useful to consider deciding what your Azure Resource Group quotas need to be for your workload
in any one region, and request that amount in each region into which you are considering deployment. See troubleshooting
deployment issues for more help discovering your current quotas for specific regions.
Service-specific limits
Active Directory
API Management
App Service
Application Gateway
Application Insights
Automation
Azure Cosmos DB
Azure Event Grid
Azure Redis Cache
Backup
Batch
BizTalk Services
CDN
Cloud Services
Container Instances
Container Registry
Data Factory
Data Lake Analytics
Data Lake Store
Database Migration Service
DNS
Event Hubs
IoT Hub
IoT Hub Device Provisioning Service
Key Vault
Log Analytics / Operational Insights
Media Services
Mobile Engagement
Mobile Services
Monitor
Multi-Factor Authentication
Networking
Network Watcher
Notification Hub Service
Resource Group
Scheduler
Search
Service Bus
Site Recovery
SQL Database
SQL Data Warehouse
Storage
StorSimple System
Stream Analytics
Subscription
Traffic Manager
Virtual Machines
Virtual Machine Scale Sets
Subscription limits
Subscription limits
1Extra Small instances count as one core towards the core limit despite using a partial core.
2This includes both Standard and Premium storage accounts. If you require more than 200 storage accounts, make
a request through Azure Support. The Azure Storage team will review your business case and may approve up to
250 storage accounts.
Subscription limits - Azure Resource Manager
The following limits apply when using the Azure Resource Manager and Azure Resource Groups. Limits that have
not changed with the Azure Resource Manager are not listed below. Please refer to the previous table for those
limits.
For information about handling limits on Resource Manager requests, see Throttling Resource Manager requests.
VM per series (Dv2, F, etc.) cores per 201 per Region Contact support
subscription
Availability Sets per subscription 2,000 per Region 2,000 per Region
Resource Manager API Reads 15,000 per hour 15,000 per hour
Resource Manager API Writes 1,200 per hour 1,200 per hour
1Default limits vary by offer Category Type, such as Free Trial, Pay-As-You-Go, and series, such as Dv2, F, G, etc.
2This includes both Standard and Premium storage accounts. If you require more than 200 storage accounts, make
a request through Azure Support. The Azure Storage team will review your business case and may approve up to
250 storage accounts.
3You can apply an unlimited number of tags per subscription. The number of tags per resource or resource group is
limited to 15. Resource Manager only returns a list of unique tag name and values in the subscription when the
number of tags is 10,000 or less. However, you can still find a resource by tag when the number exceeds 10,000.
4These features are no longer required with Azure Resource Groups and the Azure Resource Manager.
NOTE
It is important to emphasize that virtual machine cores have a regional total limit as well as a regional per size series (Dv2, F,
etc.) limit that are separately enforced. For example, consider a subscription with a US East total VM core limit of 30, an A
series core limit of 30, and a D series core limit of 30. This subscription would be allowed to deploy 30 A1 VMs, or 30 D1
VMs, or a combination of the two not to exceed a total of 30 cores (for example, 10 A1 VMs and 20 D1 VMs).
Resources per resource group (per 800 Varies per resource type
resource type)
Template limits
Outputs 64 64
Template size 1 MB 1 MB
You can exceed some template limits by using a nested template. For more information, see Using linked templates
when deploying Azure resources. To reduce the number of parameters, variables, or outputs, you can combine
several values into an object. For more information, see Objects as parameters.
If you reach the limit of 800 deployments per resource group, delete deployments from the history that are no
longer needed. You can delete entries from the history with az group deployment delete for Azure CLI, or Remove-
AzureRmResourceGroupDeployment in PowerShell. Deleting an entry from the deployment history does not affect
the deploy resources.
Virtual Machines limits
Virtual Machine limits
1Virtual machines created in Service Management (instead of Resource Manager) are automatically stored in a
cloud service. You can add more virtual machines to that cloud service for load balancing and availability. See How
to Connect Virtual Machines with a Virtual Network or Cloud Service.
2Input endpoints allow communications to a virtual machine from outside the virtual machine's cloud service.
Virtual machines in the same cloud service or virtual network can automatically communicate with each other. See
How to Set Up Endpoints to a Virtual Machine.
Virtual Machines limits - Azure Resource Manager
The following limits apply when using the Azure Resource Manager and Azure Resource Groups. Limits that have
not changed with the Azure Resource Manager are not listed below. Please refer to the previous table for those
limits.
1With Azure Resource Manager, certificates are stored in the Azure Key Vault. Although the number of certificates is
unlimited for a subscription, there is still a 1 MB limit of certificates per deployment (which consists of either a
single VM or an availability set).
Virtual Machine Scale Sets limits
RESOURCE DEFAULT LIMIT MAXIMUM LIMIT
Ports per IP 5
Webhooks 2 10 100
1 ReadOps, WriteOps, and Bandwidth are minimum estimates. ACR strives to improve performance as usage
requires.
2 docker pull translates to multiple read operations based on the number of layers in the image, plus the manifest
retrieval.
3 docker push translates to multiple write operations, based on the number of layers that must be pushed. A
docker push includes ReadOps to retrieve a manifest for an existing image.
Networking limits
ExpressRoute Limits
The following limits apply to ExpressRoute resources per subscription.
Number of virtual network links allowed per ExpressRoute see table below
circuit
50 Mbps 10 20
100 Mbps 10 25
200 Mbps 10 25
500 Mbps 10 40
1 Gbps 10 50
2 Gbps 10 60
5 Gbps 10 75
10 Gbps 10 100
Networking limits
The following limits apply only for networking resources managed through the classic deployment model per
subscription.
Frontend Ports 20
HTTP Listeners 20
Packet Capture sessions 10 per region # of sessions only, not saved captures
DNS limits
Storage limits
For additional details on storage account limits, see Azure Storage Scalability and Performance Targets.
RESOURCE DEFAULT LIMIT
Maximum request rate per storage account 20,000 requests per second2
Max ingress3 per storage account (US Regions) 10 Gbps if GRS/ZRS4 enabled, 20 Gbps for LRS2
Max egress3 per storage account (US Regions) 20 Gbps if RA-GRS/GRS/ZRS4 enabled, 30 Gbps for LRS2
Max ingress3 per storage account (Non-US regions) 5 Gbps if GRS/ZRS4 enabled, 10 Gbps for LRS2
Max egress3 per storage account (Non-US regions) 10 Gbps if RA-GRS/GRS/ZRS4 enabled, 15 Gbps for LRS2
1Includes both Standard and Premium storage accounts. If you require more than 200 storage accounts, make a
request through Azure Support. The Azure Storage team will review your business case and may approve up to 250
storage accounts.
2 To get your standard storage accounts to grow past the advertised limits in capacity, ingress/egress and request
rate, please make a request through Azure Support. The Azure Storage team will review the request and may
approve higher limits on a case by case basis.
3 Capped only by the account's ingress/egress limits. Ingress refers to all data (requests) being sent to a storage
account. Egress refers to all data (responses) being received from a storage account.
4Azure Storage redundancy options include:
RA-GRS: Read-access geo-redundant storage. If RA-GRS is enabled, egress targets for the secondary location are
identical to those for the primary location.
GRS: Geo-redundant storage.
ZRS: Zone-redundant storage. Available only for block blobs.
LRS: Locally redundant storage.
The following limits apply when performing management operations using the Azure Resource Manager only.
RESOURCE TARGET
Max size of a block blob 50,000 X 100 MiB (approx. 4.75 TiB)
Target throughput for single blob Up to 60 MiB per second, or up to 500 requests per second
RESOURCE TARGET
Maximum request rate per storage account 20,000 requests per second for files of any valid size3
Server endpoints per server 33-99 server endpoints Yes, but varies based on configuration
RESOURCE TARGET
Maximum request rate per storage account 20,000 messages per second assuming 1 KiB message size
Target throughput for single queue (1 KiB messages) Up to 2000 messages per second
RESOURCE TARGET
Maximum request rate per storage account 20,000 transactions per second (assuming 1 KiB entity size)
Target throughput for single table partition (1 KiB entities) Up to 2000 entities per second
IMPORTANT
For optimal performance, limit the number of highly utilized disks attached to the virtual machine to avoid possible throttling.
If all attached disks are not highly utilized at the same time, then the virtual machine can support a larger number of disks.
For Azure Managed Disks: The disk limit for managed disks is per region and per disk type. The maximum
limit, and also the default limit, is 10,000 managed disks per region and per disk type for a subscription. For
example, you can create up to 10,000 standard managed disks and also 10,000 premium managed disks in a
region, per subscription.
Managed snapshots and images count against the managed disks limit.
For standard storage accounts: A standard storage account has a maximum total request rate of 20,000
IOPS. The total IOPS across all of your virtual machine disks in a standard storage account should not exceed
this limit.
You can roughly calculate the number of highly utilized disks supported by a single standard storage account
based on the request rate limit. For example, for a Basic Tier VM, the maximum number of highly utilized
disks is about 66 (20,000/300 IOPS per disk), and for a Standard Tier VM, it is about 40 (20,000/500 IOPS
per disk).
For premium storage accounts: A premium storage account has a maximum total throughput rate of 50
Gbps. The total throughput across all of your VM disks should not exceed this limit.
See Virtual machine sizes for additional details.
Managed virtual machine disks
Standard managed virtual machine disks
STANDARD
DISK TYPE S4 S6 S10 S20 S30 S40 S50
PREMIUM
DISKS TYPE P4 P6 P10 P20 P30 P40 P50
Throughput 25 MB/sec 50 MB/sec 100 MB/sec 150 MB/sec 200 MB/sec 250 MB/sec 250 MB/sec
per disk
1Ingress refers to all data (requests) being sent to a storage account. Egress refers to all data (responses) being
PREMIUM
STORAGE DISK
TYPE P10 P20 P30 P40 P50
Disk size 128 GiB 512 GiB 1024 GiB (1 TB) 2048 GiB (2 TB) 4095 GiB (4 TB)
Max throughput 100 MB/s 150 MB/s 200 MB/s 250 MB/s 250 MB/s
per disk
1Each Cloud Service with Web/Worker roles can have two deployments, one for production and one for staging.
Also note that this limit refers to the number of distinct roles (configuration) and not the number of instances per
role (scaling).
App Service limits
The following App Service limits include limits for Web Apps, Mobile Apps, API Apps, and Logic Apps.
PREMIUM
RESOURCE FREE SHARED (PREVIEW) BASIC STANDARD (PREVIEW)
App Service plan 1 per region 10 per resource 100 per resource 100 per resource 100 per resource
group group group group
CPU time (5 3 minutes 3 minutes Unlimited, pay at Unlimited, pay at Unlimited, pay at
min)6 standard rates standard rates standard rates
CPU time (day)6 60 minutes 240 minutes Unlimited, pay at Unlimited, pay at Unlimited, pay at
standard rates standard rates standard rates
Memory (1 hour) 1024 MB per 1024 MB per app N/A N/A N/A
App Service plan
Bandwidth 165 MB Unlimited, data Unlimited, data Unlimited, data Unlimited, data
transfer rates transfer rates transfer rates transfer rates
apply apply apply apply
Concurrent 1 1 1 5 5
debugger
connections per
application
azurewebsites.net X X X X X
subdomain with
FTP/S and SSL
Custom domain X X X X
support
Custom domain Unlimited SNI SSL Unlimited SNI SSL Unlimited SNI SSL
SSL support connections and 1 IP SSL and 1 IP SSL
connections connections
included included
Integrated Load X X X X
Balancer
Always On X X X
Auto Scale X X
WebJobs8 X X X X X
Azure Scheduler X X X X
support
Endpoint X X X
monitoring
Staging Slots 5 20
1Apps and storage quotas are per App Service plan unless noted otherwise.
2The actual number of apps that you can host on these machines depends on the activity of the apps, the size of the
machine instances, and the corresponding resource utilization.
3Dedicated instances can be of different sizes. See App Service Pricing for more details.
4Premium tier allows up to 50 computes instances (subject to availability) and 500 GB of disk space when using
App Service Environments, and 20 compute instances and 250 GB storage otherwise.
5The storage limit is the total content size across all apps in the same App Service plan. More storage options are
available in App Service Environment
6These resources are constrained by physical resources on the dedicated instances (the instance size and the
number of instances).
7If you scale an app in the Basic tier to two instances, you have 350 concurrent connections for each of the two
instances.
8Run custom executables and/or scripts on demand, on a schedule, or continuously as a background task within
your App Service instance. Always On is required for continuous WebJobs execution. Azure Scheduler Free or
Standard is required for scheduled WebJobs. There is no predefined limit on the number of WebJobs that can run in
an App Service instance, but there are practical limits that depend on what the application code is trying to do.
9SLA of 99.95% provided for deployments that use multiple instances with Azure Traffic Manager configured for
failover.
Scheduler limits
The following table describes each of the major quotas, limits, defaults, and throttles in Azure Scheduler.
Job size Maximum job size is 16K. If a PUT or a PATCH results in a job
larger than these limits, a 400 Bad Request status code is
returned.
Request URL size Maximum size of the request URL is 2048 chars.
Job history Maximum response body stored in job history is 2048 bytes.
Jobs The default max jobs quota is 5 jobs in a free job collection and
50 jobs in a standard job collection. The maximum number of
jobs is configurable on a job collection. All jobs in the job
collection are limited the value set on the job collection. If you
attempt to create more jobs than the maximum jobs quota,
then the request fails with a 409 Conflict status code.
Job history retention Job history is retained for up to 2 months or up to the last
1000 executions.
Completed and faulted job retention Completed and faulted jobs are retained for 60 days.
Batch limits
RESOURCE DEFAULT LIMIT MAXIMUM LIMIT
1 The number of dedicated cores per Batch account can be increased, but the maximum number is unspecified.
Contact Azure support to discuss increase options.
2 The number of low-priority cores per Batch account can be increased, but the maximum number is unspecified.
Contact Azure support to discuss increase options.
3 Completed jobs and job schedules are not limited.
4 Contact Azure support if you want to request an increase beyond this limit.
Hybrid 5 5 10 50 100
Connections per
Unit
Number of N/A 1 2 5 25
connections
using BizTalk
Adapter Service
per Unit
Total Push Campaigns (includes Active & Completed) 1000 per app
Search limits
Pricing tiers determine the capacity and limits of your search service. Tiers include:
Free multi-tenant service, shared with other Azure subscribers, intended for evaluation and small development
projects.
Basic provides dedicated computing resources for production workloads at a smaller scale, with up to three
replicas for highly available query workloads.
Standard (S1, S2, S3, S3 High Density) is for larger production workloads. Multiple levels exist within the
standard tier so that you can choose a resource configuration that best matches your workload profile.
Limits per subscription
You can create multiple services within a subscription, each one provisioned at a specific tier, limited only by the
number of services allowed at each tier. For example, you could create up to 12 services at the Basic tier and
another 12 services at the S1 tier within the same subscription. For more information about tiers, see Choose a SKU
or tier for Azure Search.
Maximum service limits can be raised upon request. Contact Azure Support if you need more services within the
same subscription.
Maximum 1 12 12 6 6 6
services
Maximum N/A 3 3 SU 4 36 SU 36 SU 36 SU 36 SU
scale in SU 2
an individual subscriber. For this reason, maximum scale is marked as not applicable.
4 Basic has one fixed partition. At this tier, additional SUs are used for allocating more replicas for increased query
workloads.
Limits per search service
Storage is constrained by disk space or by a hard limit on the maximum number of indexes or documents,
whichever comes first.
Replicas N/A 3 12 12 12 12
Maximum 10,000 1 million 15 million per 60 million per 120 million 1 million per
documents partition or partition or per partition index or 200
180 million 720 million or 1.4 billion million per
per service per service per service partition
1 Free tier
and preview features do not come with service level agreements (SLAs). For all billable tiers, SLAs take
effect when you provision sufficient redundancy for your service. Two or more replicas are required for query (read)
SLA. Three or more replicas are required for query and indexing (read-write) SLA. The number of partitions is not an
SLA consideration.
2 S3 HD has a hard limit of 3 partitions, which is lower than the partition limit for S3. The lower partition limit is
imposed because the index count for S3 HD is substantially higher. Given that service limits exist for both
computing resources (storage and processing) and content (indexes and documents), the content limit is reached
first.
To learn more about limits on a more granular level, such as document size, queries per second, keys, requests, and
responses, see Service limits in Azure Search.
Media Services limits
NOTE
For resources that are not fixed, you may ask for the quotas to be raised, by opening a support ticket. Do not create
additional Azure Media Services accounts in an attempt to obtain higher limits.
Policies 1,000,000(6)
File size In some scenarios, there is a limit on the maximum file size
supported for processing in Media Services. 7
1 S3 RUs are not available in India West. If you change the type (for example, from S2 to S1,) the max RU limits are
reset.
2 This number includes queued, finished, active, and canceled jobs. It does not include deleted jobs. You can delete
the old jobs using IJob.Delete or the DELETE HTTP request.
As of April 1, 2017, any Job record in your account older than 90 days will be automatically deleted, along with its
associated Task records, even if the total number of records is below the maximum quota. If you need to archive the
job/task information, you can use the code described here.
3 When making a request to list Job entities, a maximum of 1,000 jobs is returned per request. If you need to keep
track of all submitted Jobs, you can use top/skip as described in OData system query options.
4 Locators are not designed for
managing per-user access control. To give different access rights to individual users,
use Digital Rights Management (DRM) solutions. For more information, see this section.
5 The storage accounts must be from the same Azure subscription.
6 There is a limit of 1,000,000
policies for different AMS policies (for example, for Locator policy or
ContentKeyAuthorizationPolicy).
NOTE
You should use the same policy ID if you are always using the same days / access permissions / etc. For information and an
example, see this section.
7If you are uploading content to an Asset in Azure Media Services to process it with one of the media processors in
the service (that is, encoders like Media Encoder Standard and Media Encoder Premium Workflow, or analysis
engines like Face Detector), then you should be aware of the constraints on the maximum file sizes supported.
The maximum size supported for a single blob is currently up to 5 TB in Azure Blob Storage. However, additional
limits apply in Azure Media Services based on the VM sizes that are used by the service. The following table shows
the limits on each of the Media Reserved Units (S1, S2, S3.) If your source file is larger than the limits defined in the
table, your encoding job will fail. If you are encoding 4K resolution sources of long duration, you are required to use
S3 Media Reserved Units to achieve the performance needed. If you have 4K content that is larger than 260 GB limit
on the S3 Media Reserved Units, contact us at [email protected] for potential mitigations to support your
scenario.
MEDIA RESERVED UNIT TYPE MAXIMUM INPUT SIZE (GB)
S1 325
S2 640
S3 260
CDN limits
RESOURCE DEFAULT LIMIT MAXIMUM LIMIT
CDN profiles 25 25
A CDN subscription can contain one or more CDN profiles and a CDN profile can contain one or more CDN
endpoints. You may wish to use multiple profiles to organize your CDN endpoints by internet domain, web
application, or some other criteria.
To request an update to your subscription's default limits, open a support ticket.
Mobile Services limits
TIER: FREE BASIC STANDARD
Push Notifications Notification Hubs Free Tier Notification Hubs Basic Tier Notification Hubs Standard
included, up to 1 M pushes included, up to 10 M pushes Tier included, up to 10 M
pushes
For additional details on these limits and for information on pricing, see Mobile Services Pricing.
Monitor limits
RESOURCE DEFAULT LIMIT MAXIMUM LIMIT
Metric Alerts 100 active alert rules per subscription call support
Near-Real Time Alerts (Preview) 20 active alert rules per subscription same as default during preview
For additional details on these limits and for information on pricing, see Notification Hubs Pricing.
Event Hubs limits
The following table lists quotas and limits specific to Azure Event Hubs. For information about Event Hubs pricing,
see Event Hubs pricing.
BEHAVIOR WHEN
LIMIT SCOPE TYPE EXCEEDED VALUE
BEHAVIOR WHEN
QUOTA NAME SCOPE TYPE EXCEEDED VALUE
Maximum number of
header properties in
property bag:
byte/int.MaxValue
Maximum size of
property in property
bag: No explicit limit.
Limited by maximum
header size.
Maximum number of
expressions per rule
action: 32.
NOTE
If you anticipate using more than 200 units with an S1 or S2 or 10 units with an S3 tier hub, contact Microsoft support.
The following table lists the limits that apply to IoT Hub resources:
RESOURCE LIMIT
NOTE
If you need more than 10 paid IoT hubs in an Azure subscription, contact Microsoft support.
NOTE
Currently, the maximum number of devices you can connect to a single IoT hub is 500,000. If you want to increase this limit,
contact Microsoft Support.
The IoT Hub service throttles requests when the following quotas are exceeded:
Device connections 6000/sec/unit (for S3), 120/sec/unit (for S2), 12/sec/unit (for
S1).
Minimum of 100/sec.
Device-to-cloud sends 6000/sec/unit (for S3), 120/sec/unit (for S2), 12/sec/unit (for
S1).
Minimum of 100/sec.
Direct methods 3000/sec/unit (for S3), 60/sec/unit (for S2), 20/sec/unit (for S1)
Device twin reads 50/sec/unit (for S3), Maximum of 10/sec or 1/sec/unit (for S2),
10/sec (for S1)
Device twin updates 50/sec/unit (for S3), Maximum of 10/sec or 1/sec/unit (for S2),
10/sec (for S1)
THROTTLE PER-HUB VALUE
Jobs per-device operation throughput 50/sec/unit (for S3), Maximum of 10/sec or 1/sec/unit (for S2),
10/sec (for S1)
RESOURCE LIMIT
NOTE
These limits are for public preview. Once the service is generally available, you can contact Microsoft Support to increase the
number of instances in your subscription.
The Device Provisioning Service throttles requests when the following quotas are exceeded:
Operations 100/min
Version 1
RESOURCE DEFAULT LIMIT MAXIMUM LIMIT
Retry count for pipeline activity runs 1000 MaxInt (32 bit)
1 Pipeline, dataset, and linked service objects represent a logical grouping of your
workload. Limits for these objects
do not relate to amount of data you can move and process with the Azure Data Factory service. Data factory is
designed to scale to handle petabytes of data.
2 On-demand HDInsight cores are allocated out of the subscription that contains the data factory. As a result, the
above limit is the Data Factory enforced core limit for on-demand HDInsight cores and is different from the core
limit associated with your Azure subscription.
3 Cloud data movement unit (DMU) is being used in a cloud-to-cloud copy operation. It is a measure that represents
the power (a combination of CPU, memory, and network resource allocation) of a single unit in Data Factory. You
can achieve higher copy throughput by using more DMUs for some scenarios. Refer to Cloud data movement units
section on details.
4 The Integration Runtime (IR) is the compute infrastructure used by Azure Data Factory to provide the following
data integration capabilities across different network environments: data movement, dispatching activities to
compute services, execution of SSIS packages. For more information, see Integration Runtime overview.
Max number of access ACLs, per file or 32 This is a hard limit. Use groups to
folder manage access with fewer entries
Max number of default ACLs, per file or 32 This is a hard limit. Use groups to
folder manage access with fewer entries
Maximum number of inputs per job 60 There is a hard limit of 60 inputs per
Stream Analytics job.
Maximum number of outputs per job 60 There is a hard limit of 60 outputs per
Stream Analytics job.
Maximum number of functions per job 60 There is a hard limit of 60 functions per
Stream Analytics job.
Maximum number of Streaming Units 120 There is a hard limit of 120 Streaming
per job Units per Stream Analytics job.
Maximum number of jobs per region 1500 Each subscription may have up to 1500
jobs per geographical region.
CATEGORY LIMITS
CATEGORY LIMITS
Maximum number of schedules per 168 A schedule for every hour, every day of
bandwidth template the week (24*7).
Maximum size of a tiered volume on 64 TB for 8100 and 8600 8100 and 8600 are physical devices.
physical devices
Maximum size of a tiered volume on 30 TB for 8010 8010 and 8020 are virtual devices in
virtual devices in Azure 64 TB for 8020 Azure that use Standard Storage and
Premium Storage respectively.
Maximum size of a locally pinned 9 TB for 8100 8100 and 8600 are physical devices.
volume on physical devices 24 TB for 8600
Maximum number of snapshots of any 256 This includes local snapshots and cloud
type that can be retained per volume snapshots.
Restore and clone recover time for < 2 minutes The volume is made available
tiered volumes within 2 minutes of restore or
clone operation, regardless of
the volume size.
The volume performance may
initially be slower than normal as
most of the data and metadata
still resides in the cloud.
Performance may increase as
data flows from the cloud to the
StorSimple device.
The total time to download
metadata depends on the
allocated volume size. Metadata
is automatically brought into the
device in the background at the
rate of 5 minutes per TB of
allocated volume data. This rate
may be affected by Internet
bandwidth to the cloud.
The restore or clone operation is
complete when all the metadata
is on the device.
Backup operations cannot be
performed until the restore or
clone operation is fully complete.
LIMIT IDENTIFIER LIMIT COMMENTS
Restore recover time for locally pinned < 2 minutes The volume is made available
volumes within 2 minutes of the restore
operation, regardless of the
volume size.
The volume performance may
initially be slower than normal as
most of the data and metadata
still resides in the cloud.
Performance may increase as
data flows from the cloud to the
StorSimple device.
The total time to download
metadata depends on the
allocated volume size. Metadata
is automatically brought into the
device in the background at the
rate of 5 minutes per TB of
allocated volume data. This rate
may be affected by Internet
bandwidth to the cloud.
Unlike tiered volumes, in the
case of locally pinned volumes,
the volume data is also
downloaded locally on the
device. The restore operation is
complete when all the volume
data has been brought to the
device.
The restore operations may be
long and the total time to
complete the restore will depend
on the size of the provisioned
local volume, your Internet
bandwidth and the existing data
on the device. Backup operations
on the locally pinned volume are
allowed while the restore
operation is in progress.
Maximum client read/write throughput 920/720 MB/s with a single 10GbE Up to 2x with MPIO and two network
(when served from the SSD tier)* network interface interfaces.
Maximum client read/write throughput 11/41 MB/s Read throughput depends on clients
(when served from the cloud tier)* generating and maintaining sufficient
I/O queue depth.
* Maximum throughput per I/O type was measured with 100 percent read and 100 percent write scenarios. Actual
throughput may be lower and depends on I/O mix and network conditions.
Log Analytics limits
NOTE
Log Analytics was formerly known as Operational Insights.
Number of paid workspaces per N/A You are limited by the number of
subscription resources within a resource group and
number of resource groups per
subscription
1 When customers reach their 500 MB daily data transfer limit, data analysis stops and resumes at the start of the
next day. A day is based on UTC.
2 The data retention period for the Standalone and OMS pricing plans can be increased to 730 days.
Data Collector API Maximum size for a single post is 30 MB Split larger volumes into multiple posts
Maximum size for field values is 32 KB Fields longer than 32 KB are truncated.
Search API 5000 records returned for non- Aggregated data is a search that
aggregated data includes the measure command
500000 records for aggregated data
Backup limits
The following limits apply to Azure Backup.
Size of a data source for data stored in Azure vault storage 54400 GB max1
Number of backup vaults that can be created in each Azure 25 Recovery Services vaults per region
subscription
LIMIT IDENTIFIER DEFAULT LIMIT
Number of times backup can be scheduled per day 3 per day for Windows Server/Client
2 per day for SCDPM
Once a day for IaaS VMs
Total data per day 100 GB You can reduce data by setting a cap. If
you need more, you can increase the
limit up to 1,000 GB from the portal.
For capacities greater than 1,000 GB,
send mail to [email protected].
Availability multi-step test detailed 90 days This resource provides detailed results
results retention of each step.
RESOURCE DEFAULT LIMIT NOTE
For more information, see About pricing and quotas in Application Insights.
API Management limits
RESOURCE LIMIT
Cache 5 GB1
1API Management limits are different foreach pricing tier. To see the pricing tiers and their associated limits and
scaling options, see API Management Pricing.
Azure Redis Cache limits
RESOURCE LIMIT
Databases 64
Azure Redis Cache limits and sizes are different for each pricing tier. To see the pricing tiers and their associated
sizes, see Azure Redis Cache Pricing.
For more information on Azure Redis Cache configuration limits, see Default Redis server configuration.
Because configuration and management of Azure Redis Cache instances is done by Microsoft, not all Redis
commands are supported in Azure Redis Cache. For more information, see Redis commands not supported in
Azure Redis Cache.
Key Vault limits
Key transactions (Max transactions allowed in 10 seconds, per vault per region1):
HSM-KEY SOFTWARE-KEY
HSM-KEY ALL OTHER SOFTWARE-KEY ALL OTHER
KEY TYPE CREATE KEY TRANSACTIONS CREATE KEY TRANSACTIONS
1 There is a subscription-wide limit forall transaction types, that is 5x per key vault limit. For example, HSM- other
transactions per subscription are limited to 5000 transactions in 10 seconds per subscription.
Multi-Factor Authentication
RESOURCE DEFAULT LIMIT MAXIMUM LIMIT
Automation limits
RESOURCE MAXIMUM LIMIT
Job Run Time - Free tier 500 minutes per subscription per calendar month
See also
Understanding Azure Limits and Increases
Virtual Machine and Cloud Service Sizes for Azure
Sizes for Cloud Services
Azure SDK for .NET 3.0 release notes
9/19/2017 • 2 min to read • Edit Online
This topic includes release notes for version 3.0 of the Azure SDK for .NET.
This topic includes release notes for versions 2.9 and 2.9.6 of Azure SDK for .NET.
Azure SDK 2.9 for Visual Studio 2015 Update 2 and Visual Studio "15"
Preview
This update includes the following bug fixes:
Issue related to REST API Client Generation in in which the string "Unknown Type” would appear as the name of
the code-gen folder and/or the name of the namespace dropped into the generated code.
Issue related to Scheduled WebJobs in which the authentication information was failing to be passed to the
Scheduler provisioning process.
This update includes the following new feature:
Support for secondary App Services in the "Services" tab of the App Service provisioning dialog.
HDInsight Tools
HDInsight Tools for Visual Studio now supports HDInsight version 3.3, including showing Tez graphs and other
language fixes.
See also
Azure SDK 2.9 announcement post
Azure SDK for .NET 2.8, 2.8.1 and 2.8.2
9/19/2017 • 4 min to read • Edit Online
Overview
This article contains the release notes (that includes known issues and breaking changes) for the Azure SDK for
.NET 2.8, 2.8.1 and 2.8.2 releases.
For complete list of new features and updates made in this release, see the Azure SDK 2.8 for Visual Studio 2013
and Visual Studio 2015 announcement.
Other updates
For other updates, see Azure SDK 2.8 announcement post.
Also see
Azure SDK 2.8 announcement post
Support and Retirement Information for the Azure SDK for .NET and APIs
Azure SDK for .NET 2.7 and .NET 2.7.1 Release Notes
9/19/2017 • 7 min to read • Edit Online
Overview
This document contains the release notes for the Azure SDK for .NET 2.7 release.
The document also contain the release notes for the Azure SDK for .NET 2.7.1 release.
Azure SDK 2.7 is only supported in Visual Studio 2015 and Visual Studio 2013. Azure SDK 2.6 is the last supported
SDK for Visual Studio 2012.
For detailed information about this release, see Azure SDK 2.7 announcement post and Azure SDK 2.7.1
announcement post.
This document contains the release notes for the Azure SDK for .NET 2.6 release.
With Azure SDK 2.6 you can develop cloud service applications (PaaS) targeting .NET 4.5.2 or .NET 4.6 provided that
you manually install the target .NET Framework on the Cloud Service Role. See Install .NET on a Cloud Service Role.
IMPORTANT
We’re announcing the November 30, 2016, retirement for Azure Managed Cache Service and Azure In-Role Cache. We
recommend that you migrate to Azure Redis Cache in preparation for this retirement. For more information on dates and
migration guidance, see Which Azure Cache offering is right for me?
Breaking changes
Azure Resource Manager Tools
The Cloud Deployment Projects project type available in the Azure SDK 2.5 has been renamed to Azure
Resource Group.
Cloud Deployment Projects type of projects created in the Azure SDK 2.5 can be used in 2.6 but deploying the
template from Visual Studio will fail. However, deploying with the PowerShell script will still work as it did
previously. For information on how to use Cloud Deployment Projects in 2.6 read this post.
Known issues
Collecting diagnostics logs in the emulator requires a 64-bit operating system. Diagnostics logs will not be
collected when running on a 32-bit operating system. This does not affect any other emulator functionality.
Azure SDK 2.6 released on 4/29/2015 had two issues:
Universal App could not be loaded in Visual Studio 2015 when Azure SDK 2.6 was installed on the
machine.
Debugging a Cloud Service project would fail in Visual Studio 2013 and Visual Studio 2015 where
Visual Studio becomes unresponsive and crashes while displaying a dialog box with the message
"Configuring diagnostics for emulator".
An update to Azure SDK 2.6 was released on 5/18/2015. The updated version is 2.6.30508.1601; it
contains fixes for two issues described above. You can identify the build of the SDK from Control
Panel -> Programs and Features -> Microsoft Azure Tools for Microsoft Visual Studio 2013 – v 2.6.
The Version column will display the build number.
If you are still facing the above issues, install the latest version of the Azure 2.6 SDK for VS 2012, VS
2013 or VS 2015.
See Also
Support and Retirement Information for the Azure SDK for .NET and APIs
Azure SDK for .NET 2.5.1 Release Notes
11/2/2017 • 3 min to read • Edit Online
This document contains the release notes for the Azure SDK for .NET 2.5.1 release.
This article summarizes best practices for using Azure App Service.
Colocation
When Azure resources composing a solution such as a web app and a database are located in different regions the
effects can include the following:
Increased latency in communication between resources
Monetary charges for outbound data transfer cross-region as noted on the Azure pricing page.
Colocation in the same region is best for Azure resources composing a solution such as a web app and a database
or storage account used to hold content or data. When creating resources you should make sure they are in the
same Azure region unless you have specific business or design reason for them not to be. You can move an App
Service app to the same region as your database by leveraging the App Service cloning feature currently available
for Premium App Service Plan apps.
If you are running on App Service on Linux on a machine with multiple cores, another best practice is to use PM2 to
start multiple Node.js processes to execute your application. You can do this by specifying a startup command to
your container.
For example, to start four instances:
pm2 start /home/site/wwwroot/app.js --no-daemon -i 4
Overview
This tutorial shows how to use Visual Studio tools to help debug a web app in App Service, by running in debug
mode remotely or by viewing application logs and web server logs.
NOTE
Although this article refers to web apps, it also applies to API apps and mobile apps.
You'll learn:
Which Azure web app management functions are available in Visual Studio.
How to use Visual Studio remote view to make quick changes in a remote web app.
How to run debug mode remotely while a project is running in Azure, both for a web app and for a WebJob.
How to create application trace logs and view them while the application is creating them.
How to view web server logs, including detailed error messages and failed request tracing.
How to send diagnostic logs to an Azure Storage account and view them there.
If you have Visual Studio Ultimate, you can also use IntelliTrace for debugging. IntelliTrace is not covered in this
tutorial.
Prerequisites
This tutorial works with the development environment, web project, and Azure web app that you set up in Get
started with Azure and ASP.NET. For the WebJobs sections, you'll need the application that you create in Get
Started with the Azure WebJobs SDK.
The code samples shown in this tutorial are for a C# MVC web application, but the troubleshooting procedures are
the same for Visual Basic and Web Forms applications.
The tutorial assumes you're using Visual Studio 2017.
The streaming logs feature only works for applications that target .NET Framework 4 or later.
NOTE
If you download a subscription file, save it to a folder outside your source code directories (for example, in the
Downloads folder), and then delete it once the import has completed. A malicious user who gains access to the
subscription file can edit, create, and delete your Azure services.
For more information about connecting to Azure resources from Visual Studio, see Manage Accounts,
Subscriptions, and Administrative Roles.
2. In Server Explorer, expand Azure and expand App Service.
3. Expand the resource group that includes the web app that you created in [Create an ASP.NET web app in
Azure][app-service-web-get-started-dotnet.md], and then right-click the web app node and click View
Settings.
The Azure Web App tab appears, and you can see there the web app management and configuration tasks
that are available in Visual Studio.
In this tutorial, you'll use the logging and tracing drop-downs. You'll also use remote debugging but you'll
use a different method to enable it.
For information about the App Settings and Connection Strings boxes in this window, see Azure Web Apps:
How Application Strings and Connection Strings Work.
If you want to perform a web app management task that can't be done in this window, click Open in
Management Portal to open a browser window to the Azure portal.
Visual Studio opens the Web.config file from the remote web app and shows [Remote] next to the file name
in the title bar.
3. Add the following line to the system.web element:
<customErrors mode="Off"></customErrors>
4. Refresh the browser that is showing the unhelpful error message, and now you get a detailed error
message, such as the following example:
(The error shown was created by adding the line shown in red to Views\Home\Index.cshtml.)
Editing the Web.config file is only one example of scenarios in which the ability to read and edit files on your Azure
web app make troubleshooting easier.
8. Click Publish. After deployment finishes and your browser opens to the Azure URL of your web app, close
the browser.
9. In Server Explorer, right-click your web app, and then click Attach Debugger.
The browser automatically opens to your home page running in Azure. You might have to wait 20 seconds
or so while Azure sets up the server for debugging. This delay only happens the first time you run in debug
mode on a web app in a 48-hour period. When you start debugging again in the same period, there isn't a
delay.
NOTE
If you have any trouble starting the debugger, try to do it by using Cloud Explorer instead of Server Explorer.
The time you see is the Azure server time, which may be in a different time zone than your local computer.
12. Enter a new value for the currentTime variable, such as "Now running in Azure".
13. Press F5 to continue running.
The About page running in Azure displays the new value that you entered into the currentTime variable.
Remote debugging WebJobs
This section shows how to debug remotely using the project and web app you create in Get Started with the Azure
WebJobs SDK.
The features shown in this section are available only in Visual Studio 2013 with Update 4 or later.
Remote debugging only works with continuous WebJobs. Scheduled and on-demand WebJobs don't support
debugging.
1. Open the web project that you created in Get Started with the Azure WebJobs SDK.
2. In the ContosoAdsWebJob project, open Functions.cs.
3. Set a breakpoint on the first statement in the GnerateThumbnail method.
4. In Solution Explorer, right-click the web project (not the WebJob project), and click Publish.
5. In the Profile drop-down list, select the same profile that you used in Get Started with the Azure WebJobs
SDK.
6. Click the Settings tab, and change Configuration to Debug, and then click Publish.
Visual Studio deploys the web and WebJob projects, and your browser opens to the Azure URL of your web
app.
7. In Server Explorer, expand Azure > App Service > your resource group > your web app > WebJobs
> Continuous, and then right-click ContosoAdsWebJob.
8. Click Attach Debugger.
The browser automatically opens to your home page running in Azure. You might have to wait 20 seconds
or so while Azure sets up the server for debugging. This delay only happens the first time you run in debug
mode on a web app in a 48-hour period. When you start debugging again in the same period, there isn't a
delay.
9. In the web browser that is opened to the Contoso Ads home page, create a new ad.
Creating an ad causes a queue message to be created, which is picked up by the WebJob and processed.
When the WebJobs SDK calls the function to process the queue message, the code hits your breakpoint.
10. When the debugger breaks at your breakpoint, you can examine and change variable values while the
program is running the cloud. In the following illustration, the debugger shows the contents of the blobInfo
object that was passed to the GenerateThumbnail method.
If your function wrote logs, you could click ToggleOutput to see them.
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
If you find that the debugger doesn't step into the code that you want to debug, you might have to change the
Just My Code setting. For more information, see Restrict stepping to Just My Code.
A timer starts on the server when you enable the remote debugging feature, and after 48 hours the feature is
automatically turned off. This 48-hour limit is done for security and performance reasons. You can easily turn
the feature back on as many times as you like. We recommend leaving it disabled when you are not actively
debugging.
You can manually attach the debugger to any process, not only the web app process (w3wp.exe). For more
information about how to use debug mode in Visual Studio, see Debugging in Visual Studio.
The following steps show how to view trace output in a web page, without compiling in debug mode.
2. Open the application Web.config file (the one located in the project folder) and add a <system.diagnostics>
element at the end of the file just before the closing </configuration> element:
<system.diagnostics>
<trace>
<listeners>
<add name="WebPageTraceListener"
type="System.Web.WebPageTraceListener,
System.Web,
Version=4.0.0.0,
Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" />
</listeners>
</trace>
</system.diagnostics>
The Request Details page appears, and in the Trace Information section you see the output from the
trace statements that you added to the Index method.
By default, trace.axd is only available locally. If you wanted to make it available from a remote web app,
you could add localOnly="false" to the trace element in the Web.config file, as shown in the following
example:
However, enabling trace.axd in a production web app is not recommended for security reasons. In the
following sections, you'll see an easier way to read tracing logs in an Azure web app.
View the tracing output in Azure
1. In Solution Explorer, right-click the web project and click Publish.
2. In the Publish Web dialog box, click Publish.
After Visual Studio publishes your update, it opens a browser window to your home page (assuming you
didn't clear Destination URL on the Connection tab).
3. In Server Explorer, right-click your web app and select View Streaming Logs.
The Output window shows that you are connected to the log-streaming service, and adds a notification line
each minute that goes by without a log to display.
4. In the browser window that shows your application home page, click Contact.
Within a few seconds, the output from the error-level trace you added to the Contact method appears in
the Output window.
Visual Studio is only showing error-level traces because that is the default setting when you enable the log
monitoring service. When you create a new Azure web app, all logging is disabled by default, as you saw
when you opened the settings page earlier:
However, when you selected View Streaming Logs, Visual Studio automatically changed Application
Logging(File System) to Error, which means error-level logs get reported. In order to see all of your
tracing logs, you can change this setting to Verbose. When you select a severity level lower than error, all
logs for higher severity levels are also reported. So when you select verbose, you also see information,
warning, and error logs.
5. In Server Explorer, right-click the web app, and then click View Settings as you did earlier.
6. Change Application Logging (File System) to Verbose, and then click Save.
7. In the browser window that is now showing your Contact page, click Home, then click About, and then
click Contact.
Within a few seconds, the Output window shows all of your tracing output.
In this section, you enabled and disabled logging by using Azure web app settings. You can also enable and
disable trace listeners by modifying the Web.config file. However, modifying the Web.config file causes the
app domain to recycle, while enabling logging via the web app configuration doesn't do that. If the problem
takes a long time to reproduce, or is intermittent, recycling the app domain might "fix" it and force you to
wait until it happens again. Enabling diagnostics in Azure lets you start capturing error information
immediately without recycling the app domain.
Output window features
The Microsoft Azure Logs tab of the Output Window has several buttons and a text box:
3. In the Microsoft Azure Logging Options dialog box, select Web server logs, and then click OK.
4. In the browser window that shows the web app, click Home, then click About, and then click Contact.
The application logs generally appear first, followed by the web server logs. You might have to wait a while
for the logs to appear.
By default, when you first enable web server logs by using Visual Studio, Azure writes the logs to the file system.
As an alternative, you can use the Azure portal to specify that web server logs should be written to a blob
container in a storage account.
If you use the portal to enable web server logging to an Azure storage account, and then disable logging in Visual
Studio, when you re-enable logging in Visual Studio your storage account settings are restored.
4. In the address bar of the browser window, add an extra character to the URL to cause a 404 error (for
example, http://localhost:53370/Home/Contactx ), and press Enter.
After several seconds, the detailed error log appears in the Visual Studio Output window.
File Explorer opens to your Downloads folder with the downloaded file selected.
2. Extract the .zip file, and you see the following folder structure:
2. In the address bar of the browser window that shows the web app, add an extra character to the URL and
click Enter to cause a 404 error.
This causes a failed request tracing log to be created, and the following steps show how to view or
download the log.
3. In Visual Studio, in the Configuration tab of the Azure Web App window, click Open in Management
Portal.
4. In the Azure portal Settings page for your web app, click Deployment credentials, and then enter a new
user name and password.
NOTE
When you log in, you have to use the full user name with the web app name prefixed to it. For example, if you enter
"myid" as a user name and the site is "myexample", you log in as "myexample\myid".
5. In a new browser window, go to the URL that is shown under FTP hostname or FTPS hostname in the
Overview page for your web app.
6. Log in using the FTP credentials that you created earlier (including the web app name prefix for the user
name).
The browser shows the root folder of the web app.
7. Open the LogFiles folder.
9. Click the XML file for the failed request that you want to see tracing information for.
The following illustration shows part of the tracing information for a sample error.
Next Steps
You've seen how Visual Studio makes it easy to view logs created by an Azure web app. The following sections
provide links to more resources on related topics:
Azure web app troubleshooting
Debugging in Visual Studio
Remote debugging in Azure
Tracing in ASP.NET applications
Analyzing web server logs
Analyzing failed request tracing logs
Debugging Cloud Services
Azure web app troubleshooting
For more information about troubleshooting web apps in Azure App Service, see the following resources:
How to monitor web apps
Investigating Memory Leaks in Azure Web Apps with Visual Studio 2013. Microsoft ALM blog post about Visual
Studio features for analyzing managed memory issues.
Azure web apps online tools you should know about. Blog post by Amit Apple.
For help with a specific troubleshooting question, start a thread in one of the following forums:
The Azure forum on the ASP.NET site.
The Azure forum on MSDN.
StackOverflow.com.
Debugging in Visual Studio
For more information about how to use debug mode in Visual Studio, see Debugging in Visual Studio and
Debugging Tips with Visual Studio 2010.
Remote debugging in Azure
For more information about remote debugging for Azure web apps and WebJobs, see the following resources:
Introduction to Remote Debugging Azure App Service Web Apps.
Introduction to Remote Debugging Azure App Service Web Apps part 2 - Inside Remote debugging
Introduction to Remote Debugging on Azure App Service Web Apps part 3 - Multi-Instance environment and
GIT
WebJobs Debugging (video)
If your web app uses an Azure Web API or Mobile Services back-end and you need to debug that, see Debugging
.NET Backend in Visual Studio.
Tracing in ASP.NET applications
There are no thorough and up-to-date introductions to ASP.NET tracing available on the Internet. The best you can
do is get started with old introductory materials written for Web Forms because MVC didn't exist yet, and
supplement that with newer blog posts that focus on specific issues. Some good places to start are the following
resources:
Monitoring and Telemetry (Building Real-World Cloud Apps with Azure).
E-book chapter with recommendations for tracing in Azure cloud applications.
ASP.NET Tracing
Old but still a good resource for a basic introduction to the subject.
Trace Listeners
Information about trace listeners but doesn't mention the WebPageTraceListener.
Walkthrough: Integrating ASP.NET Tracing with System.Diagnostics Tracing
This article is also old, but includes some additional information that the introductory article doesn't cover.
Tracing in ASP.NET MVC Razor Views
Besides tracing in Razor views, the post also explains how to create an error filter in order to log all
unhandled exceptions in an MVC application. For information about how to log all unhandled exceptions in
a Web Forms application, see the Global.asax example in Complete Example for Error Handlers on MSDN. In
either MVC or Web Forms, if you want to log certain exceptions but let the default framework handling take
effect for them, you can catch and rethrow as in the following example:
try
{
// Your code that might cause an exception to be thrown.
}
catch (Exception ex)
{
Trace.TraceError("Exception: " + ex.ToString());
throw;
}
Streaming Diagnostics Trace Logging from the Azure Command Line (plus Glimpse!)
How to use the command line to do what this tutorial shows how to do in Visual Studio. Glimpse is a tool for
debugging ASP.NET applications.
Using Web Apps Logging and Diagnostics - with David Ebbo and Streaming Logs from Web Apps - with David
Ebbo
Videos by Scott Hanselman and David Ebbo.
For error logging, an alternative to writing your own tracing code is to use an open-source logging framework
such as ELMAH. For more information, see Scott Hanselman's blog posts about ELMAH.
Also, you don't need to use ASP.NET or System.Diagnostics tracing to get streaming logs from Azure. The Azure
web app streaming log service streams any .txt, .html, or .log file that it finds in the LogFiles folder. Therefore, you
could create your own logging system that writes to the file system of the web app, and your file is automatically
streamed and downloaded. All you have to do is write application code that creates files in the d:\home\logfiles
folder.
Analyzing web server logs
For more information about analyzing web server logs, see the following resources:
LogParser
A tool for viewing data in web server logs (.log files).
Troubleshooting IIS Performance Issues or Application Errors using LogParser
An introduction to the Log Parser tool that you can use to analyze web server logs.
Blog posts by Robert McMurray on using LogParser
The HTTP status code in IIS 7.0, IIS 7.5, and IIS 8.0
Analyzing failed request tracing logs
The Microsoft TechNet website includes a Using Failed Request Tracing section, which may be helpful for
understanding how to use these logs. However, this documentation focuses mainly on configuring failed request
tracing in IIS, which you can't do in Azure Web Apps.
Best practices and troubleshooting guide for node
applications on Azure Web Apps
11/10/2017 • 13 min to read • Edit Online
In this article, you learn best practices and troubleshooting steps for node applications running on Azure Web Apps
(with iisnode).
WARNING
Use caution when using troubleshooting steps on your production site. Recommendation is to troubleshoot your app on a
non-production setup for example your staging slot and when the issue is fixed, swap your staging slot with your production
slot.
IISNODE configuration
This schema file shows all the settings that you can configure for iisnode. Some of the settings that are useful for
your application:
nodeProcessCountPerApplication
This setting controls the number of node processes that are launched per IIS application. The default value is
1. You can launch as many node.exes as your VM vCPU count by setting this to 0. The recommended value is
0 for most applications so you can use all of the vCPUs on your machine. Node.exe is single-threaded so one
node.exe consumes a maximum of 1 vCPU. To get maximum performance out of your node application, you
want to use all vCPUs.
nodeProcessCommandLine
This setting controls the path to the node.exe. You can set this value to point to your node.exe version.
maxConcurrentRequestsPerProcess
This setting controls the maximum number of concurrent requests sent by iisnode to each node.exe. On
Azure Web Apps, the default value for this is Infinite. You don't have to worry about this setting. Outside
Azure Web Apps, the default value is 1024. You can configure this depending on how many requests your
application receives and how fast your application processes each request.
maxNamedPipeConnectionRetry
This setting controls the maximum number of times iisnode retries making the connection on the named
pipe to send the request over to node.exe. This setting in combination with namedPipeConnectionRetryDelay
determines the total timeout of each request within iisnode. The default value is 200 on Azure Web Apps.
Total Timeout in seconds = (maxNamedPipeConnectionRetry * namedPipeConnectionRetryDelay) / 1000
namedPipeConnectionRetryDelay
This setting controls the amount of time (in ms) iisnode waits between each retry to send the request to
node.exe over the named pipe. The default value is 250 ms. Total Timeout in seconds =
(maxNamedPipeConnectionRetry * namedPipeConnectionRetryDelay) / 1000
By default, the total timeout in iisnode on Azure Web Apps is 200 * 250 ms = 50 seconds.
logDirectory
This setting controls the directory where iisnode logs stdout/stderr. The default value is iisnode, which is
relative to the main script directory (directory where main server.js is present)
debuggerExtensionDll
This setting controls what version of node-inspector iisnode uses when debugging your node application.
Currently, iisnode-inspector-0.7.3.dll and iisnode-inspector.dll are the only two valid values for this setting.
The default value is iisnode-inspector-0.7.3.dll. The iisnode-inspector-0.7.3.dll version uses node-inspector-
0.7.3 and uses websockets. You must enable websockets on your Azure webapp to use this version. See
http://www.ranjithr.com/?p=98 for more details on how to configure iisnode to use the new node-inspector.
flushResponse
The default behavior of IIS is that it buffers response data up to 4 MB before flushing, or until the end of the
response, whichever comes first. iisnode offers a configuration setting to override this behavior: to flush a
fragment of the response entity body as soon as iisnode receives it from node.exe, you need to set the
iisnode/@flushResponse attribute in web.config to 'true':
<configuration>
<system.webServer>
<!-- ... -->
<iisnode flushResponse="true" />
</system.webServer>
</configuration>
Enabling flushing of every fragment of the response entity body adds performance overhead that reduces
the throughput of the system by ~5% (as of v0.1.13), so it is best to scope this setting only to endpoints that
require response streaming (for example, using the element in the web.config).
In addition to this, for streaming applications, you must also set responseBufferLimit of your iisnode handler
to 0.
<handlers>
<add name="iisnode" path="app.js" verb="\*" modules="iisnode" responseBufferLimit="0"/>
</handlers>
watchedFiles
This is a semi-colon separated list of files that are watched for changes. A change to a file causes the
application to recycle. Each entry consists of an optional directory name plus a required file name that are
relative to the directory where the main application entry point is located. Wild cards are allowed in the file
name portion only. The default value is “*.js;web.config”
recycleSignalEnabled
The default value is false. If enabled, your node application can connect to a named pipe (environment
variable IISNODE_CONTROL_PIPE) and send a “recycle” message. This causes the w3wp to recycle gracefully.
idlePageOutTimePeriod
The default value is 0, which means this feature is disabled. When set to some value greater than 0, iisnode
will page out all its child processes every ‘idlePageOutTimePeriod’ in milliseconds. See documentation to
understand what page out means. This setting is useful for applications that consume a lot of memory and
want to page out memory to disk occasionally to free up some RAM.
WARNING
Use caution when enabling the following configuration settings on production applications. The recommendation is to not
enable them on live production applications.
debugHeaderEnabled
The default value is false. If set to true, iisnode adds an HTTP response header iisnode-debug to every HTTP
response it sends the iisnode-debug header value is a URL. Individual pieces of diagnostic information can
be gleaned by looking at the URL fragment, but a much better visualization is achieved by opening the URL
in the browser.
loggingEnabled
This setting controls the logging of stdout and stderr by iisnode. Iisnode captures stdout/stderr from node
processes it launches and writes to the directory specified in the ‘logDirectory’ setting. Once this is enabled,
your application writes logs to the file system and depending on the amount of logging done by the
application, there could be performance implications.
devErrorsEnabled
The default value is false. When set to true, iisnode displays the HTTP status code and Win32 error code on
your browser. The win32 code is helpful in debugging certain types of issues.
debuggingEnabled (do not enable on live production site)
This setting controls debugging feature. Iisnode is integrated with node-inspector. By enabling this setting,
you enable debugging of your node application. Once this setting is enabled, iisnode will lay out the
necessary node-inspector files in ‘debuggerVirtualDir’ directory on the first debug request to your node
application. You can load the node-inspector by sending a request to http://yoursite/server.js/debug. You
can control the debug URL segment with ‘debuggerPathSegment’ setting. By default,
debuggerPathSegment=’debug’. You can set this to a GUID, for example, so that it is more difficult to be
discovered by others.
Check this link for more details on debugging.
This example assumes you have 4 node.exe running on your VM. If you have a different number of node.exe
running on the VM, you must modify the maxSockets setting accordingly.
My node application is consuming too much CPU.
You will probably get a recommendation from Azure Web Apps on your portal about high cpu consumption. You
can also set up monitors to watch for certain metrics. When checking the CPU usage on the Azure Portal
Dashboard, check the MAX values for CPU so you don’t miss the peak values. In cases where you think your
application is consuming too much CPU and you cannot explain why, you can profile your node application to find
out.
Profiling your node application on Azure Web Apps with V8-Profiler
For example, let's say you have a hello world app that you want to profile as follows:
function HandleRequest() {
WriteConsoleLog();
}
function WriteConsoleLog() {
for(var i=0;i<99999;++i) {
console.log('hello world');
}
}
function HandleRequest() {
profiler.startProfiling('HandleRequest');
WriteConsoleLog();
fs.writeFileSync('profile.cpuprofile', JSON.stringify(profiler.stopProfiling('HandleRequest')));
}
The preceding code profiles the WriteConsoleLog function and then writes the profile output to the
‘profile.cpuprofile’ file under your site wwwroot. Send a request to your application. You see a ‘profile.cpuprofile’
file created under your site wwwroot.
Download this file and open it with Chrome F12 Tools. Press F12 on Chrome, then choose the Profiles tab. Choose
the Load button. Select your profile.cpuprofile file that you downloaded. Click on the profile you just loaded.
You can see that 95% of the time was consumed by the WriteConsoleLog function. This also shows you the exact
line numbers and source files that caused the issue.
My node application is consuming too much memory
If your application is consuming too much memory, you see a notice from Azure Web Apps on your portal about
high memory consumption. You can set up monitors to watch for certain metrics. When checking the memory
usage on the Azure Portal Dashboard, be sure to check the MAX values for memory so you don’t miss the peak
values.
Leak detection and Heap Diffing for node.js
You could use node-memwatch to help you identify memory leaks. You can install memwatch just like v8-profiler
and edit your code to capture and diff heaps to identify the memory leaks in your application.
My node.exe’s are getting killed randomly
There are a few reasons why this could be happening:
1. Your application is throwing uncaught exceptions – Check d:\home\LogFiles\Application\logging-errors.txt file
for the details on the exception thrown. This file has the stack trace so you can fix your application based on this.
2. Your application is consuming too much memory which is affecting other processes from getting started. If the
total VM memory is close to 100%, your node.exe’s could be killed by the process manager to let other
processes get a chance to do some work. To fix this, either make sure your application is not leaking memory
OR if your application needs to use a great deal of memory, scale up to a larger VM with a lot more RAM.
My node application does not start
If your application is returning 500 Errors when it starts, there could be a few reasons:
1. Node.exe is not present at the correct location. Check nodeProcessCommandLine setting.
2. Main script file is not present at the correct location. Check web.config and make sure the name of the main
script file in the handlers section matches the main script file.
3. Web.config configuration is not correct – check the settings names/values.
4. Cold Start – Your application is taking too long to start. If your application takes longer than
(maxNamedPipeConnectionRetry * namedPipeConnectionRetryDelay) / 1000 seconds, iisnode returns a 500
error. Increase the values of these settings to match your application start time to prevent iisnode from timing
out and returning the 500 error.
My node application crashed
Your application is throwing uncaught exceptions – Please check d:\home\LogFiles\Application\logging-errors.txt
file for the details on the exception thrown. This file has the stack trace so you can fix your application based on this.
My node application takes too much time to start (Cold Start)
The most common reason for an application taking too long to start is a high number of files in the node_modules.
The application tries to load most of these files when starting. By default, since your files reside on the network
share on Azure Web Apps, loading many files can take time. Some solutions to make this process faster are:
1. Be sure you have a flat dependency structure and no duplicate dependencies by using npm3 to install your
modules.
2. Try to lazy load your node_modules and not load all of the modules at application start. This means that the call
to require(‘module’) should be made when you actually need it within the function you try when using the
module.
3. Azure Web Apps offers a feature called local cache. This feature copies your content from the network share to
the local disk on the VM. Since the files are local, the load time of node_modules is much faster.
There is a setting within NODE.exe called NODE_PENDING_PIPE_INSTANCES. By default, outside of Azure Web
Apps, this value is 4. This means that node.exe can only accept four requests at a time on the named pipe. On Azure
Web Apps, this value is set to 5000. This value should be good enough for most node applications running on
Azure Web Apps. You should not see 503.1003 on Azure Web Apps because of the high value for the
NODE_PENDING_PIPE_INSTANCES. |
More resources
Follow these links to learn more about node.js applications on Azure App Service.
Get started with Node.js Web Apps in Azure App Service
How to debug a Node.js web app in Azure App Service
Using Node.js Modules with Azure applications
Azure App Service Web Apps: Node.js
Node.js Developer Center
Exploring the Super Secret Kudu Debug Console
Troubleshoot HTTP errors of "502 bad gateway" and
"503 service unavailable" in your Azure web apps
9/19/2017 • 4 min to read • Edit Online
"502 bad gateway" and "503 service unavailable" are common errors in your web app hosted in Azure App Service.
This article helps you troubleshoot these errors.
If you need more help at any point in this article, you can contact the Azure experts on the MSDN Azure and the
Stack Overflow forums. Alternatively, you can also file an Azure support incident. Go to the Azure Support site and
click on Get Support.
Symptom
When you browse to the web app, it returns a HTTP "502 Bad Gateway" error or a HTTP "503 Service Unavailable"
error.
Cause
This problem is often caused by application level issues, such as:
requests taking a long time
application using high memory/CPU
application crashing due to an exception.
You can also manage your web app using Azure Powershell. For more information, see Using Azure PowerShell
with Azure Resource Manager.
Troubleshoot slow web app performance issues in
Azure App Service
9/19/2017 • 9 min to read • Edit Online
This article helps you troubleshoot slow web app performance issues in Azure App Service.
If you need more help at any point in this article, you can contact the Azure experts on the MSDN Azure and the
Stack Overflow forums. Alternatively, you can also file an Azure support incident. Go to the Azure Support site and
click on Get Support.
Symptom
When you browse the web app, the pages load slowly and sometimes timeout.
Cause
This problem is often caused by application level issues, such as:
network requests taking a long time
application code or database queries being inefficient
application using high memory/CPU
application crashing due to an exception
Troubleshooting steps
Troubleshooting can be divided into three distinct tasks, in sequential order:
1. Observe and monitor application behavior
2. Collect data
3. Mitigate the issue
App Service Web Apps gives you various options at each step.
1. Observe and monitor application behavior
Track Service health
Microsoft Azure publicizes each time there is a service interruption or performance degradation. You can track the
health of the service on the Azure portal. For more information, see Track service health.
Monitor your web app
This option enables you to find out if your application is having any issues. In your web app’s blade, click the
Requests and errors tile. The Metric blade shows you all the metrics you can add.
Some of the metrics that you might want to monitor for your web app are
Average memory working set
Average response time
CPU time
Memory working set
Requests
For more information, see:
Monitor Web Apps in Azure App Service
Receive alert notifications
Monitor web endpoint status
If you are running your web app in the Standard pricing tier, Web Apps lets you monitor two endpoints from three
geographic locations.
Endpoint monitoring configures web tests from geo-distributed locations that test response time and uptime of
web URLs. The test performs an HTTP GET operation on the web URL to determine the response time and uptime
from each location. Each configured location runs a test every five minutes.
Uptime is monitored using HTTP response codes, and response time is measured in milliseconds. A monitoring test
fails if the HTTP response code is greater than or equal to 400 or if the response takes more than 30 seconds. An
endpoint is considered available if its monitoring tests succeed from all the specified locations.
To set it up, see Monitor apps in Azure App Service.
Also, see Keeping Azure Web Sites up plus Endpoint Monitoring - with Stefan Schackow for a video on endpoint
monitoring.
Application performance monitoring using Extensions
You can also monitor your application performance by using site extensions.
Each App Service web app provides an extensible management end point that allows you to use a powerful set of
tools deployed as site extensions. Extensions include:
Source code editors like Visual Studio Team Services.
Management tools for connected resources such as a MySQL database connected to a web app.
Azure Application Insights and New Relic are two of the performance monitoring site extensions that are available.
To use New Relic, you install an agent at runtime. To use Azure Application Insights, you rebuild your code with an
SDK, and you can also install an extension that provides access to additional data. The SDK lets you write code to
monitor the usage and performance of your app in more detail.
To use Application Insights, see Monitor performance in web applications.
To use New Relic, see New Relic Application Performance Management on Azure.
2. Collect data
The Web Apps environment provides diagnostic functionality for logging information from both the web server
and the web application. The information is separated into web server diagnostics and application diagnostics.
Enable web server diagnostics
You can enable or disable the following kinds of logs:
Detailed Error Logging - Detailed error information for HTTP status codes that indicate a failure (status code
400 or greater). This may contain information that can help determine why the server returned the error code.
Failed Request Tracing - Detailed information on failed requests, including a trace of the IIS components used
to process the request and the time taken in each component. This can be useful if you are attempting to
improve web app performance or isolate what is causing a specific HTTP error.
Web Server Logging - Information about HTTP transactions using the W3C extended log file format. This is
useful when determining overall web app metrics, such as the number of requests handled or how many
requests are from a specific IP address.
Enable application diagnostics
There are several options to collect application performance data from Web Apps, profile your application live from
Visual Studio, or modify your application code to log more information and traces. You can choose the options
based on how much access you have to the application and what you observed from the monitoring tools.
U se A p p l i c a t i o n I n si g h t s P r o fi l e r
You can enable the Application Insights Profiler to start capturing detailed performance traces. You can access
traces captured up to five days ago when you need to investigate problems happened in the past. You can choose
this option as long as you have access to the web app's Application Insights resource on Azure portal.
Application Insights Profiler provides statistics on response time for each web call and traces that indicates which
line of code caused the slow responses. Sometimes the App Service app is slow because certain code is not written
in a performant way. Examples include sequential code that can be run in parallel and undesired database lock
contentions. Removing these bottlenecks in the code increases the app's performance, but they are hard to detect
without setting up elaborate traces and logs. The traces collected by Application Insights Profiler helps identifying
the lines of code that slows down the application and overcome this challenge for App Service apps.
For more information, see Profiling live Azure web apps with Application Insights.
U se R e m o t e P r o fi l i n g
In Azure App Service, Web Apps, API Apps, and WebJobs can be remotely profiled. Choose this option if you have
access to the web app resource and you know how to reproduce the issue, or if you know the exact time interval
the performance issue happens.
Remote Profiling is useful if the CPU usage of the process is high and your process is running slower than
expected, or the latency of HTTP requests are higher than normal, you can remotely profile your process and get
the CPU sampling call stacks to analyze the process activity and code hot paths.
For more information, see Remote Profiling support in Azure App Service.
Se t u p d i a g n o st i c t r a c e s m a n u a l l y
If you have access to the web application source code, Application diagnostics enables you to capture information
produced by a web application. ASP.NET applications can use the System.Diagnostics.Trace class to log
information to the application diagnostics log. However, you need to change the code and redeploy your
application. This method is recommended if your app is running on a testing environment.
For detailed instructions on how to configure your application for logging, see Enable diagnostics logging for web
apps in Azure App Service.
Use the Azure App Service support portal
Web Apps provides you with the ability to troubleshoot issues related to your web app by looking at HTTP logs,
event logs, process dumps, and more. You can access all this information using our Support portal at http://<your
app name>.scm.azurewebsites.net/Support
The Azure App Service support portal provides you with three separate tabs to support the three steps of a
common troubleshooting scenario:
1. Observe current behavior
2. Analyze by collecting diagnostics information and running the built-in analyzers
3. Mitigate
If the issue is happening right now, click Analyze > Diagnostics > Diagnose Now to create a diagnostic session
for you, which collects HTTP logs, event viewer logs, memory dumps, PHP error logs, and PHP process report.
Once the data is collected, the support portal runs an analysis on the data and provides you with an HTML report.
In case you want to download the data, by default, it would be stored in the D:\home\data\DaaS folder.
For more information on the Azure App Service support portal, see New Updates to Support Site Extension for
Azure Websites.
Use the Kudu Debug Console
Web Apps comes with a debug console that you can use for debugging, exploring, uploading files, as well as JSON
endpoints for getting information about your environment. This console is called the Kudu Console or the SCM
Dashboard for your web app.
You can access this dashboard by going to the link https://<Your app name>.scm.azurewebsites.net/.
Some of the things that Kudu provides are:
environment settings for your application
log stream
diagnostic dump
debug console in which you can run Powershell cmdlets and basic DOS commands.
Another useful feature of Kudu is that, in case your application is throwing first-chance exceptions, you can use
Kudu and the SysInternals tool Procdump to create memory dumps. These memory dumps are snapshots of the
process and can often help you troubleshoot more complicated issues with your web app.
For more information on features available in Kudu, see Azure Websites Team Services tools you should know
about.
3. Mitigate the issue
Scale the web app
In Azure App Service, for increased performance and throughput, you can adjust the scale at which you are running
your application. Scaling up a web app involves two related actions: changing your App Service plan to a higher
pricing tier, and configuring certain settings after you have switched to the higher pricing tier.
For more information on scaling, see Scale a web app in Azure App Service.
Additionally, you can choose to run your application on more than one instance. Scaling out not only provides you
with more processing capability, but also gives you some amount of fault tolerance. If the process goes down on
one instance, the other instances continue to serve requests.
You can set the scaling to be Manual or Automatic.
Use AutoHeal
AutoHeal recycles the worker process for your app based on settings you choose (like configuration changes,
requests, memory-based limits, or the time needed to execute a request). Most of the time, recycle the process is
the fastest way to recover from a problem. Though you can always restart the web app from directly within the
Azure portal, AutoHeal does it automatically for you. All you need to do is add some triggers in the root web.config
for your web app. These settings would work in the same way even if your application is not a .Net app.
For more information, see Auto-Healing Azure Web Sites.
Restart the web app
Restarting is often the simplest way to recover from one-time issues. On the Azure portal, on your web app’s blade,
you have the options to stop or restart your app.
You can also manage your web app using Azure Powershell. For more information, see Using Azure PowerShell
with Azure Resource Manager.
Application performance FAQs for Web Apps in
Azure
1/2/2018 • 8 min to read • Edit Online
This article has answers to frequently asked questions (FAQs) about application performance issues for the Web
Apps feature of Azure App Service.
If your Azure issue is not addressed in this article, visit the Azure forums on MSDN and the Stack Overflow. You can
post your issue in these forums, or post to @AzureSupport on Twitter. You also can submit an Azure support
request. To submit a support request, on the Azure support page, select Get support.
When I browse to my app, I see "Error 403 - This web app is stopped."
How do I resolve this?
Three conditions can cause this error:
The web app has reached a billing limit and your site has been disabled.
The web app has been stopped in the portal.
The web app has reached a resource quota limit that might apply to a Free or Shared scale service plan.
To see what is causing the error and to resolve the issue, follow the steps in Web Apps: "Error 403 – This web app is
stopped".
Where can I learn more about quotas and limits for various App Service
plans?
For information about quotas and limits, see App Service limits.
How do I decrease the response time for the first request after idle
time?
By default, web apps are unloaded if they are idle for a set period of time. This way, the system can conserve
resources. The downside is that the response to the first request after the web app is unloaded is longer, to allow
the web app to load and start serving responses. In Basic and Standard service plans, you can turn on the Always
On setting to keep the app always loaded. This eliminates longer load times after the app is idle. To change the
Always On setting:
1. In the Azure portal, go to your web app.
2. Select Application settings.
3. For Always On, select On.
How do I turned on failed request tracing?
To turn on failed request tracing:
1. In the Azure portal, go to your web app.
2. Select All Settings > Diagnostics Logs.
3. For Failed Request Tracing, select On.
4. Select Save.
5. On the web app blade, select Tools.
6. Select Visual Studio Online.
7. If the setting is not On, select On.
8. Select Go.
9. Select Web.config.
10. In system.webServer, add this configuration (to capture a specific URL):
<system.webServer>
<tracing> <traceFailedRequests>
<remove path="*api*" />
<add path="*api*">
<traceAreas>
<add provider="ASP" verbosity="Verbose" />
<add provider="ASPNET" areas="Infrastructure,Module,Page,AppServices" verbosity="Verbose" />
<add provider="ISAPI Extension" verbosity="Verbose" />
<add provider="WWW Server" areas="Authentication,Security,Filter,StaticFile,CGI,Compression,
Cache,RequestNotifications,Module,FastCGI" verbosity="Verbose" />
</traceAreas>
<failureDefinitions statusCodes="200-999" />
</add> </traceFailedRequests>
</tracing>
11. To troubleshoot slow-performance issues, add this configuration (if the capturing request is taking more than 30
seconds):
<system.webServer> <tracing> <traceFailedRequests> <remove path="*" /> <add path="*"> <traceAreas> <add
provider="ASP" verbosity="Verbose" /> <add provider="ASPNET" areas="Infrastructure,Module,Page,AppServices"
verbosity="Verbose" /> <add provider="ISAPI Extension" verbosity="Verbose" /> <add provider="WWW Server"
areas="Authentication,Security,Filter,StaticFile,CGI,Compression, Cache,RequestNotifications,Module,FastCGI"
verbosity="Verbose" /> </traceAreas> <failureDefinitions timeTaken="00:00:30" statusCodes="200-999" /> </add>
</traceFailedRequests> </tracing>
12. To download the failed request traces, in the portal, go to your website.
13. Select Tools > Kudu > Go.
14. In the menu, select Debug Console > CMD.
15. Select the LogFiles folder, and then select the folder with a name that starts with W3SVC.
16. To see the XML file, select the pencil icon.
I can't find my log files in the file structure of my web app. How can I
find them?
If you use the Local Cache feature of App Service, the folder structure of the LogFiles and Data folders for your App
Service instance are affected. When Local Cache is used, subfolders are created in the storage LogFiles and Data
folders. The subfolders use the naming pattern "unique identifier" + time stamp. Each subfolder corresponds to a
VM instance in which the web app is running or has run.
To determine whether you are using Local Cache, check your App Service Application settings tab. If Local Cache
is being used, the app setting WEBSITE_LOCAL_CACHE_OPTION is set to Always .
If you are not using Local Cache and are experiencing this issue, submit a support request.
I see the message "An attempt was made to access a socket in a way
forbidden by its access permissions." How do I resolve this?
This error typically occurs if the outbound TCP connections on the VM instance are exhausted. In App Service, limits
are enforced for the maximum number of outbound connections that can be made for each VM instance. For more
information, see Cross-VM numerical limits.
This error also might occur if you try to access a local address from your application. For more information, see
Local address requests.
For more information about outbound connections in your web app, see the blog post about outgoing connections
to Azure websites.
How do I use Visual Studio to remote debug my App Service web app?
For a detailed walkthrough that shows you how to debug your web app by using Visual Studio, see Remote debug
your App Service web app.
Deployment FAQs for Web Apps in Azure
11/3/2017 • 4 min to read • Edit Online
This article has answers to frequently asked questions (FAQs) about deployment issues for the Web Apps feature of
Azure App Service.
If your Azure issue is not addressed in this article, visit the Azure forums on MSDN and the Stack Overflow. You can
post your issue in these forums, or post to @AzureSupport on Twitter. You also can submit an Azure support
request. To submit a support request, on the Azure support page, select Get support.
I am just getting started with App Service web apps. How do I publish
my code?
Here are some options for publishing your web app code:
Deploy by using Visual Studio. If you have the Visual Studio solution, right-click the web application project, and
then select Publish.
Deploy by using an FTP client. In the Azure portal, download the publish profile for the web app that you want to
deploy your code to. Then, upload the files to \site\wwwroot by using the same publish profile FTP credentials.
For more information, see Deploy your app to App Service.
I see an error message when I try to deploy from Visual Studio. How do
I resolve this?
If you see the following message, you might be using an older version of the SDK: “Error during deployment for
resource 'YourResourceName' in resource group 'YourResourceGroup': MissingRegistrationForLocation: The
subscription is not registered for the resource type 'components' in the location 'Central US'. Please re-register for
this provider in order to have access to this location.”
To resolve this error, upgrade to the latest SDK. If you see this message and you have the latest SDK, submit a
support request.
How do I resolve "FTP Error 550 - There is not enough space on the
disk" when I try to FTP my files?
If you see this message, it's likely that you are running into a disk quota in the service plan for your web app. You
might need to scale up to a higher service tier based on your disk space needs. For more information about pricing
plans and resource limits, see App Service pricing.
How do I integrate Visual Studio Team Services code with App Service?
You have two options for using continuous deployment with Visual Studio Team Services:
Use a Git project. Connect via App Service by using the deployment options for that repo.
Use a Team Foundation Version Control (TFVC) project. Deploy by using the build agent for App Service.
Continuous code deployment for both these options depends on existing developer workflows and check-in
procedures. For more information, see these articles:
Implement continuous deployment of your app to an Azure website
Set up a Visual Studio Team Services account so it can deploy to a web app
This article has answers to frequently asked questions (FAQs) about issues with open-source technologies for the
Web Apps feature of Azure App Service.
If your Azure issue is not addressed in this article, visit the Azure forums on MSDN and the Stack Overflow. You can
post your issue in these forums, or post to @AzureSupport on Twitter. You also can submit an Azure support
request. To submit a support request, on the Azure support page, select Get support.
Modify the iisnode.yml file. Changing the Node.js version in the iisnode.yml file only sets the runtime
environment that iisnode uses. Your Kudu cmd and others still use the Node.js version that is set in App
settings in the Azure portal.
To set the iisnode.yml manually, create an iisnode.yml file in your app root folder. In the file, include the
following line:
Set the iisnode.yml file by using package.json during source control deployment. The Azure source control
deployment process involves the following steps:
1. Moves content to the Azure web app.
2. Creates a default deployment script, if there isn’t one (deploy.cmd, .deployment files) in the web app root
folder.
3. Runs a deployment script in which it creates an iisnode.yml file if you mention the Node.js version in the
package.json file > engine "engines": {"node": "5.9.1","npm": "3.7.3"}
4. The iisnode.yml file has the following line of code:
nodeProcessCommandLine: "D:\Program Files (x86)\nodejs\5.9.1\node.exe"
[09-Oct-2015 00:03:13 UTC] PHP Warning: mysqli_real_connect(): (HY000/1226): User ‘abcdefghijk79' has exceeded
the ‘max_user_connections’ resource (current value: 4) in D:\home\site\wwwroot\wp-includes\wp-db.php on line
1454
If you see this error in your debug.log or php_errors.log files, your app is exceeding the number of connections. If
you’re hosting on ClearDB, verify the number of connections that are available in your service plan.
How do I deploy a Django app to App Service by using Git and the new
version of Python?
For information about installing Django, see Deploying a Django app to App Service.
The web application[ROOT] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when
the web application was stopped. To prevent a memory leak,the JDBC Driver has been forcibly unregistered
<httpPlatform>
<environmentVariables>
<environmentVariablename ="JAVA_OPTS" value=" -Djava.net.preferIPv4Stack=true
-Xms128M -classpath %CLASSPATH%;[Path to the sqljdbc*.jarfile]" />
</environmentVariables>
</httpPlatform>
Error transferring file [filename] Copying files from remote side failed.
The process cannot access the file because it is being used by another process.
I get an HTTP 403 error when I try to import or export my MySQL in-
app database by using PHPMyadmin. How do I resolve this?
If you are using an older version of Chrome, you might be experiencing a known bug. To resolve the issue, upgrade
to a newer version of Chrome. Also try using a different browser, like Internet Explorer or Edge, where the issue
does not occur.
Configuration and management FAQs for Web Apps
in Azure
11/22/2017 • 15 min to read • Edit Online
This article has answers to frequently asked questions (FAQs) about configuration and management issues for the
Web Apps feature of Azure App Service.
If your Azure issue is not addressed in this article, visit the Azure forums on MSDN and the Stack Overflow. You can
post your issue in these forums, or post to @AzureSupport on Twitter. You also can submit an Azure support
request. To submit a support request, on the Azure support page, select Get support.
Can I export my App Service certificate to use with other Azure cloud
services?
The portal provides a first-class experience for deploying an App Service certificate through Azure Key Vault to App
Service apps. However, we have been receiving requests from customers to use these certificates outside the App
Service platform, for example, with Azure Virtual Machines. To learn how to create a local PFX copy of your App
Service certificate so you can use the certificate with other Azure resources, see Create a local PFX copy of an App
Service certificate.
For more information, see FAQs for App Service certificates and custom domains.
I'm trying to use Hybrid Connections with SQL Server. Why do I see the
message "System.OverflowException: Arithmetic operation resulted in
an overflow"?
If you use Hybrid Connections to access SQL Server, a Microsoft .NET update on May 10, 2016, might cause
connections to fail. You might see this message:
Resolution
The exception was caused by an issue with the Hybrid Connection Manager that has since been fixed. Be sure to
update your Hybrid Connection Manager to resolve this issue.
Why do I get an error when I try to connect an App Service web app to
a virtual network that is connected to ExpressRoute?
If you try to connect an Azure web app to a virtual network that's connected to Azure ExpressRoute, it fails. The
following message appears: "Gateway is not a VPN gateway."
Currently, you cannot have point-to-site VPN connections to a virtual network that is connected to ExpressRoute. A
point-to-site VPN and ExpressRoute cannot coexist for the same virtual network. For more information, see
ExpressRoute and site-to-site VPN connections limits and limitations.
How do I connect an App Service web app to a virtual network that has
a static routing (policy-based) gateway?
Currently, connecting an App Service web app to a virtual network that has a static routing (policy-based) gateway
is not supported. If your target virtual network already exists, it must have point-to-site VPN enabled, with a
dynamic routing gateway, before it can be connected to an app. If your gateway is set to static routing, you cannot
enable a point-to-site VPN.
For more information, see Integrate an app with an Azure virtual network.
In my App Service Environment, why can I create only one App Service
plan, even though I have two workers available?
To provide fault tolerance, App Service Environment requires that each worker pool needs at least one additional
compute resource. The additional compute resource cannot be assigned a workload.
For more information, see How to create an App Service Environment.
To resolve this, make sure that none of the following conditions are true:
The subnet is too small.
The subnet is not empty.
ExpressRoute prevents the network connectivity requirements of an App Service Environment.
A bad Network Security Group prevents the network connectivity requirements of an App Service Environment.
Forced tunneling is turned on.
For more information, see Frequent issues when deploying (creating) a new Azure App Service Environment.
For more information about scheduled WebJobs, see Create a scheduled WebJob by using a Cron expression.
How do I configure a custom domain name for an App Service web app
that uses Traffic Manager?
To learn how to use a custom domain name with an App Service app that uses Azure Traffic Manager for load
balancing, see Configure a custom domain name for an Azure web app with Traffic Manager.
<system.webServer>
<urlCompression doStaticCompression="true" doDynamicCompression="true" />
< /system.webServer>
You also can specify the specific dynamic and static MIME types that you want to compress. For more information,
see our response to a forum question in httpCompression settings on a simple Azure website.