App Platform Security
Functions · Logic Apps · App Service · Web Application Firewall · API Management policies
By the tools4free.dev team · Last reviewed November 13, 2026
Practice questions for this topic →
Azure Functions: securing HTTP endpoints
Functions runs on App Service infrastructure. Microsoft lists these techniques for public HTTP endpoints, ordered from most basic to most secure and restrictive:
| Technique | What it does |
|---|---|
| Require HTTPS | Clients can use HTTP or HTTPS by default. Redirect HTTP to HTTPS so the connection is encrypted and authenticated. |
| Require access keys | Anything except the anonymous level needs a key in the request. |
| App Service Authentication/Authorization | Sign in clients with Microsoft Entra ID or another identity provider and make authorization decisions on identity. |
| Azure API Management | Authenticate requests in API Management. You can configure the function app to accept requests only from the API Management IP address. |
| Deploy to a virtual network | Use a private endpoint (Flex Consumption, Elastic Premium or Dedicated plans). |
| Deploy in isolation | Use an App Service Environment, a dedicated hosting environment. |
HTTP trigger authorization levels
| Level | Key required |
|---|---|
anonymous | No access key |
function | A function-specific key |
admin | The master key |
Access keys only make access harder. Microsoft says the only way to truly secure endpoints is positive authentication of clients, so use identity (App Service authentication or API Management) when you must know who called.
- Administrative endpoints: function apps can serve
/adminendpoints. To disable them, set thefunctionsRuntimeAdminIsolationEnabledsite property totrue. - Azure RBAC for Functions: Contributor, Owner and Reader. Permissions apply at function app level, Contributor is needed for most app-level tasks, and only Owner can delete a function app.
- Managed identities: a system-assigned identity is tied to the app (one per app, deleted with the app). A user-assigned identity is a separate resource and an app can have several.
- Secrets: never store secrets in function code. App settings and connection strings are encrypted by Azure. Use a Key Vault reference in place of a connection string or key. Credentials in app settings give every function in the app the same permissions, so split functions by privilege into separate apps.
- CORS: do not use wildcards in the allowed origins list. List the specific domains.
- Operations: keep remote debugging disabled unless you are debugging. Each function app has an FTP endpoint enabled by default, so keep it disabled when unused. Set a daily GB-sec quota on Consumption plan apps. Triggers and bindings do no extra data validation, so your code must validate input.
- Deployment credentials: app-scope credentials deploy that one app only. The Reader role cannot publish and cannot access them. The
scm(Kudu) endpoint needs securing too when you use network isolation. - Defender for Cloud: function apps on a dedicated plan can use its enhanced security features for an extra cost.
Network access for Functions and App Service
| Need | Feature | Remember |
|---|---|---|
| Keep the public endpoint, allow or deny sources | Access restrictions | Priority-ordered allow/deny list. With one or more entries an implicit deny all ends the list. Lowest priority number is enforced first. Limit of 512 rules. |
| Restrict a subnet | Access restriction rule of type Virtual Network (service endpoint) | Does not work for apps in an App Service Environment; control access there with IP rules. |
| Private IP inbound | Private endpoint | Disable public network access to get isolation. Access restriction rules are not evaluated for private endpoint traffic. |
| Outbound to private resources | Virtual network integration | Outbound only. Does not give private inbound access. |
| Block or filter outbound from integration | NSG on the integration subnet | Inbound NSG rules do not apply because integration provides no inbound access. |
Functions hosting plans
| Plan | Inbound access restrictions | Private endpoint | Outbound VNet integration |
|---|---|---|---|
| Flex Consumption | Supported | Supported | Supported |
| Consumption | Supported | Not supported | Not supported |
| Elastic Premium | Supported | Supported | Supported |
| Dedicated (App Service) | Supported | Supported | Supported |
- Private endpoint plans (App Service): Basic, Standard, PremiumV2, PremiumV3, PremiumV4, IsolatedV2 and Functions Premium.
- Slots: each slot is configured separately, up to 100 private endpoints per slot, and a private endpoint cannot be shared between slots.
- Subnets: VNet integration cannot use the same subnet as the private endpoint. The private endpoint subnet can hold other resources.
- DNS: calls must resolve to the private endpoint. For App Service the DNS zone is
privatelink.azurewebsites.net, using a private DNS server or an Azure DNS private zone. - Route all traffic: with all traffic routing enabled, all outbound traffic goes into the virtual network; otherwise only private (RFC1918) traffic and service endpoints do. Linux apps that connect to private endpoints must be explicitly set to route all traffic through the virtual network (automatic on Flex Consumption).
- Subnet size: it cannot be changed after assignment, so size it for the scale you might reach.
- Permissions for a service endpoint rule:
Microsoft.Network/virtualNetworks/subnets/joinViaServiceEndpoint/actionon the subnet, plus site config read/write.
App Service: authentication, identity and secrets
- Built-in authentication (Easy Auth): signs users in with federated providers (Microsoft Entra, Facebook, Google, X, GitHub, Apple (preview), any OpenID Connect provider). By default it provides only authentication, not authorization.
- Unauthenticated requests: Require authentication rejects them. The 302 redirect is recommended for websites and 401 Unauthorized is recommended for APIs. Allow anonymous requests authenticates without restricting access.
- Entra provider default: any user in your Microsoft Entra tenant can request a token for the app, unless you restrict the app to a defined set of users in Entra.
- HTTPS: enabling built-in authentication redirects all requests to HTTPS regardless of the HTTPS-only setting. Without it, HTTPS-only redirect is not on by default, and TLS 1.2 is the default minimum. Set the minimum TLS version for both the web app and the SCM site.
- Slots: use separate app registrations for separate deployment slots.
- Front Door: disable Azure Front Door caching for the authentication workflow.
- Basic authentication: disable it for FTP and SCM and prefer Microsoft Entra ID. Use FTPS only if you use FTP.
- Managed identity: configuration is specific to the slot. The platform manages the identity so you do not provision or rotate secrets.
- Key Vault references: format
@Microsoft.KeyVault(SecretUri=...). They use the system-assigned identity by default. Grant Key Vault Secrets User (Azure RBAC model) or the Get secrets permission (access policy model). Without a version, the app picks up a rotated secret within 24 hours; a config change restarts the app and refetches immediately. - Network-restricted vault: the app needs outbound network access to the vault. A 403 SecretGet from the app's public IP in vault audit logs, followed by success from its private IP, is by design.
- WAF in front: Microsoft recommends Azure Front Door or Application Gateway with WAF in front of an App Service app.
Azure Logic Apps
| Plan type | Built-in roles named by Learn |
|---|---|
| Consumption | Logic App Contributor (manage workflows, cannot change access), Logic App Operator (read, enable, disable; cannot edit), Contributor |
| Standard | Logic Apps Standard Reader, Operator, Developer, Contributor |
- Managed identity risk: Contributor or workflow-editing permission equals holding the permissions of every managed identity assigned to that workflow.
- Request trigger access (Consumption): the endpoint URL carries a SAS, enabled by default. A trigger accepts one scheme: OAuth 2.0 with Microsoft Entra ID or SAS. Using both at once causes an error. You can disable SAS and require only Entra OAuth.
- Inbound IP restriction: IP address restriction affects both triggers and actions (Consumption), or use the Access restrictions page on a Standard app (Enabled from select virtual networks and IP addresses). You can still run a workflow through the Workflow Triggers - Run operation or API Management regardless of the IP list.
- Run history: restrict who can read inputs and outputs by IP range (
0.0.0.0-0.0.0.0blocks everyone). Or obscure inputs and outputs on a trigger or action: secured data is not sent to Log Analytics and the workflow history API does not return secured outputs. - Managed identities: a Consumption app uses the system-assigned identity or a single user-assigned identity. A Standard app can have the system-assigned and several user-assigned identities enabled, but selects one at a time. Microsoft recommends Entra ID with managed identities for authentication whenever possible.
- Standard and private networking: private endpoints for inbound, virtual network integration for outbound. You must be connected to the virtual network to call the workflow. Managed API webhook (push) triggers such as Event Grid cannot work because they run in the public cloud. Private Link does not affect outbound traffic.
- Protect against change: use an Azure Resource Lock to stop others changing or deleting a workflow.
Azure Web Application Firewall
| Item | Front Door WAF | Application Gateway WAF |
|---|---|---|
| Rule base | Default Rule Set (DRS), Microsoft-managed | OWASP Core Rule Set (CRS) |
| Tiers | Premium has full capabilities. Standard supports only custom rules. | WAF_v1 and WAF_v2. Policy associations only on WAF_v2. |
| Policy scope | Profile, domain or route. The most specific scope wins (route, then domain, then profile). | Whole gateway (global), a listener, or a path-based rule. |
| Modes | Detection (log only) and Prevention | Detection and Prevention. A new policy defaults to Detection. |
| Default block response | 403 with "The request is blocked." A custom status and message are policy-level. | Not stated in the pages used |
- Policy state: when a Front Door policy is disabled, requests bypass WAF inspection and go to the back ends.
- Custom rules: match rules and rate limit rules. Priority numbers are unique and the lower value is evaluated first. Evaluation stops on any action except Log. Allow, Block and Redirect exit. Custom rules run before the managed rule set.
- DRS defaults: DRS is enabled by default in Detection mode. DRS 2.0 and above uses anomaly scoring; earlier versions block requests that trigger rules. Changing the rule set version resets your rule customizations.
- Exclusions: exclusions skip a request attribute (for example an Entra token header) from evaluation at rule set, rule group or rule scope. Keep them narrow and prefer per-rule exclusions.
- Application Gateway: one gateway can host up to 40 websites that use WAF. A listener policy applies only to that listener; the global policy still covers listeners without their own.
API Management: protecting the back end
| Policy | Use it to | Key details |
|---|---|---|
validate-jwt | Enforce a valid JWT from an identity provider | Token from header, query parameter or value. Failed validation returns 401 by default. require-expiration-time defaults to true. |
ip-filter | Allow or deny callers by IP or range | allow: unlisted callers are denied. forbid: unlisted callers are allowed. Inbound section. |
rate-limit | Stop short usage spikes per subscription | Caller gets 429 Too Many Requests. Window up to 300 seconds. Depends on the subscription key. |
quota / quota-by-key | Cap calls or bandwidth over longer periods | Use with rate limits for brute-force and resource-consumption threats. |
authentication-managed-identity | Authenticate API Management to a back end | Sets a bearer token in Authorization. System-assigned identity if no client-id. resource is the target API application ID. |
| Client certificates (mTLS) | Authenticate clients to API Management | Certificate in CER or PFX. Key Vault references update within 4 hours of a vault change. |
- Protect an API with Entra: register an application for the API in Microsoft Entra ID, then configure validate-jwt to validate the OAuth token on each request. Microsoft's pages differ here: the validate-jwt policy page says to use
validate-azure-ad-tokenfor a token provided by Microsoft Entra, while the protect-an-API how-to uses validate-jwt. - Microsoft's OWASP guidance: use Entra for API authentication; set
require-expiration-timeandrequire-signed-tokensto true with validate-jwt; use rate limiting against brute force; use client IP filtering to reduce attack surface; pass tokens in headers, not URLs; do not use wildcards in a CORS policy. - Back-end identity caution: users who can edit policies can use authentication-managed-identity to authenticate as the service's managed identity once an identity is assigned.
- Consumption tier: CA certificates for certificate validation are not supported.
CLI and PowerShell
| Task | Azure CLI | PowerShell |
|---|---|---|
| Add an App Service access restriction rule | az webapp config access-restriction add --resource-group ResourceGroup --name AppName --rule-name 'IP example rule' --action Allow --ip-address 122.133.144.0/24 --priority 100 | Add-AzWebAppAccessRestrictionRule -ResourceGroupName "ResourceGroup" -WebAppName "AppName" -Name "Multi-source rule" -IpAddress "192.168.1.0/24,192.168.10.0/24,192.168.100.0/24" -Priority 100 -Action Allow |
| Allow Azure Front Door only (service tag rule) | az webapp config access-restriction add --resource-group ResourceGroup --name AppName --rule-name "Azure Front Door example" --action Allow --priority 200 --service-tag AzureFrontDoor.Backend --http-header x-azure-fdid=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | - |
| Assign a system-assigned managed identity to an app | az webapp identity assign --resource-group <group-name> --name <app-name> | Set-AzWebApp -AssignIdentity $true -ResourceGroupName <group-name> -Name <app-name> |
| Route all outbound traffic through the virtual network (Key Vault reference to a restricted vault) | az webapp config set --resource-group <group-name> --subscription <subscription> --name <app-name> --generic-configurations '{"vnetRouteAllEnabled": true}' | Update-AzFunctionAppSetting -Name <app-name> -ResourceGroupName <group-name> -AppSetting @{vnetRouteAllEnabled = $true} |
Exam Tips
Tick each tip once you can answer it without looking.
“HTTP trigger must need the master key” → authorization level admin. Trap: function needs only a function-specific key; anonymous needs none.
“Function endpoint must identify the caller, not just hold a key” → App Service authentication or API Management; keys only make access harder. Trap: An access key says the caller has the key, not who the caller is.
“Consumption-plan function must be reachable on a private IP only” → Move to Flex Consumption, Elastic Premium or Dedicated and add a private endpoint. Trap: Consumption supports no private endpoint and no outbound virtual network integration.
“Turn off the function /admin endpoints” → Set functionsRuntimeAdminIsolationEnabled to true. Trap: Exposed admin endpoints take the app's master key.
“App with a private endpoint is still reachable from the internet” → Disable public network access. Trap: Private endpoints and public access coexist. Access restrictions are not evaluated for private endpoint traffic.
“Give an app private inbound access from a virtual network” → Private endpoint. Trap: Virtual network integration is outbound only and cannot share the private endpoint's subnet.
“Request matches no access restriction rule” → Denied (implicit deny all once any rule exists); lowest priority number is enforced first. Trap: The default with no rules is to accept traffic from any address.
“Easy Auth on a REST API: what to return to anonymous callers” → HTTP 401 Unauthorized. Trap: 302 redirect is recommended for websites. Authentication alone does not authorize; check claims in your app.
“App setting must read a secret from Key Vault with Azure RBAC” → Key Vault Secrets User on the app's managed identity; a rotated secret arrives within 24 hours. Trap: Get secrets is the access-policy model equivalent.
“Consumption Request trigger must accept only Entra OAuth” → Add an authorization policy and disable SAS authentication. Trap: Both schemes together raise an error.
“Hide one action's output in run history and keep it out of Log Analytics” → Secure inputs or outputs on that action. Trap: An IP range of 0.0.0.0-0.0.0.0 hides all inputs and outputs from everyone.
“Standard logic app behind a private endpoint, Event Grid trigger fails” → Managed API webhook triggers run in the public cloud and cannot call a private network. Trap: Private Link does not affect outbound traffic.
“Front Door WAF needs the managed Default Rule Set” → Premium tier. Trap: Standard supports only custom rules.
“Different WAF rules for one site on Application Gateway” → A policy associated with that listener (WAF_v2). Trap: A global policy applies to every site; policy associations are not supported on WAF_v1.
“WAF custom rule that logs but must not stop evaluation” → Action Log; lower priority numbers run first and custom rules run before the Default Rule Set. Trap: Allow, Block and Redirect all exit.
“WAF blocks a legitimate Entra token header” → Per-rule exclusion for that header, as narrow as possible. Trap: A rule-set-wide exclusion leaves more room for attackers.
“API Management calls a Microsoft Entra back end without secrets” → authentication-managed-identity with resource = the API's application ID. Trap: validate-jwt checks inbound tokens; it does not authenticate to the back end.
“API Management: allow only a partner's address range” → ip-filter with action allow. Trap: With forbid, unlisted callers are allowed.
Sources
- Securing Azure Functions
- Azure Functions HTTP trigger
- Azure Functions networking options
- App Service authentication and authorization
- Secure your App Service deployment
- App Service access restrictions (set up)
- Private endpoints for App Service apps
- App Service virtual network integration
- Key Vault references for App Service
- Managed identities for App Service
- Secure access and data in Logic Apps workflows
- Secure traffic between Standard workflows and virtual networks
- API Management validate-jwt policy
- API Management ip-filter policy
- API Management rate-limit policy
- API Management authentication-managed-identity policy
- API Management client certificate authentication
- Mitigate OWASP API threats with API Management
- Protect an API with OAuth 2.0 and Microsoft Entra ID
- API Management policies reference
- Azure WAF on Front Door overview
- WAF policy settings for Front Door
- WAF custom rules for Front Door
- Front Door WAF DRS rule groups
- WAF exclusion lists in Front Door
- Azure WAF on Application Gateway
- WAF policy overview (Application Gateway)
- Create WAF policies for Application Gateway
Checked against Microsoft Learn on November 13, 2026.