Tag: Azure App Service

Implement and configure security controls for Azure App Service (SC-500 Exam Prep)

This post is a part of the "SC-500: Implementing End-to-End Security Controls for Cloud and AI Workloads" Exam Prep Hub.
This topic falls under these sections:
Secure compute (20–25%)
   --> Implement security for application platform services
      --> Implement and configure security controls for Azure App Service


Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 4 practice tests with 30 questions each available from the hub's main page below the exam topics section.

Introduction

Azure App Service is a fully managed platform-as-a-service (PaaS) offering for hosting web applications, REST APIs, mobile backends, and other HTTP-based applications.

Because App Service applications frequently process business data and expose internet-accessible endpoints, security must be addressed across several layers:

  • Application authentication
  • Authorization
  • Management-plane access
  • Network access
  • Outbound connectivity
  • TLS and encryption
  • Secrets and credentials
  • Web application protection
  • Monitoring and logging
  • Governance

For the SC-500: Implementing End-to-End Security Controls for Cloud and AI Workloads exam, it is particularly important to understand that these controls solve different security problems.

For example:

Microsoft Entra authentication determines who can access an application.

Azure RBAC determines who can administer the App Service resource.

Managed identity determines how the application authenticates to supported Azure resources.

Private endpoints control private network connectivity to the application.

VNet integration controls outbound connectivity from the application.

Web Application Firewall helps protect web traffic from common application-layer attacks.

Understanding these distinctions is one of the most important skills for this topic.


1. Azure App Service Security Model

A useful way to organize App Service security is into five major areas:

Security areaPrimary questionImportant controls
Application authenticationWho can access the application?Microsoft Entra ID, App Service Authentication
AuthorizationWhat can the user or application do?Application authorization, RBAC
Workload identityHow does the app access Azure resources?Managed identity
Network securityWhere can traffic originate and go?Access restrictions, private endpoints, VNet integration
Data protectionIs data protected while traveling or stored?HTTPS, TLS, certificates, Key Vault
Application protectionCan common web attacks be blocked?WAF
AdministrationWho can change the App Service?Azure RBAC, PIM, least privilege
GovernanceWhat configurations are permitted?Azure Policy

Azure’s App Service security guidance treats identity, networking, data protection, monitoring, and governance as separate but complementary security layers.


2. App Service Authentication and Authorization

Azure App Service includes a built-in authentication and authorization capability commonly known as App Service Authentication, or Easy Auth.

Easy Auth can authenticate users before requests are passed to the application.

This means developers don’t necessarily have to implement the complete authentication flow themselves.

The general architecture is:

User
│
▼
App Service
│
├── Authentication
│
▼
Application

App Service Authentication supports Microsoft Entra ID and other identity providers.

For enterprise applications, Microsoft Entra ID is generally the most important identity provider to understand for SC-500.


3. Require Authentication for Sensitive Applications

An App Service application can be configured to allow unauthenticated requests or require authentication.

For applications containing sensitive information, requiring authentication prevents anonymous users from reaching the application.

For example:

Internet
│
▼
App Service Authentication
│
├── Unauthenticated → Denied/redirected
│
▼
Authenticated User
│
▼
Web Application

This provides an important security boundary before application code executes.

However, authentication is not the same thing as authorization.

A user may be authenticated but still not have permission to perform a particular operation.


4. Authentication vs. Authorization

This distinction is fundamental for SC-500.

Authentication

Authentication answers:

Who are you?

Examples:

  • Microsoft Entra ID
  • OAuth 2.0
  • Client certificates

Authorization

Authorization answers:

What are you allowed to do?

Examples:

  • Application roles
  • Claims-based authorization
  • Resource permissions
  • Azure RBAC

Consider a company application:

User
│
├── Authentication → Microsoft Entra ID
│
▼
Authenticated identity
│
├── Authorization → Application roles
│
▼
Allowed operation

Successfully signing in does not automatically mean the user should have access to every function in the application.


5. Azure RBAC Is Different from App Authentication

Another common SC-500 exam trap is confusing Azure RBAC with App Service Authentication.

Azure RBAC controls access to Azure management operations.

For example, RBAC determines whether someone can:

  • Create an App Service
  • Delete an App Service
  • Change configuration
  • Modify networking
  • Deploy applications
  • Change authentication settings

App Service Authentication controls access to the application itself.

Therefore:

RequirementControl
User signs into the web applicationApp Service Authentication / Microsoft Entra ID
Administrator modifies App Service configurationAzure RBAC
Application accesses Key VaultManaged identity
Network restricts application accessAccess restrictions/private endpoint

Azure explicitly treats management-plane RBAC as separate from application authentication and managed identity authentication.


6. Use Managed Identities for Outbound Azure Access

Applications frequently need to access other Azure services.

For example:

  • Azure Key Vault
  • Azure SQL Database
  • Azure Storage
  • Azure Service Bus
  • Azure Resource Manager

A traditional approach might involve storing a service principal secret or connection credential.

A better approach is to use a managed identity.

The architecture becomes:

App Service
│
│ Managed Identity
▼
Microsoft Entra ID
│
▼
Azure Resource

App Service supports both:

  • System-assigned managed identities
  • User-assigned managed identities

Managed identities allow applications to authenticate to supported Azure resources without storing credentials in application code or configuration.


7. System-Assigned vs. User-Assigned Managed Identity

The distinction is important.

CharacteristicSystem-assignedUser-assigned
LifecycleTied to App ServiceIndependent
Created with App ServiceYesNo
Reusable by multiple resourcesNoYes
Identity survives App Service deletionNoYes
Best forApp-specific identityShared/reusable identity

Example

Suppose one web application needs access to Key Vault.

A system-assigned identity may be appropriate:

Web App
│
▼
System-assigned identity
│
▼
Key Vault

If several applications should use the same identity and permission model, a user-assigned identity may be more appropriate:

Web App A ──┐
│
Web App B ──┼──► User-assigned identity ──► Key Vault
│
Web App C ──┘

8. Managed Identity Does Not Automatically Grant Permissions

This is a particularly important exam concept.

Enabling a managed identity does not automatically give the application access to Key Vault, Storage, SQL, or another resource.

You must still grant the identity the required permissions.

For example:

App Service
│
▼
Managed Identity
│
▼
Azure RBAC
│
▼
Key Vault Secrets User
│
▼
Key Vault

The exact role depends on what the application needs to do.

The principle is:

Identity establishes who the application is; authorization determines what that identity can access.


9. Store Secrets in Azure Key Vault

Sensitive information should not be hardcoded into application source code.

Examples include:

  • Database passwords
  • API keys
  • Certificates
  • Tokens
  • Connection secrets

Azure recommends using Azure Key Vault for sensitive configuration and accessing those secrets through managed identity where possible. App Service supports Key Vault references for application settings.

A secure architecture looks like:

App Service
│
│ Managed Identity
▼
Microsoft Entra ID
│
▼
Azure Key Vault
│
▼
Secret

This reduces the need for developers to handle credentials directly.


10. HTTPS and TLS

Applications should protect data in transit.

App Service supports HTTPS and TLS.

For sensitive production workloads, configure the application to use modern TLS protocols and enable HTTPS-only behavior.

Microsoft’s current App Service security guidance recommends enforcing HTTPS and using a modern TLS version, with TLS 1.2 or higher as the minimum configuration for current secure deployments.

HTTPS-only

When HTTPS-only is enabled, HTTP requests are redirected to HTTPS.

This helps prevent users from communicating with the application through an unencrypted HTTP connection.

Important distinction

HTTPS protects:

Data in transit

It does not replace:

  • Authentication
  • Authorization
  • Network restrictions
  • WAF
  • Application security

11. TLS Certificates and Custom Domains

If an App Service application uses a custom domain, the domain should be protected with a TLS/SSL certificate.

App Service supports several certificate options, including:

  • App Service managed certificates
  • App Service certificates
  • Customer-provided certificates
  • Certificates associated with Azure Key Vault

App Service managed certificates provide automatic management and renewal for supported scenarios.

The basic architecture is:

Client
│
│ HTTPS
▼
TLS Certificate
│
▼
App Service

12. Mutual TLS

App Service also supports mutual TLS (mTLS).

Traditional TLS primarily establishes a secure connection and authenticates the server to the client.

With mutual TLS, the client also presents a certificate.

Conceptually:

Client Certificate
│
▼
App Service
│
▼
Client authenticated

mTLS can be useful for:

  • B2B applications
  • Internal APIs
  • High-security applications
  • Machine-to-machine authentication

App Service supports client certificate authentication on both Windows and Linux App Service plans.


13. App Service Access Restrictions

App Service provides access restrictions that function similarly to a firewall for inbound application traffic.

Access restrictions can be used to restrict traffic based on:

  • IP addresses
  • IP ranges
  • Virtual network subnets
  • Service endpoints
  • Service tags

Rules are evaluated according to their priorities.

For example:

Internet
│
├── Approved IP ───────► App Service
│
└── Unapproved IP ────► Denied

This is useful when an application should only be reachable from known locations or services.


14. Access Restrictions Are an Inbound Control

This is another important SC-500 distinction.

App Service access restrictions control incoming traffic.

They do not provide general-purpose outbound traffic control.

For outbound connectivity, consider:

  • VNet integration
  • Routing
  • Azure Firewall
  • NAT Gateway
  • Private endpoints for destination services

Therefore:

Access restrictions = inbound filtering

while:

VNet integration = outbound connectivity


15. Implicit Deny with Access Restrictions

Access restriction rules are evaluated in priority order.

When restrictions are configured, traffic that doesn’t match an appropriate allow rule can be denied.

This makes access restrictions useful for allow-list scenarios.

For example:

Rule 100: Allow 10.10.0.0/16
Rule 200: Allow 20.20.20.0/24
Default: Deny

This allows only traffic matching the permitted rules.

A common exam scenario is:

“Only traffic from the corporate network should reach the web application.”

An App Service access restriction is a possible solution.


16. Private Endpoints

A private endpoint provides private connectivity to an App Service application using Azure Private Link.

The application receives a private IP address associated with a network interface in a virtual network.

Conceptually:

Virtual Network
┌────────────────────────────────────┐
│ │
│ Client ──► Private Endpoint │
│ │ │
└────────────────┼───────────────────┘
│
▼
App Service

Private endpoints are useful when an organization wants to reduce or eliminate public network exposure.

Microsoft’s App Service security guidance specifically recommends private endpoints when the objective is to route application traffic through private networking.


17. Disable Public Network Access for Full Isolation

A critical point is that configuring a private endpoint does not necessarily mean the public endpoint is automatically unavailable in every configuration.

For stronger isolation, configure the App Service so that public network access is disabled when appropriate.

Microsoft specifically recommends disabling public network access when private endpoints are being used to ensure the desired network isolation.

The desired architecture becomes:

Corporate VNet
│
▼
Private Endpoint
│
▼
App Service
Public Internet
│
X
Blocked

This significantly reduces the application’s public attack surface.


18. Private Endpoint Traffic Bypasses Access Restrictions

This is a very important exam detail.

App Service access restrictions apply to traffic arriving through the application’s default endpoint.

They do not apply to traffic arriving through a private endpoint.

If additional filtering is required for private endpoint traffic, network security controls such as NSGs on the private endpoint subnet can be used.

Therefore, don’t assume:

“I configured an App Service IP restriction, so it controls all traffic.”

Instead, remember:

Public/default endpoint
│
▼
Access restrictions
│
▼
App Service
Private endpoint
│
▼
Private endpoint subnet / NSG
│
▼
App Service

19. Private Endpoint vs. VNet Integration

These two features are frequently confused.

FeaturePrimary purposeTraffic direction
Private endpointPrivate access to App ServiceInbound
VNet integrationAllow App Service to reach resources through a VNetOutbound
Access restrictionsFilter incoming trafficInbound
NSGFilter network traffic at supported subnet interfacesNetwork-level
Azure FirewallCentralized traffic inspection/controlPrimarily outbound/traffic inspection

For example, suppose an App Service needs to:

  1. Receive private traffic from an internal application.
  2. Connect to a private Azure SQL database.

A suitable architecture could be:

Internal Client
│
▼
Private Endpoint
│
▼
App Service
│
│ VNet Integration
▼
Private Network
│
▼
Azure SQL Private Endpoint

The private endpoint and VNet integration solve different problems.


20. Network Security for Outbound Traffic

App Service applications often need to communicate with external resources.

For example:

App Service
│
├──► Azure SQL
├──► Key Vault
├──► Storage
├──► APIs
└──► Internet

VNet integration allows the application to access resources in or through a virtual network.

Organizations can combine this with other network controls to manage outbound traffic.

For example:

App Service
│
▼
VNet Integration
│
▼
Azure Firewall
│
├──► Approved destination
│
└──X Unapproved destination

This can help control outbound connectivity and reduce data-exfiltration risks.

Azure’s App Service security guidance recommends VNet integration for outbound network security and identifies firewall-based controls as an option for restricting traffic to the public internet.


21. Use Private Endpoints for Backend Services

When an App Service accesses sensitive Azure PaaS services, private connectivity can be used for those destinations as well.

For example:

App Service
│
▼
VNet Integration
│
▼
Private Endpoint
│
▼
Azure SQL

Similar patterns can be used for services such as:

  • Azure Storage
  • Azure Key Vault
  • Azure SQL
  • Other supported Azure PaaS services

This can reduce dependence on public endpoints and help enforce a private network architecture.


22. Web Application Firewall

A Web Application Firewall (WAF) provides protection against common web application attacks.

Examples include:

  • SQL injection
  • Cross-site scripting (XSS)
  • Other common web exploits

Azure WAF can be deployed with:

  • Azure Front Door
  • Azure Application Gateway

WAF policies can contain managed rules and custom rules.

A common architecture is:

Internet
│
▼
Azure Front Door
│
▼
WAF
│
▼
App Service

or:

Internet
│
▼
Application Gateway
│
▼
WAF
│
▼
App Service

23. What WAF Does—and Does Not Do

WAF is an important defense layer, but it should not be confused with authentication or network isolation.

WAF helps protect against:

  • Common web exploits
  • Malicious HTTP requests
  • SQL injection
  • Cross-site scripting
  • Other application-layer attacks

WAF does not replace:

  • Microsoft Entra authentication
  • Azure RBAC
  • Managed identities
  • Private endpoints
  • App Service access restrictions
  • Secure application coding

A strong architecture can combine these controls:

Internet
│
▼
Front Door
│
▼
WAF
│
▼
App Service
│
├── Microsoft Entra authentication
│
├── Managed identity
│
└── VNet integration

Azure WAF is designed as centralized protection for web applications and can inspect incoming requests before they reach the backend application.


24. WAF Detection vs. Prevention

WAF policies can use different rule behaviors.

A security team may initially use a detection-oriented configuration to observe suspicious traffic and tune rules before moving toward more aggressive blocking.

For production protection, the goal is generally to configure the WAF policy so malicious traffic is appropriately blocked while legitimate traffic continues to function.

This is particularly important because overly aggressive rules can cause false positives.

A good operational approach is:

  1. Deploy WAF.
  2. Monitor traffic.
  3. Identify false positives.
  4. Tune rules.
  5. Apply appropriate blocking behavior.
  6. Continue monitoring.

25. Protect Deployment and SCM Endpoints

App Service includes deployment-related endpoints such as the SCM/Kudu site.

These endpoints require security attention because they can provide powerful administrative and deployment capabilities.

Microsoft recommends disabling basic username/password authentication for FTP and SCM endpoints in favor of Microsoft Entra-based authentication where applicable.

Access restrictions can also be configured separately for the main application and the SCM site.

This is an important detail:

Protecting the main web application does not necessarily mean the deployment endpoint has the exact same security configuration.


26. Secure FTP and Deployment Traffic

If FTP is used for deployment, avoid unencrypted FTP.

Use:

  • FTPS
  • Other secure deployment mechanisms
  • Microsoft Entra-based authentication where supported

Microsoft recommends disabling FTP where possible or enforcing FTPS-only operation if FTP must be used.

The broader principle is:

Never transmit deployment credentials or application content over an unencrypted channel.


27. App Service Environment for Strong Network Isolation

For scenarios requiring extensive network isolation, an Azure App Service Environment (ASE) provides a dedicated App Service environment within an Azure virtual network.

An ASE can provide:

  • Dedicated infrastructure
  • Network isolation
  • Internal load balancer capabilities
  • Private application architectures

Microsoft describes App Service Environment as an option for achieving complete network isolation, including internal-only application access through an internal load balancer configuration.

This is generally a more specialized architecture than simply adding an access restriction or private endpoint.


28. App Service and Application Gateway

Application Gateway can be placed in front of App Service to provide capabilities such as:

  • WAF
  • Layer 7 routing
  • TLS termination
  • Centralized application delivery controls

A simplified architecture is:

Internet
│
▼
Application Gateway
│
├── WAF
│
└── Routing
│
▼
App Service

This is particularly useful when the organization needs centralized HTTP security and routing.


29. App Service and Azure Front Door

Azure Front Door is another option for internet-facing applications.

With Azure Front Door and WAF:

Global User
│
▼
Azure Front Door
│
▼
WAF
│
▼
App Service

Front Door operates at Microsoft’s global edge and can inspect incoming traffic before it reaches the backend. Azure WAF on Front Door provides centralized protection against common web vulnerabilities.

This architecture can be particularly useful for globally distributed applications.


30. Security Through Defense in Depth

A mature App Service architecture does not depend on a single security control.

For example:

                    Internet
                       │
                       ▼
               Azure Front Door
                       │
                       ▼
                      WAF
                       │
                       ▼
              App Service Access
                 Restrictions
                       │
                       ▼
                  App Service
                  ┌────┴────┐
                  │         │
             Easy Auth   Managed Identity
                  │         │
                  ▼         ▼
            Application   Azure Resources
                            │
                       Private Endpoints

Each layer has a different responsibility.

Layer 1 — Edge protection

WAF protects against common web attacks.

Layer 2 — Network restrictions

Access restrictions and private endpoints control network access.

Layer 3 — Application authentication

Microsoft Entra ID verifies user or application identity.

Layer 4 — Application authorization

Application roles and permissions determine what an authenticated identity can do.

Layer 5 — Workload identity

Managed identity authenticates the application to Azure resources.

Layer 6 — Resource authorization

Azure RBAC or service-specific permissions determine what the managed identity can access.

This is defense in depth.


31. Security Control Decision Matrix

The following matrix is particularly useful for SC-500 preparation.

RequirementPrimary security control
Require users to authenticate before accessing web applicationApp Service Authentication / Microsoft Entra ID
Determine what an authenticated user can doApplication authorization
Control who can administer App ServiceAzure RBAC
Allow App Service to access Key Vault without storing credentialsManaged identity
Store application secrets securelyAzure Key Vault
Force HTTP traffic to HTTPSHTTPS-only
Use modern encryption protocolsTLS configuration
Authenticate clients with certificatesMutual TLS
Allow only specific IP addresses to reach appAccess restrictions
Provide private inbound connectivityPrivate endpoint
Allow app to reach resources in a VNetVNet integration
Protect against SQL injection and XSSWAF
Provide global edge protectionAzure Front Door + WAF
Provide regional/private HTTP inspectionApplication Gateway + WAF
Protect private-endpoint traffic at subnet levelNSG
Restrict deployment endpoint accessSCM/site access restrictions
Prevent unencrypted FTPDisable FTP or use FTPS
Provide dedicated network isolationApp Service Environment
Govern App Service configurationAzure Policy

32. Common SC-500 Exam Traps

Trap 1: Azure RBAC authenticates application users

Incorrect.

RBAC controls Azure management-plane permissions.

App Service Authentication is used for application authentication.


Trap 2: Managed identity gives the application access to everything

Incorrect.

The identity must still be granted the appropriate permissions.


Trap 3: VNet integration makes the App Service private

Incorrect.

VNet integration is primarily for outbound connectivity.

A private endpoint is used for private inbound access.


Trap 4: Access restrictions apply to private endpoint traffic

Incorrect.

App Service access restrictions do not apply to traffic entering through a private endpoint. Additional filtering for private-endpoint traffic can be implemented at the network layer, such as with NSGs.


Trap 5: A private endpoint automatically eliminates public exposure

Not necessarily.

For the desired isolation, public network access should be disabled when appropriate. Microsoft specifically recommends this when private endpoints are being used to ensure isolation.


Trap 6: WAF authenticates users

Incorrect.

WAF protects web traffic against common application-layer attacks.

Authentication is handled separately.


Trap 7: HTTPS eliminates the need for authentication

Incorrect.

HTTPS encrypts traffic. It does not determine whether a user is authorized.


Trap 8: A managed identity replaces Azure RBAC

Incorrect.

Managed identity establishes the application’s identity.

RBAC or another authorization mechanism determines what that identity is allowed to access.


Trap 9: Securing the web application automatically secures SCM

Incorrect.

The main application and SCM/Kudu site can have separate access restriction configurations. Deployment endpoints therefore require their own security consideration.


Trap 10: WAF replaces secure application development

Incorrect.

WAF provides an additional protection layer but does not eliminate vulnerabilities in application code.


33. Recommended Secure App Service Architecture

For a highly sensitive enterprise application, a strong architecture might look like:

                         Internet
                            │
                            ▼
                  Azure Front Door
                            │
                            ▼
                           WAF
                            │
                            ▼
                  Private/Controlled
                     App Access
                            │
                            ▼
                    Azure App Service
                    ┌───────┴────────┐
                    │                │
              Entra ID          Managed Identity
             Authentication          │
                    │                ▼
                    │          Azure Key Vault
                    │
                    ▼
               Application
                    │
                    ▼
              VNet Integration
                    │
            ┌───────┼─────────┐
            ▼       ▼         ▼
         SQL      Storage   Other PaaS
       Private    Private    Private
       Endpoint  Endpoint   Endpoint

Additional controls can include:

  • Azure RBAC
  • Azure Policy
  • NSGs
  • Resource locks
  • Azure Monitor
  • Application Insights
  • Microsoft Defender for Cloud
  • Privileged Identity Management

This architecture demonstrates the central SC-500 concept:

Identity, network, application, and platform controls should reinforce one another.


34. SC-500 Exam-Focused Summary

When you see an Azure App Service security scenario, first identify what type of security problem the question is describing.

“Users must sign in.”

Think:

App Service Authentication / Microsoft Entra ID

“Administrators should have limited Azure management permissions.”

Think:

Azure RBAC / least privilege

“The application needs to access Key Vault without storing a password.”

Think:

Managed identity

“Only corporate IP addresses should reach the application.”

Think:

Access restrictions

“The application must not have a public endpoint.”

Think:

Private endpoint + disable public network access as appropriate

“The application needs to reach a private database.”

Think:

VNet integration

“Protect the application from SQL injection and XSS.”

Think:

Web Application Firewall

“Encrypt HTTP traffic.”

Think:

HTTPS/TLS

“Require a client certificate.”

Think:

Mutual TLS

“Protect deployment access.”

Think:

Secure SCM/deployment endpoint and disable basic authentication where possible

“Prevent secrets from being stored in application configuration.”

Think:

Azure Key Vault + managed identity


35. Key Takeaways

For the SC-500 exam, remember these distinctions:

  1. App Service Authentication (Easy Auth) protects application access and can use Microsoft Entra ID.
  2. Azure RBAC controls who can administer the App Service resource.
  3. Managed identities allow an App Service application to authenticate to supported Azure resources without storing credentials.
  4. Managed identity does not automatically grant resource permissions.
  5. Azure Key Vault should be used to protect sensitive secrets and certificates.
  6. HTTPS and TLS protect data in transit.
  7. Mutual TLS can provide certificate-based client authentication.
  8. Access restrictions filter inbound traffic to the App Service default endpoint.
  9. Private endpoints provide private inbound connectivity.
  10. VNet integration provides outbound connectivity from App Service into a virtual network.
  11. Access restrictions do not apply to traffic arriving through a private endpoint.
  12. NSGs can provide additional network filtering for private-endpoint traffic.
  13. A private endpoint does not by itself mean public access has been eliminated; disable public network access when the architecture requires complete isolation.
  14. WAF protects web applications against common web exploits such as SQL injection and cross-site scripting.
  15. Azure Front Door + WAF is a strong pattern for globally distributed internet-facing applications.
  16. Application Gateway + WAF is another important pattern for application delivery and web protection.
  17. SCM/Kudu deployment endpoints require their own security consideration.
  18. App Service Environment can provide stronger, dedicated network isolation for specialized scenarios.
  19. Authentication, authorization, networking, workload identity, and WAF are separate security layers.
  20. The strongest App Service architectures use defense in depth rather than relying on one security feature.

Practice Exam Questions

Question 1

A company hosts a customer-facing web application in Azure App Service. The security team requires all users to authenticate through Microsoft Entra ID before they can access the application. The development team does not want to implement its own authentication middleware.

Which solution should you recommend?

A. Configure App Service Authentication with Microsoft Entra ID
B. Configure an App Service resource lock
C. Configure VNet integration
D. Configure Azure RBAC for the application users

Answer: A

Explanation: App Service Authentication, commonly called Easy Auth, provides built-in authentication before requests reach the application and can use Microsoft Entra ID. RBAC controls management-plane access, while VNet integration addresses outbound networking.


Question 2

An App Service application needs to retrieve secrets from Azure Key Vault. The security team prohibits storing credentials in source code or application configuration.

What should you implement?

A. Store a Key Vault access key in an App Service setting
B. Use a SAS token
C. Configure a managed identity and grant it the required Key Vault permissions
D. Give the application’s developers the Key Vault Administrator role

Answer: C

Explanation: A managed identity allows the application to authenticate to Key Vault without storing credentials. The identity must still be granted the appropriate permissions on the Key Vault. This follows the principle of least privilege and avoids embedding credentials in the application.


Question 3

An organization hosts an App Service application containing highly sensitive information. The application must be accessible from an internal virtual network, and the organization wants to eliminate public network exposure.

Which combination is most appropriate?

A. VNet integration only
B. Private endpoint and disable public network access
C. IP access restrictions only
D. Azure RBAC and HTTPS-only mode

Answer: B

Explanation: A private endpoint provides private inbound connectivity to the App Service. To eliminate the public endpoint, public network access should also be disabled as appropriate. VNet integration alone is primarily an outbound connectivity feature.


Question 4

An App Service application must connect to an Azure SQL database that is accessible through a private virtual network. Which App Service networking capability should be used to provide outbound connectivity into the virtual network?

A. App Service access restrictions
B. Private endpoint on the App Service only
C. VNet integration
D. HTTPS-only mode

Answer: C

Explanation: VNet integration allows an App Service application to make outbound connections to resources accessible through a virtual network. Access restrictions and private endpoints address inbound connectivity to the App Service.


Question 5

A security engineer configures IP-based access restrictions on an App Service. The application also has a private endpoint. The engineer discovers that traffic arriving through the private endpoint is not being evaluated by the App Service access restriction rules.

Is this expected?

A. Yes, because App Service access restrictions don’t apply to traffic entering through a private endpoint
B. No, because access restrictions always override private endpoints
C. No, because private endpoints require App Service Authentication to function
D. Yes, but only when the application is using Linux

Answer: A

Explanation: App Service access restrictions apply to traffic arriving through the default endpoint. Traffic arriving through a private endpoint bypasses those App Service access restrictions. Additional network filtering can be implemented using controls such as NSGs on the private endpoint subnet.


Question 6

A company wants to protect an internet-facing App Service application from SQL injection and cross-site scripting attacks before malicious requests reach the application.

Which solution is most appropriate?

A. Azure RBAC
B. Azure Key Vault
C. Web Application Firewall
D. Managed identity

Answer: C

Explanation: Azure Web Application Firewall is designed to protect web applications against common application-layer attacks, including SQL injection and cross-site scripting. It can be deployed with Azure Front Door or Application Gateway.


Question 7

A company has several App Service applications that need to access the same set of Azure resources. The security team wants the identity used for those applications to have an independent lifecycle and be reusable across applications.

Which managed identity type is most appropriate?

A. System-assigned managed identity
B. App Service Authentication
C. Service endpoint identity
D. User-assigned managed identity

Answer: D

Explanation: A user-assigned managed identity is an independent Azure resource that can be associated with multiple supported resources. Its lifecycle is independent of the individual App Service applications.


Question 8

A security team wants to ensure that users cannot connect to an App Service application using unencrypted HTTP.

Which configuration should be enabled?

A. HTTPS-only
B. VNet integration
C. Access restrictions
D. Private endpoint

Answer: A

Explanation: HTTPS-only redirects HTTP requests to HTTPS and helps ensure that application traffic is encrypted in transit. It does not replace authentication or other security controls.


Question 9

An organization uses Azure Front Door to distribute traffic to an internet-facing App Service application. The security team wants to inspect incoming requests for common web exploits such as SQL injection and cross-site scripting.

Which service should be configured with Front Door?

A. Azure Key Vault
B. Web Application Firewall
C. Azure RBAC
D. Azure Bastion

Answer: B

Explanation: Azure WAF can be associated with Azure Front Door and provides centralized inspection and protection against common web application attacks. Front Door provides the global application delivery layer, while WAF provides the web-attack protection layer.


Question 10

A company wants its operations team to manage App Service configuration and deployments but wants to prevent unnecessary administrative privileges. Developers should be able to manage applications, while the operations team should receive only the permissions required for its responsibilities.

Which principle should guide the design?

A. Public network access
B. Shared-secret authentication
C. Full Contributor access for all users
D. Least privilege using Azure RBAC

Answer: D

Explanation: Azure RBAC should be used to assign the minimum management permissions necessary for each role. This separates management-plane authorization from application authentication and supports the principle of least privilege.


Final Exam Perspective

The easiest way to reason through App Service questions on SC-500 is to identify which security boundary the question is asking you to protect:

Who can access the application?
→ App Service Authentication / Microsoft Entra ID

Who can administer the Azure resource?
→ Azure RBAC

How does the application authenticate to Azure resources?
→ Managed identity

Where are secrets stored?
→ Azure Key Vault

Who can reach the public/default endpoint?
→ Access restrictions

How can users privately reach the App Service?
→ Private endpoint

How can the application reach private resources?
→ VNet integration

How do you protect HTTP traffic?
→ HTTPS/TLS

How do you authenticate clients with certificates?
→ Mutual TLS

How do you protect against SQL injection and XSS?
→ WAF

How do you achieve stronger network isolation?
→ Private endpoints, appropriate public-access restrictions, VNet integration, and, for specialized requirements, App Service Environment

The central SC-500 principle is defense in depth. A secure App Service deployment combines identity, authorization, network security, encryption, workload identity, application protection, and governance rather than expecting any single feature to solve every security requirement.


Go to the SC-500 Exam Prep Hub main page

Deploy containers to Azure App Service, including configuring App Service to supply environment variables and secrets (AI-200 Exam Prep)

This post is a part of the AI-200: Developing AI Cloud Solutions on Azure  Exam Prep Hub.
This topic falls under these sections:
Develop containerized solutions on Azure (20–25%)
   --> Implement container application hosting
      --> Deploy containers to Azure App Service, including configuring App Service to supply environment variables and secrets


Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 4 practice tests with 30 questions each available from the hub's main page below the exam topics section.

Overview

Azure App Service is a fully managed platform-as-a-service (PaaS) offering that allows developers to host web applications, APIs, and containerized applications without managing the underlying virtual machines or operating system.

For the AI-200: Developing AI Cloud Solutions on Azure exam, you should understand how to deploy a container image to App Service and, importantly, how to configure the application so that the container receives the configuration, environment variables, and secrets it needs at runtime.

This is particularly important for AI applications because containerized AI workloads commonly need configuration values such as:

  • Azure AI service endpoints
  • Model deployment names
  • Database connection information
  • Storage account names
  • Service Bus configuration
  • Application Insights configuration
  • Feature flags
  • API keys or other secrets

A well-designed application should not bake these values into the container image. Instead, configuration should be supplied by the hosting environment, with sensitive values preferably retrieved from a secure secret store such as Azure Key Vault.


1. Understand Azure App Service for Containers

Azure App Service can run applications packaged as custom container images. This allows developers to use their own runtime, dependencies, libraries, and operating-system configuration instead of relying exclusively on App Service’s built-in application stacks.

A typical architecture looks like this:

Developer → Container Image → Container Registry → Azure App Service → Running Container

For example:

  1. A developer creates a Dockerfile.
  2. The Dockerfile is used to build an image.
  3. The image is pushed to Azure Container Registry.
  4. App Service is configured to use that image.
  5. App Service pulls the image.
  6. App Service starts the container.
  7. App Service supplies configuration values as environment variables.
  8. The application reads those values at runtime.

App Service pulls the configured container image when the application starts. If an updated image is pushed to the registry, restarting the application causes App Service to pull the updated image.

This separation between the application image and the application configuration is an important concept for the exam.


2. Why Use Containers with App Service?

A custom container is useful when the application’s requirements don’t fit cleanly into one of App Service’s predefined runtime stacks.

For example, an AI application might require:

  • A particular Python version
  • Specific native libraries
  • Custom machine-learning packages
  • A specialized web server
  • OS-level dependencies
  • A combination of packages that isn’t available in a standard App Service stack

Instead of configuring all those dependencies on the App Service platform, you can package them into a container.

Key benefit

The container provides a consistent application environment.

The same image can potentially be used in:

  • Development
  • Testing
  • Staging
  • Production
  • Other container-hosting environments

This supports the important principle:

Build the application once and configure it differently for each environment.

The container should contain the application and its dependencies—not environment-specific secrets.


3. The Container Image and App Service Are Separate Concerns

One of the most important concepts to understand is the difference between the container image and the App Service configuration.

Container image

The image contains things such as:

  • Application code
  • Runtime
  • Dependencies
  • Libraries
  • System packages
  • Startup configuration

App Service configuration

App Service supplies environment-specific information such as:

  • Database endpoints
  • API endpoints
  • Feature flags
  • Environment names
  • Secret references
  • Connection information

This allows the same image to run in multiple environments.

For example:

Container Image
|
+-- Application code
+-- Python runtime
+-- Required libraries
+-- AI SDKs
|
v
App Service
|
+-- ENVIRONMENT=Production
+-- AI_ENDPOINT=...
+-- MODEL_NAME=...
+-- DATABASE_CONNECTION=...
+-- API_KEY=<Key Vault reference>

The application doesn’t need a different Docker image simply because it is moving from development to production.


4. Deploying a Container to App Service

There are several ways to deploy a containerized application to App Service.

A common approach is:

Dockerfile
↓
docker build
↓
Container Image
↓
Azure Container Registry
↓
Azure App Service

For example, a container image might be named:

myregistry.azurecr.io/my-ai-api:v1

The registry name identifies the container registry.

The repository identifies the application:

my-ai-api

And the tag identifies a particular version:

v1

Therefore:

myregistry.azurecr.io/my-ai-api:v1

identifies a specific container image.


5. Configure the Container Image

When creating or configuring an App Service application, you specify the container image that App Service should run.

For an image hosted in Azure Container Registry, App Service needs access to the registry.

For a private registry, authentication must be configured.

Depending on the scenario, App Service can use authentication mechanisms such as managed identity rather than embedding registry credentials. Current App Service configuration also supports managed-identity-based access to Azure Container Registry, which is generally preferable to managing long-lived registry passwords.

Exam concept

When you see a question asking for the most secure way to allow App Service to pull a private image from Azure Container Registry, consider:

Managed identity and appropriate Azure role assignments

rather than storing a registry password in application configuration.


6. The Container’s Listening Port

A containerized application must listen on the appropriate port so App Service can route traffic to it.

For custom containers, the port configuration is particularly important.

For example, suppose the application listens on:

8080

The application inside the container needs to listen on that port, and App Service needs to know which port to use.

A common App Service configuration is:

WEBSITES_PORT=8080

The WEBSITES_PORT application setting tells App Service which port the custom container is listening on. Microsoft specifically identifies WEBSITES_PORT as required for custom-container port configuration.

Example

Suppose the Dockerfile contains:

EXPOSE 8080

The application should also actually listen on port 8080.

Then App Service can be configured with:

WEBSITES_PORT = 8080

Important distinction

EXPOSE in a Dockerfile documents the port the container expects to use. It does not by itself guarantee that the application is actually listening on that port.

A common troubleshooting scenario is:

The container starts successfully, but the application isn’t reachable.

One of the first things to verify is whether the application is listening on the expected port and whether WEBSITES_PORT is configured correctly.


7. Environment Variables in App Service

App Service application settings are exposed to applications as environment variables.

This is one of the most important concepts for this exam topic.

For example, you could configure:

ENVIRONMENT = Production
MODEL_NAME = gpt-4o-mini
AI_ENDPOINT = https://example.openai.azure.com/

Your application can then read these values from its environment.

For Linux applications and custom containers, App Service passes application settings into the container as environment variables. Changes to App Service settings cause the application to restart.

This allows the application code to remain environment-independent.


8. Why Environment Variables Are Better Than Hard-Coding Configuration

Consider this application code:

AI_ENDPOINT = "https://production-ai.example.com"

This is problematic because the endpoint is embedded in the application.

A better approach is:

import os
AI_ENDPOINT = os.environ["AI_ENDPOINT"]

Then App Service supplies:

AI_ENDPOINT=https://production-ai.example.com

The same container can then be deployed elsewhere with:

AI_ENDPOINT=https://development-ai.example.com

without rebuilding the image.

This supports:

  • Environment portability
  • Easier deployments
  • Configuration management
  • Separation of code and configuration
  • Safer secret handling

9. Configure Application Settings

App Service application settings can be configured through the Azure portal, Azure CLI, PowerShell, ARM/Bicep, or other deployment mechanisms.

In the Azure portal, application settings are managed under the app’s environment/configuration settings.

For example, you might define:

SettingExample valueSensitive?
APP_ENVIRONMENTProductionNo
AI_ENDPOINThttps://my-ai.openai.azure.com/Usually no
MODEL_NAMEchat-modelNo
LOG_LEVELInformationNo
DATABASE_CONNECTIONConnection informationPotentially
API_KEYSecret valueYes

App Service stores app settings encrypted at rest. However, for secrets that require centralized secret management, Microsoft recommends using Azure Key Vault references rather than directly storing the secret value in the App Service setting.


10. Secrets Should Not Be Baked into Container Images

This is a major security principle.

Avoid putting something like this in a Dockerfile:

ENV API_KEY="abc123secret"

Also avoid:

API_KEY = "abc123secret"

Why?

Because the secret can potentially become part of the image or source code and therefore propagate into:

  • Container registries
  • Image layers
  • Source repositories
  • Build systems
  • Developer machines
  • Backups
  • Logs

Instead:

Container Image
+
App Service Configuration
+
Azure Key Vault

should provide the necessary runtime configuration.


11. Azure Key Vault Integration

Azure Key Vault provides centralized management for secrets, keys, and certificates.

For App Service, Key Vault can be integrated using Key Vault references.

Instead of putting the actual secret into an App Service setting, the setting contains a reference to the secret.

Conceptually:

API_KEY
↓
@Microsoft.KeyVault(...)
↓
Azure Key Vault
↓
Secret value
↓
Application

The application can consume the resolved value as an ordinary environment variable.

One of the major benefits is that application code doesn’t need to contain Key Vault-specific retrieval logic just to consume a referenced application setting.


12. Key Vault References

A Key Vault reference has a format similar to:

@Microsoft.KeyVault(SecretUri=https://myvault.vault.azure.net/secrets/mysecret)

Alternatively, a reference can use the vault and secret names:

@Microsoft.KeyVault(VaultName=myvault;SecretName=mysecret)

A specific secret version can also be specified.

For example:

AI_API_KEY =
@Microsoft.KeyVault(VaultName=myvault;SecretName=AI-API-Key)

The application can continue to access the setting using the environment variable:

AI_API_KEY

The application doesn’t have to know that the value originated from Key Vault.


13. Managed Identity and Key Vault

For Key Vault references to work securely, App Service needs an identity that can access the Key Vault.

A recommended architecture is:

Azure App Service
|
| Managed Identity
|
v
Azure Key Vault
|
v
Secret

The application does not need to store a Key Vault username/password or service principal secret.

App Service Key Vault references use the app’s system-assigned managed identity by default, although a user-assigned managed identity can also be configured. The identity must have permission to read secrets from the vault. With Azure RBAC, the Key Vault Secrets User role is an appropriate role for reading secrets.


14. System-Assigned vs. User-Assigned Managed Identity

You should understand the difference for exam questions.

System-assigned managed identity

The identity is tied to the Azure resource.

For example:

App Service
|
+-- System-assigned identity

If the App Service is deleted, the identity is also deleted.

User-assigned managed identity

The identity is a separate Azure resource.

User-assigned identity
|
+---- App Service A
|
+---- App Service B

It can therefore be reused by multiple resources.

Exam consideration

If a scenario specifically requires an identity to exist before the application is created or requires reuse across several resources, a user-assigned managed identity may be more appropriate.


15. Key Vault Secret Rotation

Key Vault references can simplify secret rotation.

When a Key Vault reference doesn’t specify a particular secret version, App Service can use the latest version of the secret.

App Service caches Key Vault reference values and periodically refreshes them. Microsoft documents a refresh interval of up to 24 hours; configuration changes that restart the app can cause the references to be fetched immediately.

This is an important distinction:

Changing the secret in Key Vault does not necessarily mean that the application immediately receives the new value.

If an application must immediately consume a new value, you need to account for the Key Vault reference refresh behavior.


16. What Happens When a Key Vault Reference Fails?

Suppose App Service has:

AI_API_KEY =
@Microsoft.KeyVault(VaultName=myvault;SecretName=AI-Key)

but the managed identity doesn’t have permission to retrieve the secret.

The reference might fail to resolve.

Potential causes include:

  • Incorrect Key Vault name
  • Incorrect secret name
  • Secret deleted
  • Incorrect reference syntax
  • Managed identity not enabled
  • Missing Key Vault permissions
  • Network restrictions preventing access to Key Vault

App Service provides Key Vault reference resolution information that can help diagnose these problems.

Exam clue

If a question says:

The application receives the literal @Microsoft.KeyVault(...) value instead of the expected secret.

Think:

The Key Vault reference failed to resolve.

Then investigate identity, permissions, reference syntax, secret existence, and networking.


17. App Settings vs. Key Vault

A useful exam distinction is:

RequirementRecommended approach
Non-sensitive configurationApp Service application setting
Environment-specific valueApp Service application setting
Secret valueAzure Key Vault
Secret consumed as an environment variableKey Vault reference in an App Service setting
Shared centralized configurationAzure App Configuration
Application codeDo not hard-code secrets

App Service application settings are appropriate for ordinary configuration.

Key Vault should be preferred when the value is a secret requiring centralized secret management, access control, auditing, and rotation.


18. App Configuration vs. Key Vault

AI-200 also covers Azure App Configuration, so understand how it differs from Key Vault.

Azure App Configuration

Designed primarily for centralized application configuration.

Examples:

Feature flags
Application settings
Environment configuration
Dynamic configuration

Azure Key Vault

Designed for sensitive information such as:

Passwords
API keys
Connection secrets
Certificates
Cryptographic keys

A common architecture uses both:

                    +---------------------+
                    | Azure App Config     |
                    |                     |
                    | Feature flags       |
                    | Application config  |
                    +----------+----------+
                               |
                               |
Application <------------------+
     |
     |
     +------------------------+
                              |
                              v
                    +---------------------+
                    | Azure Key Vault     |
                    |                     |
                    | API keys            |
                    | Passwords           |
                    | Secrets             |
                    +---------------------+

Do not confuse centralized configuration with secret management.


19. Container Startup Commands

A container has a default startup command defined by its image.

However, App Service can override the startup behavior for a custom container.

This can be useful when:

  • The container’s default command isn’t appropriate.
  • The application requires a specific startup command.
  • Different hosting environments require different startup behavior.

For example:

python app.py

or:

gunicorn --bind 0.0.0.0:8080 app:app

App Service supports specifying a startup command for custom containers.

Exam clue

If a container image works locally but App Service starts it incorrectly, investigate:

  • Startup command
  • Listening port
  • Environment variables
  • Container logs
  • Image configuration

20. Environment Variables and Container Startup

Environment variables are available to the application when the container starts.

For example:

APP_ENVIRONMENT=Production
PORT=8080
MODEL_NAME=my-model

Your application might use:

import os
environment = os.getenv("APP_ENVIRONMENT")
model = os.getenv("MODEL_NAME")

The values can be changed in App Service without changing the container image.

This is especially valuable when promoting the same image through:

Development
↓
Testing
↓
Staging
↓
Production

Each environment can supply different configuration.


21. App Settings Cause Application Restarts

A frequently tested detail is that changing App Service application settings causes the application to restart.

This matters because configuration changes aren’t necessarily applied to an already-running process without interruption.

Microsoft documents that adding, removing, or modifying app settings causes an App Service app restart.

Therefore, if a scenario says:

An administrator changes an application setting and the application immediately restarts.

That is expected behavior.


22. Container Image Updates

Suppose App Service is configured to run:

myacr.azurecr.io/my-ai-api:latest

A developer builds a new version and pushes it using the same tag.

The registry now contains a newer image associated with latest.

However, simply pushing the new image doesn’t necessarily mean that an already-running container immediately changes.

Restarting the App Service causes it to pull the image again.

This is one reason immutable version tags are often preferable for controlled deployments.

For example:

my-ai-api:v1.0.0
my-ai-api:v1.1.0
my-ai-api:v2.0.0

rather than relying exclusively on:

my-ai-api:latest

23. Using latest vs. Versioned Tags

latest

Advantages:

  • Simple
  • Convenient for development

Disadvantages:

  • Doesn’t clearly identify what is deployed
  • Makes rollback more difficult
  • Can make troubleshooting harder
  • Can introduce unexpected image changes

Versioned tags

For example:

my-ai-api:1.4.2

Advantages:

  • Clear version identification
  • Easier rollback
  • Better deployment traceability
  • Easier troubleshooting

For production workloads, versioned image tags are generally a better operational practice.


24. Container Logs and Troubleshooting

When a container doesn’t start correctly, examine the container logs.

Common problems include:

Wrong port

The application listens on:

5000

but App Service expects:

8080

Application crashes

For example:

ModuleNotFoundError

or:

Connection refused

Incorrect environment variable

The application expects:

DATABASE_URL

but App Service defines:

DB_URL

Secret resolution failure

The Key Vault reference isn’t resolving.

Startup command failure

The command specified by App Service doesn’t exist or fails.


25. Container Startup Timeout

Custom containers sometimes take longer to initialize than expected.

App Service provides the WEBSITES_CONTAINER_START_TIME_LIMIT setting to control how long the platform waits for a container to start.

The documented default is 230 seconds, with a maximum of 1,800 seconds.

This can matter for AI applications that have relatively large startup workloads.

However, increasing the startup timeout should not be the first response to every startup problem.

First determine why startup is slow.

For example:

  • Is the container downloading dependencies at startup?
  • Is the application loading a large model?
  • Is it waiting for an external service?
  • Is the application listening on the wrong port?
  • Is the startup command incorrect?

26. HTTPS and Custom Containers

A custom container doesn’t necessarily need to implement HTTPS itself when hosted through App Service.

App Service can handle HTTPS termination at the platform’s front ends.

Therefore, an application can commonly listen for HTTP inside the container while clients connect to the application through HTTPS.

Conceptually:

Client
|
HTTPS
|
v
App Service
|
HTTP
|
v
Container

This is different from saying that application traffic is universally unprotected in every internal configuration; networking and security architecture still matter.


27. Continuous Deployment for Containers

App Service can integrate with container registries to support automated deployments.

A common flow is:

Developer
|
v
Source Repository
|
v
Build
|
v
Container Image
|
v
Azure Container Registry
|
v
App Service

A registry push can be used to trigger a deployment/restart workflow.

App Service supports continuous deployment scenarios involving container registries, including Azure Container Registry.

For production systems, CI/CD is generally preferable to manually rebuilding and deploying containers.


28. A Recommended AI Application Architecture

A reasonable architecture for an AI application hosted in a container on App Service might look like this:

                         Azure Container Registry
                                  |
                                  | Container Image
                                  v
                         +-------------------+
                         |   Azure App       |
                         |     Service       |
                         +---------+---------+
                                   |
                    +--------------+--------------+
                    |                             |
             Environment Variables          Managed Identity
                    |                             |
                    |                             v
                    |                      Azure Key Vault
                    |                             |
                    |                           Secrets
                    |
                    +--------------------+
                                         |
                                         v
                                  AI Application
                                         |
                  +----------------------+----------------+
                  |                      |                 |
                  v                      v                 v
             Azure AI             Azure Database      Azure Storage

The container image contains the application.

App Service provides environment-specific configuration.

Managed identity provides secure access to Azure resources.

Key Vault stores secrets.

This is a strong pattern to recognize in AI-200 scenario questions.


29. Security Best Practices

For the exam, remember these principles.

Don’t hard-code secrets

Avoid:

API_KEY=abc123

inside source code or Dockerfiles.

Don’t put secrets in image layers

Building a secret into an image doesn’t make it secure simply because the image is stored in a private registry.

Use managed identities

When Azure services support Microsoft Entra authentication and managed identities, prefer them over long-lived credentials.

Use Key Vault for secrets

Store sensitive values centrally.

Use least privilege

Grant the App Service identity only the permissions it requires.

Separate environments

Development, testing, and production should have appropriately separated configuration and secrets.

Use versioned images

Prefer:

myapp:1.2.3

over relying exclusively on:

myapp:latest

30. Important AI-200 Exam Concepts to Remember

The following relationships are particularly important:

ConceptRemember
Custom containerRuns your own container image in App Service
Azure Container RegistryCommon private registry for App Service container images
App settingsBecome environment variables
WEBSITES_PORTIdentifies the port used by a custom container
Startup commandControls/overrides how the container application starts
Key VaultSecure centralized secret management
Key Vault referenceAllows an App Service setting to reference a Key Vault secret
Managed identityAvoids storing credentials for Azure resource access
System-assigned identityLifecycle tied to the Azure resource
User-assigned identitySeparate reusable identity resource
App setting changesCause an application restart
Image updateRestart causes App Service to pull the updated image
latestConvenient but less predictable
Versioned tagsBetter traceability and rollback
Container logsImportant for startup/runtime troubleshooting
WEBSITES_CONTAINER_START_TIME_LIMITControls custom-container startup wait time

Practice Exam Questions

Question 1

You have a Python-based AI API packaged as a Linux container. The application listens on port 8080 inside the container.

You deploy the container to Azure App Service, but requests to the application fail because App Service cannot connect to the application.

Which App Service setting should you verify first?

A. WEBSITE_RESOURCE_GROUP

B. WEBSITE_SITE_NAME

C. WEBSITES_PORT

D. WEBSITE_SKU

Answer: C

Explanation

For custom containers, App Service needs to know which port the container is listening on. If the application listens on port 8080, configuring:

WEBSITES_PORT=8080

helps App Service route traffic to the correct container port.

The other settings describe the App Service environment but do not determine the container’s application port.


Question 2

An AI application is deployed as a container to Azure App Service. The application requires an API key that changes periodically.

The development team wants to avoid storing the API key in source code, the Dockerfile, or the container image.

Which solution provides the best approach?

A. Store the API key in the Dockerfile as an ENV value.

B. Store the API key in Azure Key Vault and reference it from an App Service application setting.

C. Store the API key in the container image and use a private Azure Container Registry.

D. Store the API key in the application’s source code and protect the repository with RBAC.

Answer: B

Explanation

Azure Key Vault is designed for centralized secret management. App Service can use a Key Vault reference as an application setting, allowing the application to consume the secret as an environment variable without embedding the secret in the image or source code.

A private container registry protects access to the image but does not make secrets embedded inside the image a good security practice.


Question 3

An Azure App Service application uses a Key Vault reference to retrieve an API key. The application is receiving the literal Key Vault reference string rather than the expected secret value.

Which issue should you investigate?

A. Whether the Dockerfile contains an EXPOSE instruction

B. Whether WEBSITES_PORT matches the application port

C. Whether the App Service managed identity has permission to read the Key Vault secret

D. Whether the image uses the latest tag

Answer: C

Explanation

A Key Vault reference must be resolved by App Service. The application’s managed identity needs permission to retrieve the referenced secret.

A missing or incorrectly configured identity, missing Key Vault permissions, an invalid secret name, or other Key Vault configuration problems can prevent resolution.

The port and image tag are unrelated to Key Vault reference resolution.


Question 4

A development team wants to deploy the same container image to development, test, and production environments. The AI endpoint differs between environments.

What is the best approach?

A. Build a separate Docker image for each environment.

B. Store all three endpoints in the Dockerfile and select one at runtime.

C. Create separate source-code branches containing different endpoint values.

D. Store the endpoint as an App Service application setting in each environment.

Answer: D

Explanation

Environment-specific configuration should be separated from the application image.

Each App Service environment can provide its own application setting:

AI_ENDPOINT=https://development...

or:

AI_ENDPOINT=https://production...

The same container image can therefore be deployed across environments.


Question 5

A developer pushes a new version of an image to Azure Container Registry using the same latest tag that an App Service application is already configured to use.

When should the developer expect App Service to retrieve the updated image?

A. When the running container is restarted

B. Immediately when the image is pushed

C. Only when the App Service plan is resized

D. Only after the image tag is deleted

Answer: A

Explanation

App Service pulls the configured container image when the application starts. If an updated image is pushed using the same tag, restarting the App Service causes the updated image to be pulled.

This is one reason explicit version tags are often preferable for controlled production deployments.


Question 6

An organization wants an App Service application to retrieve secrets from Azure Key Vault without storing a Key Vault password or service principal secret in the application.

Which feature should be used?

A. Docker ENV instructions

B. Managed identity

C. App Service startup command

D. Container port mapping

Answer: B

Explanation

Managed identity allows Azure resources such as App Service to authenticate to supported Azure services without requiring developers to store credentials in application configuration.

For Key Vault references, App Service can use its system-assigned managed identity by default or a configured user-assigned identity.


Question 7

An AI container deployed to App Service takes approximately five minutes to initialize because it performs a large initialization operation before listening for HTTP traffic.

The platform terminates the container before initialization completes.

Which setting can be used to increase the amount of time App Service waits for the container to start?

A. WEBSITES_PORT

B. WEBSITE_SITE_NAME

C. WEBSITES_CONTAINER_START_TIME_LIMIT

D. WEBSITE_WARMUP_PATH

Answer: C

Explanation

WEBSITES_CONTAINER_START_TIME_LIMIT controls how long App Service waits for a custom container to start.

The documented default is 230 seconds and the maximum is 1,800 seconds.

However, increasing the timeout should be done only after determining that the startup delay is legitimate rather than caused by a configuration or application problem.


Question 8

An application administrator changes the value of an App Service application setting.

What should the administrator expect?

A. The setting changes only the next time a new container image is deployed.

B. The setting changes the Dockerfile stored in Azure Container Registry.

C. App Service restarts the application so that the new setting can be supplied to the application environment.

D. The setting automatically modifies the source code in the application repository.

Answer: C

Explanation

App Service application settings are supplied to the application as environment variables. Changes to application settings cause the application to restart, allowing the new configuration to be supplied to the running application.

The setting does not modify the container image, Dockerfile, or source repository.


Question 9

You are designing a production AI application running in a custom container on Azure App Service. The application requires an API key.

Which design provides the strongest separation between application code and the secret?

A. Store the secret in Azure Key Vault and expose it to the application through an App Service Key Vault reference.

B. Store the secret in the Dockerfile using an ENV instruction.

C. Store the secret in a text file inside the container image.

D. Store the secret in the application’s source code and restrict repository access.

Answer: A

Explanation

A Key Vault reference allows the secret to remain in Azure Key Vault while the application consumes it through an App Service configuration setting.

This provides better separation between:

  • Application code
  • Container image
  • Deployment configuration
  • Secrets

The App Service managed identity can be granted the minimum required permissions to retrieve the secret.


Question 10

An organization has multiple App Service applications that need to use the same identity when accessing Azure Key Vault. The identity must also be able to exist independently of the lifecycle of any individual App Service application.

Which type of managed identity should be used?

A. System-assigned managed identity

B. App Service publishing credentials

C. User-assigned managed identity

D. Container registry administrator credentials

Answer: C

Explanation

A user-assigned managed identity is a standalone Azure resource that can be assigned to multiple Azure resources.

This makes it appropriate when:

  • Multiple applications need the same identity.
  • The identity needs an independent lifecycle.
  • The identity must exist before an application is created.
  • The organization wants to reuse the identity across resources.

A system-assigned identity is tied to the lifecycle of its associated Azure resource.


Final Exam Takeaways

For AI-200, the most important mental model is:

The container image contains the application; App Service supplies the environment-specific configuration; Key Vault protects sensitive values; managed identity provides secure access to Azure resources.

When you encounter an exam scenario, think through the problem in this order:

  1. Where is the container image?
    • Azure Container Registry?
    • Another private registry?
    • Public registry?
  2. Can App Service pull the image?
    • Is authentication configured?
    • Would managed identity be appropriate?
  3. What port does the application actually listen on?
    • Does it match the App Service configuration?
    • Is WEBSITES_PORT configured appropriately?
  4. How does the application receive configuration?
    • App Service application settings
    • Environment variables
  5. Does the configuration contain a secret?
    • Use Azure Key Vault rather than embedding the secret in the image or source code.
  6. How does App Service access Key Vault?
    • Managed identity
    • Appropriate Key Vault permissions
  7. Is the container starting correctly?
    • Startup command
    • Container logs
    • Port
    • Environment variables
    • Startup timeout
  8. How is the image version managed?
    • Prefer identifiable/versioned image tags for production deployments.
    • Understand what happens when an image behind a tag is replaced.

These distinctions—particularly App Service settings vs. container image contents, environment variables vs. secrets, Key Vault references vs. hard-coded credentials, and system-assigned vs. user-assigned managed identities—are exactly the kinds of distinctions that can turn a plausible answer into the correct AI-200 answer.


Go to the AI-200 Exam Prep Hub main page