Prev Next

Java / Azure App Service Interview questions

Last updated

1. What is Azure App Service? 2. What types of applications can you host on Azure App Service? 3. What is an App Service plan? 4. What are the pricing tiers available for App Service plans? 5. Which runtime stacks does Azure App Service support? 6. What are deployment slots in Azure App Service? 7. How do you deploy code to Azure App Service? 8. What is the difference between scale up and scale out? 9. How do you configure autoscale in Azure App Service? 10. How do you configure application settings in Azure App Service? 11. What is the Always On setting in App Service? 12. What are WebJobs in Azure App Service? 13. How do you map a custom domain to an App Service app? 14. How do you enable HTTPS for an App Service app? 15. What is App Service Authentication (Easy Auth)? 16. What is Kudu in Azure App Service? 17. How do you view application logs in Azure App Service? 18. How do you enable Application Insights for an App Service app? 19. What is a managed identity in Azure App Service? 20. What is Web App for Containers? 21. What are the limitations of the Free and Shared tiers? 22. How do you configure CORS in Azure App Service? 23. What is the difference between App Service and Azure Functions? 24. When would you choose App Service over AKS or virtual machines? 25. What happens when you swap deployment slots? 26. What are slot settings and why are they sticky? 27. How does traffic routing between deployment slots work? 28. How do multiple apps share resources in one App Service plan? 29. How can you avoid cold starts in Azure App Service? 30. How does App Service health check work? 31. How does regional VNet integration work in App Service? 32. What is the difference between VNet integration and private endpoints? 33. What is an App Service Environment and when should you use it? 34. How do access restrictions work in Azure App Service? 35. How do Key Vault references work in App Service? 36. What is the difference between autoscale and automatic scaling? 37. What is per-app scaling in an App Service plan? 38. How do you troubleshoot HTTP 502 and 503 errors in App Service? 39. How do you troubleshoot high CPU or memory usage in App Service? 40. How do you set up CI/CD to App Service with GitHub Actions? 41. What is Run From Package in Azure App Service? 42. Explain the request flow inside Azure App Service? 43. How do you achieve zero-downtime deployments in App Service? 44. What is the difference between Windows and Linux App Service plans? 45. How can you optimize App Service costs? 46. How does backup and restore work in Azure App Service? 47. How do you make an App Service app highly available? 48. How do you secure App Service behind Azure Front Door? 49. How do you debug a live App Service app? 50. How do you migrate an on-premises web app to App Service?

1. What is Azure App Service?

Azure App Service is a fully managed platform-as-a-service (PaaS) for hosting web apps, REST APIs, and mobile backends. You supply the code or a container image, and Azure takes care of the operating system, patching, load balancing, and capacity.

It runs .NET, Java, Node.js, Python, and PHP on Windows or Linux, and ships with deployment slots, autoscale, custom domains, TLS certificates, and CI/CD integration out of the box.

Billing is based on the compute you reserve in an App Service plan, not per app.

Take quiz
Which service model does Azure App Service follow?
IaaS, where you patch the guest OS yourself
Colocation hardware managed by your team
PaaS, where Azure manages the OS and runtime patching
SaaS, a finished product you only configure
Who applies operating system patches to an App Service app's hosts?
The NuGet or npm packages in the app
You, through scheduled maintenance windows
The CI/CD pipeline that deploys the app
The Azure platform

2. What types of applications can you host on Azure App Service?

App Service is built for HTTP-based workloads. The common types are:

  • Web apps such as ASP.NET, Spring Boot, Express, Django, or Laravel sites
  • REST and GraphQL APIs consumed by SPAs, mobile apps, or other services
  • Background jobs through WebJobs running alongside the app
  • Custom containers built from your own Docker image
  • Azure Functions, when you pick the Dedicated (App Service) hosting plan

It is not the right place for workloads that need arbitrary inbound TCP or UDP ports, because only HTTP (80) and HTTPS (443) are exposed publicly.

Take quiz
Which workload is a natural fit for App Service?
A bare-metal GPU training cluster
An Active Directory domain controller
A UDP game server on custom ports
An ASP.NET Core REST API
Which inbound ports does App Service expose to the public internet?
80 for HTTP and 443 for HTTPS
Only 21 and 25
Any TCP port opened by the app
Ports 1 to 65535 over UDP

3. What is an App Service plan?

An App Service plan is the set of compute resources that runs one or more apps. It defines the region, operating system, VM size, number of instances, and pricing tier.

Every app in the plan runs on every instance of that plan, so apps share CPU, memory, and disk. The plan, not the app, is what you are billed for, even if an app inside it is stopped.

Plan setting What it controls
Region Datacenter where the VMs run
Operating system Windows or Linux workers
Size CPU cores and memory per instance (for example P1v3)
Instance count How many VMs the apps run on
Pricing tier Feature set such as slots, autoscale, and VNet support

Take quiz
What does an App Service plan define?
Region, OS, VM size, instance count, and pricing tier
The DNS zone for custom domains
The Git branch used for deployment
The language runtime of each app
You stop one app inside a plan. What happens to the plan's bill?
Billing pauses for the whole plan
Charges continue because the instances stay allocated
Billing becomes per-request
Billing drops by one fifth per stopped app

4. What are the pricing tiers available for App Service plans?

App Service offers five main tier families, from shared development tiers up to a fully isolated environment. Higher tiers add instances, slots, networking features, and performance.

Tier Compute Highlights
Free (F1) / Shared (D1) Shared VMs Dev and test only, CPU quotas, no SLA
Basic (B1-B3) Dedicated Manual scale, up to 3 instances, custom domains and TLS
Standard (S1-S3) Dedicated Autoscale, 5 deployment slots, up to 10 instances
Premium (v3 and newer) Dedicated 20 slots, up to 30 instances, zone redundancy, faster hardware
Isolated v2 Single-tenant ASE Private networking, up to 100 instances per plan, compliance workloads

Limits change over time, so confirm numbers on the current pricing page before sizing.

Take quiz
Which is the lowest tier that supports both autoscale and deployment slots?
Free (F1)
Standard
Shared (D1)
Basic
Which tier family runs inside a single-tenant App Service Environment?
Basic
Standard
Isolated v2
Premium v3

5. Which runtime stacks does Azure App Service support?

App Service supports .NET, Java, Node.js, Python, and PHP on Linux, plus Ruby on Linux and ASP.NET (.NET Framework 4.x) on Windows. Java comes in flavors for Java SE, Tomcat, and JBoss EAP.

If your stack is not covered, bring a custom container and run anything that serves HTTP. Supported versions change as languages reach end of life, so list the current ones from the CLI instead of memorizing them:

az webapp list-runtimes --os linux
az webapp list-runtimes --os windows

Take quiz
Which command lists the runtimes available for Linux apps?
az webapp stack get --linux
az appservice plan show --runtimes
az webapp list-runtimes --os linux
az webapp config runtimes --list-all
Which stack is available only on Windows App Service, not Linux?
Ruby
Python
Node.js
ASP.NET on .NET Framework 4.x

6. What are deployment slots in Azure App Service?

A deployment slot is a live app instance with its own hostname that runs in the same App Service plan as your production app. Typical examples are staging and qa.

You deploy and test a new build in a slot, then swap it into production after warm-up. The swap just changes routing, so users see no downtime, and if something breaks you can swap back to roll the change out.

Slots share the plan's compute, so a busy staging slot can slow down production. The number of slots depends on the tier.

Take quiz
What is a deployment slot?
A separate App Service plan per environment
A reserved storage partition for backups
A maintenance window for platform updates
A live app with its own hostname that shares the plan's compute
Why deploy to a staging slot before production?
To validate and warm up the build before swapping it in
To double the plan's CPU quota
To avoid configuring app settings
To bypass the HTTPS requirement

7. How do you deploy code to Azure App Service?

You can push a ZIP, WAR, or JAR package with the CLI, or wire up a pipeline. The main options are:

  • CI/CD with GitHub Actions or Azure Pipelines (recommended for repeatable releases)
  • ZIP or WAR deploy through az webapp deploy or the Kudu API
  • IDE publish from Visual Studio or VS Code
  • Local Git or FTPS for small or legacy setups
  • Container images pulled from Azure Container Registry or Docker Hub
az webapp deploy --resource-group my-rg --name my-app --src-path app.zip --type zip

Take quiz
Which command uploads a ZIP package to an App Service app?
az webapp deploy --type zip
az webapp config set --zip app.zip
az webapp restart --src-path app.zip
az appservice plan deploy --zip
Which approach is best for repeatable, automated releases?
Copying files over remote desktop
A CI/CD pipeline such as GitHub Actions or Azure Pipelines
Manual FTP uploads from a laptop
Editing files in the Kudu console

8. What is the difference between scale up and scale out?

Scale up changes the size or tier of each instance (vertical scaling). Scale out changes how many instances run your app (horizontal scaling).

Scale up Scale out
What changes VM size or pricing tier Instance count
Example P1v3 to P2v3 2 instances to 5
Downtime Brief restart possible None, new instances join the load balancer
Best for Memory-hungry or CPU-bound single requests Handling more concurrent traffic
Automation Manual Manual or autoscale

Scale out is usually preferred for web workloads because it also improves availability.

Take quiz
Moving a plan from P1v3 to P2v3 is an example of what?
Scale in
Scale up
Scale out
Multi-region failover
Which action adds more instances behind the load balancer?
Switching from Linux to Windows
Scale up
Scale out
Changing the runtime stack

9. How do you configure autoscale in Azure App Service?

Autoscale lives under Scale out (App Service plan) and is powered by Azure Monitor. You pick a custom autoscale condition, set minimum, maximum, and default instance counts, then add rules.

A rule pairs a metric with a threshold and an action, for example: if average CPU is above 70% for 10 minutes, add 1 instance. Always pair a scale-out rule with a scale-in rule, and use a cooldown so the plan does not flap.

You can also scale on a schedule, such as more instances during business hours. Autoscale needs the Standard tier or higher.

Take quiz
Which autoscale setting stops the plan from growing without limit?
Health check path
Cooldown period
Maximum instance count
Default instance count
Besides metrics, what else can trigger autoscale changes?
The count of deployment slots
The app's runtime version
The number of Git commits
A schedule such as business-hours scaling

10. How do you configure application settings in Azure App Service?

Open Settings > Environment variables (formerly Configuration) and add name/value pairs under App settings or Connection strings. They are encrypted at rest and injected into your app as environment variables.

They override matching values in appsettings.json or web.config, which keeps secrets out of source control. Tick Deployment slot setting to pin a value to one slot.

On Linux, nested keys use a double underscore because colons are not valid in variable names:

az webapp config appsettings set -g my-rg -n my-app \
  --settings "Logging__LogLevel__Default=Warning" "FEATURE_X=on"

Take quiz
On Linux, how do you set the nested key Logging:LogLevel:Default?
Logging.LogLevel.Default
Logging->LogLevel->Default
Logging/LogLevel/Default
Logging__LogLevel__Default
How do app settings reach your code at runtime?
As environment variables
Through a separate config API your app must call
As files committed to your repository
Only through the Kudu console

11. What is the Always On setting in App Service?

Always On keeps the app loaded by sending a request to the site root regularly. Without it, an app with no traffic is unloaded after roughly 20 minutes, and the next visitor pays for a cold start.

It is available from the Basic tier upward and is not offered on Free or Shared. Turn it on for production sites, and it is required for continuous WebJobs and any in-process timers that must keep running.

Take quiz
What happens to an idle app when Always On is off?
It is unloaded after about 20 minutes, so the next request hits a cold start
The app moves to the Free tier
The plan scales out to two instances
The app is deleted from the plan
Which workload depends on Always On to keep running?
Key Vault secret rotation
Continuous WebJobs
Slot swap with preview
Custom domain validation

12. What are WebJobs in Azure App Service?

WebJobs run scripts or programs in the same sandbox as your web app, which is handy for background work such as queue processing, report generation, or cleanup. Supported file types include .exe, .cmd, .ps1, .sh, .py, .js, and .php.

Continuous Triggered
Starts when the app starts and keeps running Runs on demand or on a CRON schedule
Needs Always On Does not need Always On
Scales out with each instance Runs on a single instance
Deployed under App_Data/jobs/continuous Deployed under App_Data/jobs/triggered

For new event-driven code, Azure Functions is often the better choice.

Take quiz
Which WebJob type starts with the app and keeps running?
Manual-only
Continuous
Triggered
Deferred
Where do WebJob files live under the site?
site/deployments/jobs/{type}
home/LogFiles/webjobs
site/wwwroot/App_Data/jobs/{type}/{job-name}
site/logs/jobs/{job-name}

13. How do you map a custom domain to an App Service app?

Add the domain under Settings > Custom domains, create the DNS records Azure shows you, then validate and bind a certificate.

  1. Use a paid or Shared tier (Free does not allow custom domains).
  2. For a subdomain such as www, create a CNAME pointing to <app>.azurewebsites.net.
  3. For an apex domain, create an A record to the app's IP address.
  4. Add a TXT record named asuid containing the app's custom domain verification ID.
  5. Select Validate, then Add, and bind a TLS certificate.
Take quiz
Which DNS records prove ownership of an apex domain?
Only an MX record
A PTR record on the app's IP
An A record plus a TXT record holding the domain verification ID
An SRV record for port 443
Which record normally maps www.contoso.com to the app?
An MX record for the mail server
An NS record pointing at Azure Monitor
A TXT record with no other entries
A CNAME to the app's azurewebsites.net hostname

14. How do you enable HTTPS for an App Service app?

The default *.azurewebsites.net hostname already has a valid certificate. For a custom domain you need your own certificate and a TLS binding.

Certificate options are a free App Service Managed Certificate (no wildcards), a purchased App Service Certificate, a certificate imported from Key Vault, or an uploaded .pfx file.

After binding, switch on HTTPS Only so HTTP requests are redirected, and set the minimum TLS version to 1.2 or higher.

Take quiz
Which setting redirects all HTTP requests to HTTPS?
Client certificate mode
ARR affinity
Always On
HTTPS Only
What does an SNI SSL binding allow?
Several domains with different certificates sharing one IP address
Only one certificate per plan
Disabling TLS for health checks
Skipping domain validation

15. What is App Service Authentication (Easy Auth)?

Easy Auth is a built-in authentication module that sits in front of your app, so sign-in works without writing auth code. It supports Microsoft Entra ID, Google, Facebook, GitHub, Apple, X, and any OpenID Connect provider.

You choose whether unauthenticated requests are allowed or redirected to login. After sign-in, the platform passes the user's identity to your code in headers such as X-MS-CLIENT-PRINCIPAL, and exposes endpoints like /.auth/login/<provider>.

It handles sign-in only. Authorization rules, like which roles can call an endpoint, still belong in your app.

Take quiz
Which header carries the signed-in user's identity to your app?
X-MS-CLIENT-PRINCIPAL
X-Original-URL
X-Azure-FDID
X-ARR-SSL
Where does Easy Auth authentication run?
In Azure Front Door
In a platform module outside your application code
Inside your Startup class only
In the client's browser

16. What is Kudu in Azure App Service?

Kudu is the engine behind deployments and diagnostics for App Service. It runs as a separate site at https://<app>.scm.azurewebsites.net, sometimes called the SCM site.

From there you get a debug console (CMD or PowerShell, plus SSH on Linux), a process explorer, environment variables, deployment logs, a WebJobs dashboard, site extensions, and a ZIP deploy API.

Because it exposes file and process access, lock it down with its own access restrictions and Entra sign-in.

Take quiz
What is the URL pattern of the Kudu site?
https://portal.azure.com/kudu/<app>
https://<app>.scm.azurewebsites.net
https://<app>.kudu.azure.com
https://<app>.azurewebsites.net/kudu
What is Kudu mainly used for?
Provisioning the underlying scale set
Editing DNS zones
Inspecting files, environment, processes, and deployment logs
Managing the subscription's billing

17. How do you view application logs in Azure App Service?

Turn on logging under Monitoring > App Service logs, then watch it live in Log stream or from the CLI.

Application logging can write to the file system (temporary, about 12 hours) or to Blob storage. You can also enable web server logs, detailed error messages, and failed request tracing on Windows.

For long-term search, add a diagnostic setting that sends AppServiceHTTPLogs, AppServiceConsoleLogs, and AppServiceAppLogs to a Log Analytics workspace and query them with KQL.

az webapp log config -g my-rg -n my-app --application-logging filesystem --level information
az webapp log tail -g my-rg -n my-app

Take quiz
Which command streams logs live from an app?
az appservice log watch
az monitor log stream --app
az webapp log tail
az webapp trace --follow
Where should logs go for long-term KQL queries?
The wwwroot folder
The ARR affinity cookie
A deployment slot
A Log Analytics workspace through diagnostic settings

18. How do you enable Application Insights for an App Service app?

Open Monitoring > Application Insights on the app, choose Enable, and pick or create a workspace-based resource. For .NET, Java, Node.js, and Python this turns on auto-instrumentation with no code change, though some runtimes support only parts of it.

For more control, add the Azure Monitor OpenTelemetry distro or the SDK to your code and supply the connection string through the APPLICATIONINSIGHTS_CONNECTION_STRING app setting.

You then get request rates, dependency calls, exceptions, Live Metrics, and the Application Map.

Take quiz
Which app setting holds the Application Insights connection string?
WEBSITE_AI_ENDPOINT
AZURE_MONITOR_KEY
APPINSIGHTS_VAULT_URI
APPLICATIONINSIGHTS_CONNECTION_STRING
Which Application Insights view shows failing calls between components?
Application Map
Scale out blade
Kudu process explorer
Slot swap preview

19. What is a managed identity in Azure App Service?

A managed identity is an Entra ID identity that Azure creates and rotates for your app, so the app can call Key Vault, Storage, SQL, or Service Bus without any stored password or secret.

System-assigned User-assigned
Lifecycle Tied to the app, deleted with it Separate resource you manage
Sharing One app only Reusable across many apps
Typical use Simple single-app access Shared access or pre-provisioned roles

Grant the identity an Azure RBAC role on the target resource, then use DefaultAzureCredential in code:

var client = new SecretClient(
    new Uri("https://my-vault.vault.azure.net/"),
    new DefaultAzureCredential());

Take quiz
Which identity type is deleted automatically when the app is deleted?
System-assigned
A service principal with a client secret
User-assigned
An Entra guest user
Which SDK class picks up a managed identity automatically?
ConnectionStringBuilder
DefaultAzureCredential
SasTokenProvider
BasicAuthHandler

20. What is Web App for Containers?

Web App for Containers runs your own Docker image on App Service, with the same plan, scaling, slots, and domain features as code-based apps. Images can come from Azure Container Registry, Docker Hub, or another private registry.

Your container must listen on an HTTP port. App Service detects an exposed port, or you can set it explicitly with the WEBSITES_PORT app setting. Using managed identity to pull from ACR avoids storing registry credentials.

Container logs are available through Log stream and Kudu, and persistent storage can be mounted under /home.

Take quiz
Which app setting tells App Service which port the container listens on?
APP_PORT_MAPPING
WEBSITES_PORT
DOCKER_EXPOSE_HTTP
CONTAINER_LISTEN_PORT
Where can App Service pull a private image from?
Only from the app's wwwroot folder
Only from public Docker Hub
Azure Container Registry using a managed identity or credentials
Only from a Git repository

21. What are the limitations of the Free and Shared tiers?

Free (F1) and Shared (D1) run on shared VMs with daily CPU quotas. Once you use the quota, the app is stopped until the quota resets.

Limit Free (F1) Shared (D1)
CPU quota 60 minutes per day 240 minutes per day
Custom domain Not supported Supported
Custom TLS binding No No
Scale out No No
Always On and slots No No
SLA None None

Use them for learning and quick tests, not for production.

Take quiz
What is the daily CPU quota of the Free F1 tier?
240 minutes
8 hours
60 minutes
Unlimited
Which features are unavailable on the Free and Shared tiers?
HTTP endpoints
Application settings
ZIP deployment
Always On and deployment slots

22. How do you configure CORS in Azure App Service?

Open API > CORS on the app and list the allowed origins, such as https://contoso.com. You can also tick Enable Access-Control-Allow-Credentials if cookies or auth headers must be sent.

Avoid mixing this with CORS code in your app. When both are present, the platform setting takes precedence and your code's headers have no effect, which makes debugging confusing. Pick one place.

az webapp cors add -g my-rg -n my-app --allowed-origins https://contoso.com

Take quiz
What happens if you configure both platform CORS and app-level CORS code?
Your code overrides the platform
CORS is disabled for the whole plan
Both sets of headers are merged
The platform setting takes precedence over your code
Which command adds an allowed origin from the CLI?
az webapp cors add
az appservice cors set
az webapp config cors --origin
az webapp allow-origin

23. What is the difference between App Service and Azure Functions?

App Service hosts whole applications that stay running on reserved compute. Azure Functions hosts small event-triggered units of code and can scale to zero.

App Service Azure Functions
Unit of deployment Web app or API One or more functions
Trigger HTTP requests HTTP, timer, queue, Event Hubs, Blob, and more
Scaling Plan-based or autoscale Event-driven (Consumption, Flex Consumption, Premium)
Billing Per plan, even when idle Per execution on Consumption plans
Best for Steady web traffic, full frameworks Spiky, event-driven, short tasks

Functions can also run on an App Service plan if you want predictable cost and no cold starts.

Take quiz
Which option best fits short event-driven code billed per execution?
Azure Functions on a Consumption-style plan
A continuous WebJob
An App Service Environment
App Service Free tier
Can Azure Functions run on an App Service plan?
Only on the Free tier
Yes, through the Dedicated hosting option
No, they require AKS
Only inside a deployment slot

24. When would you choose App Service over AKS or virtual machines?

Choose App Service when you have a standard web app or API and want the platform to handle patching, scaling, TLS, and deployments, so your team spends time on code instead of infrastructure.

App Service AKS VMs
Ops effort Low High (cluster upgrades, networking) Highest (OS, patching, scaling)
Control Limited to platform settings Full container orchestration Full OS access
Good for Web apps, APIs Many microservices, sidecars, custom operators Legacy software, custom drivers
Scaling Built-in HPA, cluster autoscaler Scale sets you build

Move to AKS when you outgrow the platform, for example needing service meshes or non-HTTP protocols.

Take quiz
Which option needs the least infrastructure work for a typical web API?
Virtual machines with an IIS install
App Service
A VM scale set with custom images
AKS
When does AKS beat App Service?
A single CRUD website with steady traffic
A static marketing page
Many microservices that need sidecars and Kubernetes-level control
A weekend demo app

25. What happens when you swap deployment slots?

A swap is a warm-up followed by a routing change, not a file copy. That is why it causes no downtime.

  1. App Service applies the target slot's settings (including slot-specific app settings) to the source slot and restarts its instances.
  2. It waits for each instance to restart. If any fails, the swap is cancelled and the slots revert.
  3. It sends warm-up requests, honoring applicationInitialization rules if you defined them.
  4. Once the source is warm, it swaps the routing rules. The source becomes production.
  5. The old production code now sits in the source slot, so you can swap back to roll back.
flowchart LR
  A["Deploy to staging"] --> B["Apply target slot settings"]
  B --> C["Restart and warm up source"]
  C --> D{All instances healthy?}
  D -- No --> E["Cancel swap and revert"]
  D -- Yes --> F["Swap routing rules"]
  F --> G["Old prod now in staging slot"]

Swap with preview lets you pause after step 1 to test the app with production settings before completing.

Take quiz
After a successful swap, where does the previous production code live?
It is deleted immediately
Nowhere, it is overwritten
In the source (staging) slot
In a backup storage account
What happens if an instance fails to restart during the swap?
The swap completes anyway
Production is restarted instead
Traffic is split 50/50
The swap is cancelled and the slots revert

26. What are slot settings and why are they sticky?

A slot setting (also called a sticky setting) stays with the slot during a swap instead of moving with the code. You mark an app setting or connection string as such with Deployment slot setting.

This lets production keep its production database string and staging keep its test one, no matter which build is running where.

Swapped with the code Not swapped (stays with slot)
Framework version, 32/64-bit, WebSockets Custom domain names
Non-sticky app settings and connection strings Settings marked as slot settings
Handler mappings, public certificates Non-public certificates and TLS bindings
WebJobs content Scale settings and Always On

Take quiz
Which item is NOT swapped between slots?
Non-sticky app settings
Framework version
WebJobs content
Custom domain names
How do you keep a database connection string with the staging slot?
Mark it as a deployment slot setting
Disable Always On
Store it in wwwroot
Turn on auto swap

27. How does traffic routing between deployment slots work?

Under Deployment slots you set a traffic percentage per slot, which sends that share of production traffic to a non-production slot. This is called testing in production, and is handy for canary releases.

Once a client is routed to a slot it stays there, through a x-ms-routing-name cookie. You can also force a route with ?x-ms-routing-name=staging in a link, or use self to return to production.

Ramp the percentage up while watching errors and latency, then do the final swap.

Take quiz
Which query parameter routes a request to a specific slot?
x-ms-routing-name
slot-route
x-azure-slot-target
x-ms-swap-to
What does setting staging to 10% mean?
Only 10% of the code is deployed
About 10% of production traffic goes to the staging slot
Staging gets 10% of the plan's CPU
Ten users are whitelisted

28. How do multiple apps share resources in one App Service plan?

Every app in a plan runs on every instance of that plan. With 3 instances and 5 apps, each app has a worker process on all 3 VMs, and they compete for the same CPU, memory, and disk.

This makes plans cost-efficient but exposes you to noisy neighbors: one leaky or CPU-heavy app can slow the rest. Deployment slots also count, since they run on the same instances.

Keep critical or heavy apps in their own plan, and watch the plan-level CPU and memory metrics, not just per-app ones.

Take quiz
A plan has 3 instances and 5 apps. Where does each app run?
Each app gets a dedicated instance
On all 3 instances
Only on instance 1 until it fills
Evenly split so no two apps share a VM
Why would you move a critical app to its own plan?
To skip TLS configuration
To get free deployment slots
To avoid noisy-neighbor contention
To raise the Free tier quota

29. How can you avoid cold starts in Azure App Service?

Cold starts happen after idle unload, a restart, a scale-out, or a deployment. Reduce them at both the platform and code level:

  • Enable Always On so the app is not unloaded when idle
  • Use slot swap so the new build is warm before it takes traffic
  • Define applicationInitialization in web.config to hit key URLs at startup
  • Use automatic scaling on Premium plans for pre-warmed instances
  • Cut startup work: ReadyToRun or AOT for .NET, lazy loading, fewer startup dependencies
  • Use Run From Package to shorten file-system access at startup

Configure Health check as well, so new instances only receive traffic once they respond properly.

Take quiz
Which web.config section warms specific URLs during startup?
rewrite
customHeaders
applicationInitialization
httpErrors
Which Premium capability reduces cold starts during scale-out?
Local Git deployment
Turning off HTTPS Only
Reducing the slot count
Pre-warmed instances with automatic scaling

30. How does App Service health check work?

You give App Service a health check path, such as /healthz. The platform pings it about every minute on each instance.

Any response from 200 to 299 counts as healthy. If an instance fails the configured number of consecutive pings (the load-balancing threshold, 2 to 10), it is removed from the load balancer rotation, but only when the plan has two or more instances.

If it stays unhealthy for about an hour, App Service replaces the instance with a new one. Make the endpoint check real dependencies such as the database, but keep it fast and cheap.

Take quiz
Which responses does health check treat as healthy?
Only exactly 200 OK
Only 204 No Content
Any code below 500
Status codes 200 to 299
What is required for an unhealthy instance to be taken out of rotation?
Two or more instances in the plan
Basic tier only
A staging slot
Application Insights enabled

31. How does regional VNet integration work in App Service?

Regional VNet integration lets your app make outbound calls into a virtual network, for example to a private database or an on-premises system over VPN. It does not make the app itself reachable from the VNet.

Setup needs a dedicated, empty subnet delegated to Microsoft.Web/serverFarms, one subnet per plan. A /26 is the usual recommendation so there is room to scale out.

By default only private (RFC 1918) traffic goes through the VNet. Enable route all (outbound internet traffic) if NSGs, UDRs, or a firewall must see everything, and set WEBSITE_DNS_SERVER when you need custom DNS.

Take quiz
Which direction of traffic does regional VNet integration handle?
Outbound traffic from the app
Both inbound and outbound
DNS queries only
Inbound traffic to the app
To which resource provider must the integration subnet be delegated?
Microsoft.Sql/servers
Microsoft.Web/serverFarms
Microsoft.Network/applicationGateways
Microsoft.ContainerService/managedClusters

32. What is the difference between VNet integration and private endpoints?

They solve opposite directions. VNet integration is outbound, letting the app reach private resources. A private endpoint is inbound, giving the app a private IP so clients in your network can reach it.

VNet integration Private endpoint
Direction App to VNet (outbound) VNet to app (inbound)
Gives the app Access to private resources A private IP and private DNS name
Public access Unchanged Can be disabled to block the internet
Subnet Dedicated delegated subnet Regular subnet with a NIC

Many secure designs use both: a private endpoint in front and VNet integration behind.

Take quiz
You want clients to reach the app only through a private IP. What do you use?
VNet integration
A private endpoint on the app
An Always On rule
A hybrid connection
The app must call a SQL database that has a private endpoint. What do you configure?
ARR affinity
Easy Auth
Regional VNet integration on the app
A deployment slot for SQL

33. What is an App Service Environment and when should you use it?

An App Service Environment (ASE v3) is a single-tenant deployment of App Service inside your own virtual network. Plans in it use the Isolated v2 tier and run on dedicated hardware.

It can be external (public VIP) or internal (private load balancer IP), so apps can be hidden from the internet completely. A plan scales to 100 instances, and an ASE to 200 across plans.

Use it for strict compliance or isolation needs, very high scale, or when all traffic must stay on a private network. For ordinary workloads, Premium plans with private endpoints are cheaper and simpler.

Take quiz
Which pricing tier do ASE v3 plans use?
Standard
Premium v3
Isolated v2
Basic
Which ASE mode keeps apps reachable only on a private IP?
Shared ASE
Hybrid ASE
External ASE
Internal load balancer (ILB) ASE

34. How do access restrictions work in Azure App Service?

Access restrictions are an ordered list of allow and deny rules evaluated by priority on inbound requests. A rule can match an IPv4 or IPv6 range, a VNet subnet (via service endpoint), or an Azure service tag.

You can also filter by HTTP headers, such as X-Forwarded-For or X-Azure-FDID, to accept traffic only from a particular proxy.

Once you add any allow rule, an implicit deny all applies to everything else. The Kudu (SCM) site has its own rule set unless you tell it to reuse the main site's rules.

Take quiz
After you add an allow rule, what happens to unmatched traffic?
It is queued for review
It is allowed by default
It is redirected to HTTPS
It is denied by the implicit deny-all rule
Do main site restrictions automatically protect the Kudu SCM site?
No, the SCM site has its own rules unless set to reuse the main ones
Only NSGs can restrict Kudu
Yes, always
Kudu cannot be restricted

35. How do Key Vault references work in App Service?

A Key Vault reference is an app setting value that points to a secret instead of containing it. App Service resolves it at runtime using the app's managed identity, so your code reads a plain environment variable.

@Microsoft.KeyVault(SecretUri=https://my-vault.vault.azure.net/secrets/DbPassword/)
@Microsoft.KeyVault(VaultName=my-vault;SecretName=DbPassword)

The identity needs the Key Vault Secrets User role (or an access policy with Get). If you leave out the secret version, the app picks up a rotated secret automatically, typically within a day. The portal shows a green check when a reference resolves.

Take quiz
Which RBAC role lets the identity read secret values from Key Vault?
Key Vault Secrets User
Key Vault Crypto Officer
Reader
Contributor
What happens if the secret reference omits the version and the secret rotates?
The app breaks until redeployed
The app picks up the new version automatically after a refresh
The old version is pinned forever
The secret is deleted

36. What is the difference between autoscale and automatic scaling?

Autoscale is rule-based and you define it. Automatic scaling is platform-managed and reacts to HTTP traffic with pre-warmed instances.

Autoscale Automatic scaling
Engine Azure Monitor rules App Service platform
You configure Metrics, thresholds, schedules Minimum always-ready and maximum burst instances
Warm instances No, new instances start cold Yes, pre-warmed instances
Tier Standard and above Premium v2/v3 and newer
Scale in Rules plus cooldown Handled by the platform

Use automatic scaling for spiky HTTP traffic and autoscale when you need schedules or non-HTTP metrics.

Take quiz
Which option scales on HTTP traffic with pre-warmed instances and no rules to write?
Scheduled autoscale profile
Automatic scaling
Manual scale out
Scale up
Which option relies on Azure Monitor metric rules you define?
Automatic scaling
Always On
Autoscale
Per-app scaling

37. What is per-app scaling in an App Service plan?

Per-app scaling sets a maximum number of plan instances that a given app may run on. Without it, every app runs on every instance of the plan.

It makes dense hosting practical: you scale the plan out to, say, 10 instances, then cap a low-traffic app at 2 and let a busy app use all 10. This keeps one app from consuming the whole plan.

You enable it on the plan, then set the number of workers on each app. Only apps that actually need more instances pay the resource cost.

Take quiz
What does per-app scaling cap?
The deployment slots per app
The storage quota per app
The number of plan instances an app can run on
The custom domains per app
Why would you use per-app scaling?
To disable autoscale
To reduce DNS latency
To avoid TLS bindings
To pack many apps into a plan without one app using every instance

38. How do you troubleshoot HTTP 502 and 503 errors in App Service?

Start with Diagnose and solve problems, then compare the logs against the usual causes.

Status Common causes
502 Bad Gateway App crashed, container listening on the wrong port, startup took longer than the allowed window
503 Service Unavailable App not started yet, recycling, Free/Shared quota exceeded, instance removed by health check, resource exhaustion

Then work through these checks:

  1. Open Log stream and Kudu for startup errors.
  2. On Linux containers, confirm the port matches WEBSITES_PORT and watch WEBSITES_CONTAINER_START_TIME_LIMIT.
  3. Check CPU and memory metrics for exhaustion before a restart.
  4. Review recent deployments, swaps, and app setting changes.
  5. Look at Application Insights failures and dependency timeouts.
Take quiz
A Linux container app returns 502 right after start. What is a likely cause?
A missing custom domain
Too many deployment slots
ARR affinity being disabled
The container's listening port does not match WEBSITES_PORT
Which portal tool offers automated detectors for downtime and CPU problems?
Diagnose and solve problems
Scale out
Deployment Center
Properties

39. How do you troubleshoot high CPU or memory usage in App Service?

First find which process and which code path is hot, then decide between a code fix and more capacity.

  1. Check plan-level CPU Percentage and Memory Percentage to see whether another app in the plan is the culprit.
  2. Open Diagnose and solve problems and run the CPU or memory analysis detectors.
  3. Use Kudu's process explorer to see which worker process is consuming resources.
  4. Capture a profile (Application Insights Profiler) or a memory dump and look for leaks or hot loops.
  5. Use Auto-Heal on Windows to recycle automatically on memory or slow-request thresholds while you fix the root cause.
  6. Only after that, scale up or out if the load is legitimate.
Take quiz
Which Windows feature can recycle the app automatically on a memory threshold?
Auto-Heal
Always On
ARR affinity
Slot swap
What should you do before scaling up for high CPU?
Delete the App Service plan
Identify the hot process and code path with diagnostics or a profiler
Add more deployment slots
Disable HTTPS Only

40. How do you set up CI/CD to App Service with GitHub Actions?

Open Deployment Center, select GitHub, and App Service commits a workflow file to your repo. The workflow builds your code and deploys it with the azure/webapps-deploy action.

For authentication, prefer OIDC federated credentials through azure/login, so no long-lived secret is stored. A downloaded publish profile also works but relies on basic authentication, which is weaker.

- uses: azure/login@v2
  with:
    client-id: ${{ secrets.AZURE_CLIENT_ID }}
    tenant-id: ${{ secrets.AZURE_TENANT_ID }}
    subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- uses: azure/webapps-deploy@v3
  with:
    app-name: my-app
    slot-name: staging
    package: ./publish

Deploy to a staging slot first, run smoke tests, then swap.

Take quiz
Which GitHub Action deploys a package to App Service?
azure/kudu-sync
azure/webapps-deploy
azure/app-service-push
actions/deploy-azure-web
What is a more secure alternative to storing a publish profile secret?
Committing the profile to the repo
Disabling authentication on Kudu
OIDC federated credentials with azure/login
Sharing the FTP password in the README

41. What is Run From Package in Azure App Service?

Run From Package mounts a ZIP file as the read-only wwwroot instead of unpacking files onto disk. You enable it with the app setting WEBSITE_RUN_FROM_PACKAGE.

Setting it to 1 runs the package that ZIP deploy uploaded. Setting it to a URL, such as a blob with a SAS token or managed identity access, runs the package from there.

Benefits are atomic deployments (no half-copied files), no file lock conflicts, and often faster cold starts for apps with many files. The catch is that wwwroot becomes read-only, so write runtime files to /home or Azure Storage.

Take quiz
What happens to wwwroot when Run From Package is enabled?
It is encrypted per user
It is replicated to every region
It becomes read-only
It is deleted on each request
What value makes WEBSITE_RUN_FROM_PACKAGE use a package stored in Blob storage?
false
0
blob
The package's URL

42. Explain the request flow inside Azure App Service?

A request passes through a few platform roles before it reaches your code. Front ends act as load balancers and TLS terminators, workers are the VMs running your app, and a shared file storage layer holds site content.

sequenceDiagram
  participant C as Client
  participant D as DNS
  participant F as Front end (load balancer)
  participant W as Worker instance
  participant S as Shared storage (/home)
  C->>D: Resolve app.azurewebsites.net
  D-->>C: Front end IP
  C->>F: HTTPS request
  F->>F: TLS termination, access restrictions, Easy Auth
  F->>W: Route to an instance (ARR affinity optional)
  W->>S: Read site content on startup
  W-->>F: App response
  F-->>C: HTTPS response

The front end applies access restrictions and routes to a healthy worker, honoring the ARR affinity cookie when it is on. The worker runs your process (IIS on Windows, a container on Linux). Content under /home is network storage shared by all instances, while D:\local is temporary per-instance disk.

Take quiz
Which role terminates TLS and routes requests to workers?
A deployment slot
The Kudu site
The shared file storage
The front end load balancer
Where is the /home content persisted?
On shared network storage mounted on all instances
In Key Vault
In Azure Cosmos DB
On each worker's temp disk only

43. How do you achieve zero-downtime deployments in App Service?

Combine deployment slots, warm-up, and backward-compatible data changes.

  1. Deploy the new build to a staging slot on the same plan.
  2. Mark environment-specific settings as slot settings so they stay put.
  3. Add applicationInitialization or a health endpoint so the slot is warm before the swap.
  4. Run smoke tests against the staging URL, optionally routing a small share of traffic first.
  5. Swap into production. If something breaks, swap back immediately.

The database is the usual trap. Use the expand and contract pattern: add new columns first, ship code that works with both schemas, then remove old columns in a later release. Running at least two instances also prevents a restart from taking the site down.

Take quiz
Which database change is safest during a slot swap?
An additive, backward-compatible schema change
Dropping the old column first
Renaming a table in place
Truncating the table before swapping
What is the fastest way to roll back a bad release?
Delete and recreate the app
Swap the slots again
Restore last week's backup
Rebuild the plan from scratch

44. What is the difference between Windows and Linux App Service plans?

The operating system decides how your app is hosted: Windows uses IIS, Linux runs your code inside a container managed by the platform. A single plan can only hold one OS, so you cannot mix them.

Windows Linux
Hosting IIS worker process Container (built-in or custom image)
Exclusive stacks ASP.NET (.NET Framework 4.x) Python, Ruby, and most open-source stacks
File paths Case-insensitive, D:\home Case-sensitive, /home
Startup control web.config Startup command or Dockerfile
Typical cost Higher on lower tiers Often cheaper

Choose by stack: legacy .NET Framework needs Windows, almost everything else runs well on Linux.

Take quiz
Can one App Service plan host both Windows and Linux apps?
Yes, on any paid tier
No, a plan supports a single operating system
Yes, but only on Premium
Yes, if Always On is enabled
Which operating system treats file paths as case-sensitive by default?
Both treat them as case-insensitive
Windows
Linux
Neither, paths are normalized

45. How can you optimize App Service costs?

Cost follows the plan's size and instance count, so most savings come from right-sizing and consolidating.

  • Right-size the tier using CPU and memory metrics, and avoid paying for Premium features you do not use
  • Put several small apps in one plan instead of one plan per app
  • Use autoscale with scale-in rules, and schedule scale-downs for off-hours in non-production
  • Buy reserved instances or an Azure savings plan for steady 24x7 workloads
  • Use lower tiers or Linux plans for dev and test, and delete unused plans (stopped apps still cost money)
  • Trim diagnostic log volume in Log Analytics
Take quiz
What lowers cost for steady 24x7 production workloads?
Over-provisioning to avoid autoscale
Adding more deployment slots
Reserved instances or a savings plan
Restarting apps nightly
Which step cuts non-production spend?
Adding more instances
Enabling verbose logging
Upgrading to Isolated v2
Scaling plans down on a schedule or deleting them off-hours

46. How does backup and restore work in Azure App Service?

Backup saves a snapshot of the app to an Azure Storage account you choose. It is available on paid tiers, with details depending on the tier.

A backup can include:

  • App configuration and settings
  • File content from the app (you can exclude folders)
  • A linked database, such as Azure SQL, MySQL, or PostgreSQL

Backups have a size cap of around 10 GB for content and database combined, so large sites need another strategy. You can restore over the same app, to a new app, or to a slot, and choose whether to restore the database.

Treat backup as a safety net. Source control plus CI/CD is still the primary way to recreate an app.

Take quiz
Where are custom App Service backups stored?
In Key Vault
On the worker's local disk
In Application Insights
In an Azure Storage account container you choose
What can an App Service backup contain?
App configuration, file content, and optionally a linked database
The underlying OS image
The whole Azure subscription
Only the app settings

47. How do you make an App Service app highly available?

High availability is built in layers, from instance redundancy up to multiple regions.

  1. Multiple instances: run at least two so one failure or platform update does not take you down.
  2. Health check: remove bad instances from rotation automatically.
  3. Zone redundancy: on supported Premium plans, spread instances across availability zones in the region.
  4. Multi-region: deploy the app to two regions and put Azure Front Door or Traffic Manager in front.
  5. Data tier: use geo-replication (Azure SQL failover groups, Cosmos DB multi-region) so the second region has data.
  6. Deploy to both regions from the same pipeline so they stay identical.

Paid tiers carry an SLA, so pick the topology to match your recovery targets.

Take quiz
Which feature spreads instances across datacenters within a region?
Zone redundancy
Deployment slots
Always On
Per-app scaling
Which service can route global traffic between two regional apps?
Kudu
Azure Front Door
Azure Bastion
Azure Backup

48. How do you secure App Service behind Azure Front Door?

Front Door sits at the edge, so you must make sure clients cannot bypass it and hit the azurewebsites.net hostname directly.

  1. Add an access restriction allowing the AzureFrontDoor.Backend service tag.
  2. Add a header filter on X-Azure-FDID equal to your Front Door profile ID.
  3. Lock down the Kudu SCM site the same way.
  4. Or, for stronger isolation, use Front Door Premium with Private Link to a private endpoint on the app and disable public access.

The header check matters because the service tag covers every Front Door customer, not just you. Put the WAF policy on Front Door, and keep the host header handling consistent so redirects and cookies work.

Take quiz
Why check the X-Azure-FDID header in addition to the service tag?
It selects the region
The tag covers all Front Door customers, so the header limits access to your profile
It encrypts traffic between the edge and the app
It enables Always On
Which Front Door tier supports Private Link origins for App Service?
Classic
Standard
Premium
None of the tiers

49. How do you debug a live App Service app?

Prefer non-intrusive tools first and use a debugger only when you must.

  • Log stream and az webapp log tail for quick runtime output
  • Application Insights for exceptions, traces, Live Metrics, and the Snapshot Debugger
  • Kudu console or SSH (Linux) to inspect files, processes, and environment variables
  • Remote debugging from Visual Studio or VS Code, which attaches a debugger to the running worker

Remote debugging pauses request threads, so avoid it on a busy production instance. Use a staging slot instead. It also switches off automatically after 48 hours so it is not left on by accident.

Take quiz
After how long does remote debugging turn itself off in App Service?
1 hour
It never turns off
48 hours
7 days
Which tool gives you a shell inside a Linux app container?
The serial console
Azure Bastion
Remote Desktop
SSH from the portal or the Kudu site

50. How do you migrate an on-premises web app to App Service?

Migration is easiest with an assessment first, then a staged cutover.

  1. Assess readiness with the Azure Migrate web app assessment or the App Service Migration Assistant (IIS-based .NET and PHP apps).
  2. Choose the OS, tier, and region, and note blockers such as GAC assemblies, registry use, or local disk writes.
  3. Migrate the app with the Assistant, a ZIP deploy, or a container image.
  4. Move configuration out of config files into app settings, and secrets into Key Vault.
  5. Connect dependencies: migrate the database to Azure SQL, or use VNet integration or Hybrid Connections for resources that stay on-premises.
  6. Test in a staging slot, then cut over DNS with a low TTL.
Take quiz
Which tool checks IIS apps for readiness and migrates them?
Azure Site Recovery
Kudu
Azure Backup vault
Azure App Service Migration Assistant
Which feature reaches an on-premises resource without opening inbound firewall ports?
Hybrid Connections
Always On
Easy Auth
Deployment slots
«
»

Comments & Discussions