Azure App Service's Two Basic Auth Policies, Not One
Overview
Azure App Service has two basic authentication policies, one for SCM publishing and a separate one for FTP. Turning off only the SCM policy leaves leaked publish profile credentials able to authenticate over FTPS, so both settings need checking.
Quick answer
Azure App Service has separate basic-authentication policies for the application endpoint and the SCM or Kudu endpoint. Disabling only one leaves the other exposure intact, so both settings must be changed and independently verified after deployment.
At a glance
- Symptom
- SCM basic auth is re-enabled for a legacy pipeline while the ftp policy still allows basic auth, so a leaked publish profile can again…
- Likely cause
- The scm basic-auth toggle is disabled while the ftp basicPublishingCredentialsPolicies resource remains enabled independently.
- Impact
- Attackers gain persistent code execution through an FTP-uploaded webshell, which is served on every request until someone deletes it.
- Verification signal
- Re-run the detection test and a controlled negative-path test.
- Safe correction
- Disable both scm and ftp basicPublishingCredentialsPolicies resources explicitly, set ftpsState to Disabled, and rotate publish profiles.
- Rollback or recovery
- Rerun the two policy commands with allow=true and restore the recorded ftpsState if a required deployment breaks; the publish-profile password reset cannot be undone.
The Trap
Azure App Service exposes two separate basic-auth publishing policies under Microsoft.Web/sites/basicPublishingCredentialsPolicies: one named scm, one named ftp. The Portal’s Configuration > General settings page shows separate “SCM Basic Auth Publishing Credentials” and “FTP Basic Auth Publishing Credentials” toggles. Each must be disabled on its own.
Microsoft notes that SCM basic auth is required for enabling FTP basic auth, which makes turning off SCM alone look sufficient. It is not: the ftp policy still reads allow: true, so when someone re-enables SCM for a legacy pipeline, FTPS basic auth returns with it.
The Default State
Microsoft now disables basic auth by default for new apps, but older apps commonly carry both policy children at properties.allow: true, often with ftpsState set to AllAllowed. The publish profile generated at site creation contains a static username and password tied to the site itself, not to Entra ID, and it does not expire or rotate on any schedule. Always On changes none of this; it only stops the worker idling out.
The Blast Radius
Publish profiles leak routinely: committed into CI pipeline logs, left in old zip-deploy scripts, or pasted into ticketing systems during migrations. An attacker holding a leaked profile connects over FTPS, uploads an aspx or php shell into /site/wwwroot, on any app where both policies allow basic auth.
The shell is a file on disk, so it is served on every request until someone deletes it. Successful and attempted FTP and Web Deploy logins are logged to AppServiceAuditLogs, but only if a diagnostic setting sends that log type to Azure Monitor.
The Lead Mechanic Fix
First confirm no pipeline or tool still deploys with a publish profile, FTP or local Git, since those stop working; move them to Entra ID and test on a non-production app. Then disable both policies explicitly (slots have their own) and remove FTP where it isn’t required.
Record the current FTPS setting first with az webapp config show --resource-group <rg> --name <app-name> --query ftpsState. To roll back, rerun the two policy commands with allow=true and set --ftps-state back to the recorded value; the password reset further down cannot be rolled back:
az resource update --resource-group <rg> --namespace Microsoft.Web --resource-type basicPublishingCredentialsPolicies --parent sites/<app-name> --name ftp --set properties.allow=false
az resource update --resource-group <rg> --namespace Microsoft.Web --resource-type basicPublishingCredentialsPolicies --parent sites/<app-name> --name scm --set properties.allow=false
az webapp config set --resource-group <rg> --name <app-name> --ftps-state Disabled
Then reset the app-scope password a leaked profile contains with the documented newpassword action, az resource invoke-action --action newpassword --resource-group <rg> --name <app-name> --resource-type Microsoft.Web/sites (not az webapp deployment user set, which changes user-scope credentials for every app). The reset cannot be undone: the old profile stops working everywhere, so re-download it for any tool not yet migrated. Then move deployment to OIDC-federated GitHub Actions or Entra ID-authenticated pipelines so no static publish credential exists to leak.
Related reading
Apply the safer control
Before you change production
Confirm the affected scope, export the current configuration, and test the replacement control in a non-production environment first.
Fix commands and configuration
az webapp config show --resource-group <rg> --name <app-name> --query ftpsStateallow=true--ftps-stateVerify, roll back or escalate
Verify
Re-run the detection test and a controlled negative-path test. Confirm the unsafe behaviour is blocked while approved traffic still succeeds.
Rollback
Rerun the two policy commands with allow=true and restore the recorded ftpsState if a required deployment breaks; the publish-profile password reset cannot be undone.
Escalate
Escalate when the blast radius is uncertain, the control cannot be tested safely, or remediation requires an outage or security exception.
Fixed? Get the next one before it hits you: The KBY Brief
Practical fixes for the systems you run, by email about twice a week. Unsubscribe at any time.
About this page
Credited to
Dates
Published
Last updated
Was this useful?
Reports go to the site owner and are used to correct pages. Corrections are listed at /corrections.
Found this useful? Follow KBY for more like it.
