02. VBAuth WhitePaper Permissions

VBAuth

Technical White Paper

Microsoft Graph API Permissions and Security: Why Delegated Permissions Are the Only Safe Choice

Peter Bryant — Corylus Business Systems | Andrew Richards — The IT Service Ltd

1. Background

Microsoft’s decision to introduce New Outlook — built on a modern WebView2-based architecture sharing its codebase with Outlook on the web, and never including the COM object model — has broken the traditional COM object model that Access developers have relied on for decades.

The replacement is the Microsoft Graph API: a REST-based interface that provides access to Microsoft 365 services including Exchange, SharePoint, Teams, and Azure Active Directory. Calling Graph API requires OAuth 2.0 authentication via Microsoft Entra ID (formerly Azure Active Directory).

For Access developers, this creates an unfamiliar challenge. OAuth 2.0 is well understood in the web development world, but the VBA environment has no built-in support for it. Developers searching for solutions quickly encounter two approaches: delegated permissions and application permissions. The choice between them has profound security implications that are not always clearly explained in online guidance.

This paper explains the difference between the two approaches, demonstrates why application permissions represent a serious and underappreciated security risk, and explains how VBAuth addresses this by implementing delegated permissions exclusively.

2. The Two Permission Models

2.1 Delegated Permissions

With delegated permissions, an application acts on behalf of a signed-in user. The application requests permission to perform actions, but those actions are always executed in the context of a specific authenticated user.

To obtain a token using delegated permissions, the user must sign in interactively. This means:

  • The user’s identity is verified by Microsoft Entra ID.


  • Multi-factor authentication (MFA) is enforced if the tenant requires it.


  • Conditional Access policies apply — device compliance, location restrictions, session controls.


  • The resulting token is bound to that specific user’s identity and their permissions.


  • If the user does not have permission to perform an action, the application cannot perform it either.


The token has a lifetime of 60 to 90 minutes as defined by Microsoft Entra ID. When it expires, the user must re-authenticate.

2.2 Application Permissions

With application permissions, an application acts as itself rather than on behalf of any user. Authentication is performed using three values: the Client ID, the Tenant ID, and a Client Secret (sometimes called an application key or secret).

No user is involved in this process. The application presents its credentials directly to Microsoft Entra ID and receives a token that grants it permission to act across the tenant. This means:

  • No user authentication is required.


  • No MFA challenge is presented.


  • No Conditional Access policies apply.


  • The token is not bound to any individual user.


  • Any holder of the three credential values can obtain a token from anywhere.


Application permissions are designed for background services and daemons that run without any user being present — for example, a nightly reporting process or an automated data pipeline. They are not designed for applications that perform actions on behalf of individual users.

3. The Security Risk of Application Permissions

3.1 The Three-Value Attack Surface

The fundamental problem with application permissions in a user-facing context is that the Client Secret is the only barrier between an attacker and full access to whatever permissions the application has been granted.

If an attacker obtains the Client ID, Tenant ID, and Client Secret — three values that must exist somewhere in or near the deployed application — they can call the Microsoft Graph API as the application, from any machine, at any time, with no further authentication required. There is no MFA to stop them. There is no Conditional Access policy that can be applied. The activity may not be associated with any user identity in the audit logs.

The Client Secret in an application-permission deployment is functionally equivalent to a master key to the tenant. Whoever holds it has silent, persistent access to everything the application has been granted permission to do.

3.2 A Demonstrated Experiment

The authors of this paper conducted a controlled experiment to verify this risk. Using only the Client ID, Tenant ID, and Client Secret of an application registration configured with Mail.Send application permissions, an email was successfully sent from a mailbox in a Microsoft 365 tenant from a machine with no prior relationship to that tenant, with no user authentication of any kind.

The email was sent. The mailbox owner received it. No MFA prompt appeared. No sign-in event was recorded against any user. The entire operation was silent.

This is not a theoretical vulnerability. It was demonstrated in a real Microsoft 365 tenant using standard Microsoft Graph API calls. The only requirement was possession of three credential values.

3.3 The Credential Storage Problem

For application permissions to work in a deployed Access application, the Client Secret must be stored somewhere the application can access it at runtime. Common approaches include:

  • Embedded in VBA code or a module.


  • Stored in a local table in the Access database.


  • Stored in a configuration file on the local machine or a network share.


None of these storage locations is secure. An Access database can be opened by anyone with the file. A configuration file on a network share may be readable by many users. VBA code can be decompiled. In each case, an attacker with access to the machine, the network, or the file can retrieve the credentials and use them indefinitely until an administrator notices and rotates the secret.

3.4 Scope and Blast Radius

Application permissions such as Mail.Send, when granted at application level, typically apply across the entire tenant. A token obtained using application permissions with Mail.Send can send email as any user in the organisation, not just the user running the application. The scope of a credential compromise is therefore the entire organisation, not a single user account.

4. Why This Matters for Access Developers

Application permissions have become a workaround in the Access developer community for a specific problem: MFA. When a developer cannot resolve the challenge of presenting an interactive MFA prompt within a VBA application, application permissions offer a route that avoids authentication entirely. The application simply presents its credentials and receives a token.

This workaround is understandable — the developer’s immediate goal is to make the application work — but it transfers the security risk entirely to the client. The client’s IT team, if they are even aware of how the application has been implemented, may not realise that approving the application registration in their tenant has granted a third-party application silent, persistent access to their Microsoft 365 environment.

An IT manager who approves an Azure Entra app registration for an Access application may not understand that application permissions mean the developer’s code can access their tenant without any user ever signing in.

This is not a criticism of developers who have taken this route. The documentation around Graph API permissions is extensive and the security implications of the two models are not always clearly presented. But the risk is real and the consequences of a credential compromise can be severe.

5. How VBAuth Addresses This

5.1 Delegated Permissions Only

VBAuth uses delegated permissions exclusively. There is no application secret. There is no credential that, if stolen, grants silent access to a tenant. Every token issued by VBAuth is bound to a specific authenticated user who has signed in interactively through Microsoft Entra ID.

This means that all of the tenant’s existing security controls apply:

  • MFA is enforced wherever the tenant requires it.


  • Conditional Access policies — device compliance, location, session lifetime — are respected.


  • Activity is logged against a real user identity in the Microsoft 365 audit trail.


  • If a user’s account is disabled or their permissions are changed, that change takes effect immediately.


5.2 Short-Lived Tokens — 60 to 90 Minutes by Design

Bearer tokens issued by VBAuth have a lifetime of 60 to 90 minutes. After that window, a new authentication is required. This limited lifetime reflects careful security consideration — it bounds the window during which an intercepted token could be misused, and ensures that the authentication state of the session remains tightly coupled to the user’s active presence.

An intercepted bearer token has a short and predictable window of usefulness. The attack surface of a compromised token is bounded by its lifetime.

To understand the security properties of this approach, it helps to understand precisely what happens inside VBAuth when a token is requested. The following describes the complete lifecycle of an authentication call.

VBA calls objAuth.GetAccessToken()

→ C# GetAccessToken() begins

→ local var app created (fresh MSAL instance, empty cache)

→ interactive auth occurs

→ token returned

→ GetAccessToken() exits

→ app goes out of scope and is eligible for garbage collection

→ MSAL cache inside app goes out of scope, becomes unreferenceable, and is available for garbage collection

→ JSON string returned to VBA

VBA receives the string

MSAL’s internal token cache — the object that temporarily holds the access token and associated data during the authentication exchange — exists only for the duration of the call to GetAccessToken(). When that call returns, the authentication context goes out of scope and the memory it occupied becomes unreferenceable by any further code in the DLL or in VBA. As with all .NET objects, the memory is reclaimed when the garbage collector runs. It does not persist on the COM object that VBA holds and is unaffected by whether the developer retains or destroys that object.

The OAuth 2.0 protocol involves the exchange of short-lived tokens. As the final step in that process, VBAuth returns a bearer token to VBA with a lifetime of 60-90 minutes. When that token expires, a new authentication is required to obtain a fresh one.

Retaining the bearer token in VBA memory for its natural lifetime is both safe and good practice. The VBAuth complete demo database demonstrates this approach — caching the token in VBA memory against its expiry time and scope claims, so that switching between Entra app registrations within a session does not trigger unnecessary re-authentication where a valid token already exists. Bearer tokens should never be written to a table — temporary or otherwise — and should never be saved to disk.

It should be noted that residual data may remain in process memory until the garbage collector reclaims it — this is the same transient risk as the bearer token string that VBA itself holds. Token data held in process memory is not encrypted. Microsoft’s MSAL documentation describes optional encryption mechanisms for token caches, but these are available only in ASP.NET Core web application scenarios — Microsoft has not provided equivalent in-memory cache encryption support for .NET Framework 4.8 desktop applications. VBAuth is built on .NET Framework 4.8 because COM interop — the mechanism by which VBA calls the DLL — requires it. It is worth noting that once a token is acquired, the cache that holds it is entirely a Microsoft artifact — MSAL’s own code and memory management, outside the control of VBAuth’s DLL code entirely. VBAuth therefore has no means to apply cache encryption, and of course does not persist any token data to disk.

5.3 Tenant Binding

Each VBAuth deployment uses a cryptographically signed licence file that encodes the specific tenant IDs for which it is authorised. VBAuth.dll will not operate outside those tenants. A licence file that falls into the wrong hands cannot be used to access a different organisation’s data.

5.4 IT Retains Full Control

Because VBAuth uses delegated permissions, the client’s IT department retains complete control over the application in their own Azure Entra tenant. They can at any time:

  • Disable or delete the app registration, immediately stopping all access.


  • Revoke admin consent for specific permissions.


  • Restrict the application to specific users or groups using Entra app roles.


  • Apply Conditional Access policies to the application, for example requiring a compliant device.


  • Review a full audit trail of all activity associated with the application, tied to individual user identities.


None of this requires any change to the developer’s code or any involvement of the developer. The client’s IT team has complete autonomy over access control.

5.5 Minimum Privilege by Design

VBAuth configures scope claims at the level of individual functions. An application that sends email requests Mail.Send. An application that reads calendar data requests Calendars.Read. Permissions are not requested in bulk and are not granted beyond what each specific function requires.

Access to each function can be further restricted by the IT team using Entra app roles, limiting which users can invoke which capabilities. The combination of minimum scope and user-level access control means that the impact of any security incident is limited to the smallest possible surface area.

6. Summary

The choice between delegated and application permissions is not merely a technical implementation detail. It determines whether a Microsoft 365 deployment can be accessed without any user authentication, and whether the client’s existing security controls apply at all.

Application permissions, while sometimes presented as a simpler route to getting an Access application working with Graph API, carry a security risk that is not proportionate to the convenience they offer. A single credential compromise can expose an entire tenant silently and persistently.

VBAuth is built on delegated permissions because that is the only model that keeps authentication in the hands of the user and security controls in the hands of the IT team where they belong. Every token requires a real sign-in. Every action is traceable to a real user. Every security policy the tenant has configured is respected.

This series was prepared with AI assistance. The technical content has been reviewed and verified by the authors.

VBAuth, developed and maintained by Andrew Richards (The IT Service Ltd) and Peter Bryant (Corylus Business Systems), © 2025–2026. All rights reserved. https://vbauth.com

Updated on April 21, 2026