Skip to content
Least Privilege Principle

Least privilege for Azure Functions means managed identities, Website Contributor and no master key

Azure Functions supports only Contributor, Owner and Reader at the function app level. Microsoft's documentation, read 16 Nov 2026, advises running the app with the lowest possible permissions, using managed identities for connections, and disabling the administrative endpoints that require the app's master key.

Open the calculator ยท All services

Azure Functions has two permission surfaces: who manages the app and what the app can reach

Microsoft's documentation says Functions supports Azure RBAC with three supported roles: Contributor, Owner and Reader. Permissions take effect at the function app level. Contributor is required for most function app tasks, and only Owner can delete a function app.

The second surface is the identity the app runs as. Microsoft says a managed identity from Microsoft Entra ID lets the app reach other protected resources, such as Key Vault, with the platform managing the identity so there is no secret to provision or rotate.

Microsoft's advice for this second surface is plain: as with any application or service, run your function app with the lowest possible permissions.

The identities that call this service (people, services, workloads, third parties) are covered in the Azure service identities guide and the workload identities guide.

Settings and roles to avoid, with the documented reason

The documented risks sit in keys, shared credentials and wide roles.

  • The master key on exposed /admin endpoints: Microsoft says administrative endpoints require the app's master key when exposed, and describes setting the functionsRuntimeAdminIsolationEnabled site property to disable them.
  • Contributor on a function app for people who only read logs: Microsoft says log data in Application Insights needs Contributor together with the Monitoring Reader permission, so check whether Reader plus Monitoring Reader meets the need.
  • Connection strings in app settings: Microsoft says identity-based connections give more fine-grained access control and auditing than secrets, and describes Key Vault references as the alternative where a secret must exist.
  • Wildcards in the CORS allowed origins list: Microsoft says to list the specific domains instead.

A minimal binding for a person who publishes one app

Microsoft's documentation says a user needs at least Contributor level permissions on an app, including the built-in Website Contributor role, to be granted access to app-level deployment credentials through RBAC. Reader cannot publish.

ItemValue
RoleWebsite Contributor
Microsoft's descriptionManage websites, but not web plans. Does not allow you to assign roles in Azure RBAC.
ScopeThe single function app or its resource group
App identityA managed identity granted a data role on each dependency, for example Key Vault Secrets User on one vault

Function-level controls narrow what an attacker or a mistake can reach

Microsoft lists several controls. Use App Service Authentication, or Azure API Management in front of the app, so that callers are authenticated and authorized by identity. Restrict access to the APIM instance's IP address. Run the app inside a virtual network with private endpoints for the highest level of security.

Set a daily GB-sec usage quota on Consumption plan apps to limit execution if malicious code runs. Application-scope deployment credentials can deploy only that app and cannot be configured manually, while user-scope credentials work across every app the user can access.

Checking what is used

Microsoft says Functions integrates with Application Insights and with Azure Monitor Logs through diagnostic settings, which can stream platform logs to a Log Analytics workspace. Use those logs to list which connections the app really calls, then remove roles for the rest.

Defender for Cloud permissions management reports excessive and unused permissions for managed identities, according to Microsoft's documentation. Review the identity of each function app with it before you widen any role.

Sources

  1. Securing Azure Functions, read 16 Nov 2026
  2. Azure built-in roles for web and mobile, read 16 Nov 2026
  3. Defender for Cloud permissions management, read 16 Nov 2026

Last reviewed 16 Nov 2026.