Azure Web Apps~Deep Dive
About Me
Vaibhav Gujral
http://vabgujral.wordpress.com
Twitter: @vabgujral
GitHub: vabgujral
Skype: vaibhav.gujral
Technical architect with 11+ years of
extensive experience in designing,
architecting, developing and delivering
enterprise class applications.
Building Azure Solutions since 2010
Full Stack Developer. Key skills include
.Net technologies, AngularJS, SQL
Agenda -
Azure App Services Overview
Azure App Service Plans
Azure Web Apps
Overview
Deploying Web Apps
Diagnostics & Monitoring
Networking support
Scaling Web Apps
Testing Web Apps
Azure App Service
Integrated Cloud App Platform for delivering apps across cloud and mobile
devices
Runs on fully managed virtual machines
No Remote desktop support
Azure App Services include the following services
Web Apps – That scale with your business
Mobile Apps – create mobile backend services for any device
Logic app – Automate business process across SaaS and on premises
API App – Easily build and configure
Full capability set available including:
.NET, Node.js, Java, PHP, and Python
WebJobs for long running tasks
Integrated VS publish, remote debug…
CI with GitHub, BitBucket, VSO
Auto-load balance, Autoscale, Geo DR
Virtual networking and hybrid connections
Site slots for staged deployments
Earlier called as “Web Sites”
New capabilities for Mobile apps:
Webjobs for long running tasks
CI with GitHub, BitBucket, VSO
Auto-load balance, Autoscale, Geo DR
Virtual networking and hybrid connections
Site slots for staged deployments
Supports Push notifcations
Earlier called as “Mobile Services”
New Logic Apps for easy automation
No code designer for rapid creation
Dozens of pre-built templates to get started
Out of box support for popular SaaS and on-premises
apps
Use with custom API apps of your own
Biztalk APIs for expert integration scenarios
Easily use cloud or custom APIs:
Dozens of built-in APIs for popular SaaS
An ecosystem of APIs for any need
Create and publish custom, reusable APIs
Visual Studio tooling with one click publish and
remote debugging
Automatic client SDK generation for many languages
Azure App Service
All app types are part of Azure App Service
Each one can use the features of the others
No real difference except name and icon
All app types share the same native Azure features like Resource Manager, RBAC etc.
The word app refers to the hosting resources dedicated to running a workload.
If an application is composed of a web front end and a RESTful API back end we could:
Deploy both (front end and API) to a single web app
Deploy front-end code to a web app and back-end code to an API app
Azure App Service Benefits
Multiple languages and frameworks - App Service has first-class support for
ASP.NET, Node.js, Java, PHP, and Python. PowerShell and other scripts or
executables are supported on App Service VMs.
DevOps optimization – Supports continuous integration and deployment
with Visual Studio Team Services, GitHub, or BitBucket. Promote updates
through test and staging environments. Perform A/B testing. App Service
can be managed by using Azure PowerShell or the cross-platform
command-line interface (CLI).
Global scale with high availability – Can be scaled up or out manually or automatically. Apps can be hosted anywhere in Microsoft's global
datacenter infrastructure, and the App Service SLA promises high
availability.
Azure App Service Benefits
Connections to SaaS platforms and on-premises data - Choose from more
than 50 connectors for enterprise systems (such as SAP, Siebel, and Oracle),
SaaS services (such as Salesforce and Office 365), and internet services
(such as Facebook and Twitter). Access on-premises data using Hybrid
Connections and Azure Virtual Networks.
Security and compliance - App Service is ISO, SOC, and PCI compliant.
Application templates - Choose from an extensive list of application templates in the Azure Marketplace including popular open-source
software such as WordPress, Joomla, and Drupal.
Visual Studio integration - Dedicated tools in Visual Studio streamline the
work of creating, deploying, and debugging.
App Service Plans represent the collection of physical resources used to
host applications
App Service Plans include –
Region (Central US, West US etc.)
Scale count (one, two or three instances etc.)
Instance Size (S/M/L)
SKU(Free, Shared, Basic, Standard, Premium)
All applications within Azure App Service runs in an App Service Plan
Apps in same subscription, region and resource group can share an App
Service Plan
An app can be moved between App Service plans within same resource
group and geographical regions
Azure App Service Plans
An app should go into a new App Service plan when:
App is resource-intensive.
App has different scaling factors from the other apps hosted in an existing
plan.
App needs resource in a different geographical region.
App needs new set of resources
You need greater control on the app
App Service plan determines the cost and not the number of apps hosted
in it.
Azure App Service Plans
App Service Plans can be created-
Stand-alone
As Part of the app
NOTE-
App Service plans that have no apps associated to them still incur charges
since they continue to reserve the compute capacity.
To avoid unexpected charges, when the last app hosted in an App Service
plan is deleted, the resulting empty App Service plan is also deleted.
Azure App Service Plans
New-AzureRmAppServicePlan
Get-AzureRmAppServicePlan
Set-AzureRmAppServicePlan
Remove-AzureRmAppServicePlan
Powershell commands for Azure App
Service Plans
Demo
Azure Web Apps
Full capability set available including:
.NET, Node.js, Java, PHP, and Python
WebJobs for long running tasks
Integrated VS publish, remote debug…
CI with GitHub, BitBucket, VSO
Auto-load balance, Autoscale, Geo DR
Virtual networking and hybrid connections
Site slots for staged deployments
Earlier called as “Web Sites”
Azure Web Apps Pricing
Azure Web Apps Pricing
Azure Web Apps Pricing
Azure Web Apps Pricing
Azure Web Apps Pricing
Creating Azure Web App using
Command Line options
The New-AzureRmWebApp cmdlet creates an Azure Web App in a given
resource group that uses the specified App Service plan and data center.
Powershell Commands for Web Apps
New-AzureRmWebApp
Remove-AzureRmWebApp
Set-AzureRmWebApp
Restart-AzureRmWebapp
Stop-AzureRmWebapp
Get-AzureRmWebAppPublishingProfile
Reset-AzureRmWebAppPublishingProfile
Creating Azure Web App using
Command Line options
The az webapp create cmdlet creates an Azure Web App in a given
resource group that uses the specified App Service plan.
Azure CLI Commands for Web Apps
az webapp browse
az webapp create
az webapp delete
az webapp list
az webapp restart
az webapp show
az webapp start
az webapp stop
Demo
Managing Application Settings
Managing Application Settings
Custom Domains
SSL Certificates
Demo
WebJobs
Run background long running programs or scripts in the same context
Three ways of running web jobs:
On-demand
Continuously
Scheduled
Cost covered in App Service
Azure WebJobs SDK supports common tasks like image processing, queue
processing, file maintenance, sending emails etc.
WebJobs SDK includes
Nuget Packages – for decorating methods with attributes
Dashboard – provides rich monitoring & diagnostics
WebJobs
Accepted file types include:
.cmd, .bat, .exe (using windows cmd)
.ps1 (using powershell)
.sh (using bash)
.php (using php)
.py (using python)
.js (using node)
.jar (using java)
WebJobs
Demo
Deployment Slots
Deploy to a separate deployment slot instead of the default production
slot
Supported in Standard or Premium tiers
Each slot has its own app hostname
App content and configuration can be swapped between two slots
Benefits
Validation of changes before moving to production
All instances are warmed up before swapping, ensuring zero downtime
Easy swap to “last known good site”
Continuous Deployment
Kudu
Troubleshooting and Analysis tools available for use within Azure Web Apps
https://xxxxxxxx.scm.azurewebsites.net
‘Buddy site' to the real Azure site
Runs in same sandbox but different process
Provides cmd and powershell console
View Streaming logs
Download memory dump
Verify environment variables and app settings
Web jobs & functions
Web hooks and deployment hooks
Kudu
Kudu Demo
App Service Editor – currently in preview
Visual Studio Support for Web
Apps
Visual Studio Support for Web
Apps
Visual Studio Support for Web
Apps
Visual Studio Support for Web
Apps
Visual Studio Support for Web
Apps
Remote Debugging
Visual Studio supports remote debugging
Set breakpoints or manipulate memory directly
Step through code or change the code path
Not supported in Express editions of Visual Studio
Also supported by continuous web jobs and not by scheduled/on-demand
Enable Remote Debugging in Azure portal
Remote Debugging
Application Insights
Extensible Application Performance Management (APM) service for web
developers on multiple platforms
Useful in monitoring live web applications
Pulls telemetry information such as performance counters, Azure
diagnostics etc
Supports .Net, NodeJs and J2EE
Supports apps deployed on-premises or in the cloud
Very minimal impact on app performance as tracking calls are non-
blocking, batched and sent in separate thread
Application Insights
Application Insights is aimed at the development team, to help you understand how your app is performing and how it's being used. It monitors:
Request rates, response times, and failure rates
Dependency rates, response times, and failure rates
Exceptions
Page views and load performance
AJAX calls
User and session counts.
Performance counters
Host diagnostics from Docker or Azure.
Diagnostic trace logs
Custom events and metrics
Application Insights
Application Insights
Scaling Web Apps
Two options:
Scale Up – Increase the VM size by getting more CPU, memory, disk space etc. Can be done by changing the pricing tier of the app service plan.
Scale Out – Increase the number of instances up to a maximum of 20 instances. Application. Can be done manually or automatically based on metrics like CPU percentage and memory utilization
Further, an App Service Plan can be scaled to accommodate-
Changes in Pricing Tier
Changes in Instance Size
Changes in Instance Count
Auto Scaling Web Apps
Auto Scaling Web Apps
Allowed Metrics: Allowed Operations:
Azure Traffic Manager
Load balance among app instances deployed across regions
Uses the following algorithms
Performance (Fastest)
Weighted (Round-robin)
Priority (Failover)
DNS based load balancer where clients connect directly to the endpoints
Traffic manager is resilient to failures including the failure of entire Azure
Region
Benefits include traffic distribution and endpoint health monitoring
Traffic Manager is not a proxy or a gateway
Azure CDN
Secure, reliable content delivery with global reach
Publicly available objects can be cached like images, style sheets, documents, files, html pages and client side scripts
CDN can also be utilized for serving dynamic content like PDF reports based on user inputs
Results in low latency and faster content delivery in comparison to the content delivery from data center where application is hosted
Helpful in reduction in application load resulting in improved application performance and scalability.
Helpful in bringing costs of content delivery down
Works with Azure blob storage, web apps, virtual machine, application folder, or other HTTP/HTTPS location
Azure CDN
Azure CDN POP Locations
Web App Backup
Create app backups manually or on schedule
Backups can be restored to a snapshot of a previous state by overwriting
existing app or restoring to another app
App Service can backup the following information to an Azure storage
account and container that you have configured your app to use.
App configuration
File content
Database connected to your app
Supported in Standard and Premium tiers
Backups can be up to 10 GB of size including app and database content
Web App Cloning
Clone existing apps to a newly created app
New app can be in same region or different region
Supported only in premium tier
Following settings are not copied in to the new app:
Azure Traffic Manager settings and Auto Scale Settings
Backup schedule settings
VNET settings
App Insights
Kudu Extension
Database Content
App Service Migration Assistant
http://movemetothecloud.net
Migrate web sites from Windows and Linux servers to Azure app service
Tool creates web app + database on Azure, if required
Supports Windows Server 2003 onwards
App Service Environment
Premium service plan option of Azure App Service
Provides a fully isolated and dedicated environment for securely running
Azure App Service apps at high scale
Ideal for application workloads requiring:
Very high scale
Isolation and secure network access
ASEs can be created within a single Azure region or span across multiple
regions making it idle for horizontal scaling
Isolated for a single customer’s applications
Always deployed in a VNet
Hybrid Connections
Based on Azure Biztalk Services
Easy and convenient way to connect the app service to on premises
resources behind firewall
VNET Integration
Allows to place Azure web apps in a non-internet route-able network
having controlled access
App Service Environment is deployed into VNET
VNET Integration gives web app access to resources in virtual network but
does not grant private access to web app from the virtual network
Private site access is only available with an ASE configured with an Internal
Load Balancer (ILB)
Use case includes connecting Azure web app to a database or a web
service running on a virtual machine in Azure Virtual Network.
Part of standard or Premium tier
Supports TCP and UDP
VNET Integration
Performance Test
Performance test web apps for free in the Azure Portal
These tests simulate user load on the app over a specific time period
Measures app's response
Testing in Production
Live-testing web app using live customer traffic
Traffic Routing – A portion of live user traffic is directed to different
deployment slots and then the app data is analyzed using App Insights or
any other tools
Supported in Standard or Premium tier
Testing requires cookies to be enabled in user’s browser
Supports advanced TiP scenarios through Powershell cmdlets
Testing in Production
Demo
Top Related