Registering an Azure Entra Application #
For VBA / Microsoft Access developers integrating Microsoft Graph API
1. Overview and Context #
VBAuth is a COM-visible .NET Framework DLL that gives your VBA application access to the Microsoft Graph API using OAuth 2.0. This means you can send email, read calendars, create contacts, and much more — all from within an Access database or any VBA host — without relying on the legacy Outlook COM object model that New Outlook has broken.
Before you write a single line of VBA, you need to create an App Registration in the Microsoft Azure portal. This is the identity that your application presents to Microsoft when requesting access. Think of it as registering your application with Microsoft so that it has a recognised, trusted identity.
You will need: Access to the Microsoft Azure portal (portal.azure.com) with an account that has permission to register applications in the target Microsoft 365 tenant. In most organisations this means a Global Administrator or Application Administrator role. If you do not have this access, ask your client’s IT administrator.
1.1 Key Concepts #
If you are new to Azure and Entra ID, these are the terms you will encounter. It is worth understanding them before you start, as the portal uses them throughout.
| Term | What it means |
|---|---|
| Azure / Azure Portal | Microsoft’s cloud platform. The portal at portal.azure.com is the web interface where you manage everything. |
| Microsoft Entra ID | The new name for Azure Active Directory (Azure AD). It is the identity and access management service for Microsoft 365. Every Microsoft 365 tenant has one. |
| Tenant | A single organisation’s instance of Microsoft 365. It has a unique Directory (Tenant) ID — a GUID. When you register an app, it belongs to a specific tenant. |
| App Registration | A configuration entry in Entra ID that defines your application: its name, what APIs it may call, and what redirect URIs it may use. It gives the app a unique Application (Client) ID. |
| Application (Client) ID | A GUID that uniquely identifies your registered application. This is what you paste into VBAuth. Do not confuse it with the Object ID. |
| Directory (Tenant) ID | A GUID that uniquely identifies the Microsoft 365 organisation. Also pasted into VBAuth. Together with the Client ID, it locates your app registration precisely. |
| OAuth 2.0 | The authentication protocol used. VBAuth uses the “authorisation code” flow with PKCE — the user signs in interactively, and tokens are obtained on their behalf. |
| Microsoft Graph API | A single REST API endpoint (https://graph.microsoft.com) that gives access to almost all Microsoft 365 data and services: email, calendar, contacts, Teams, SharePoint, and more. |
| Permission / Scope | A named capability that your app requests. Permissions are declared on the App Registration. The specific ones used in a given call are the “scope”. You can declare more permissions than you ever use — you choose the scope at call time in VBA. |
| Delegated Permission | The app acts on behalf of a signed-in user. This is what VBAuth uses. The user must sign in and may be asked to consent. |
| Redirect URI | The URL that Azure redirects the browser to after the user signs in. For a native desktop application (as VBAuth is), this must be http://localhost. |
| Admin Consent | Some permissions require a Global Administrator to approve them for the whole organisation, rather than each user consenting individually. |
2. Creating the App Registration — Step by Step #
The entire process takes around five minutes once you are familiar with it. Follow these steps in order. Do not skip ahead.
2.1 Navigate to Microsoft Entra ID #
| Step | Action |
|---|---|
| Step 1 | Go to portal.azure.com and sign in. Use the account that has permission to register applications in the target tenant. |
| Step 2 | On the home screen, click Microsoft Entra ID. It appears in the Azure services strip near the top of the page. |
| Step 3 | In the left-hand menu, click App registrations. It is under the Manage section. If you do not see it immediately, use the Search box on the left. |
| Step 4 | Click New registration at the top of the page. |
2.2 Fill in the Registration Form #
The registration form has three sections. Fill them in as follows.
Name #
Enter a meaningful display name for your application — something that will make sense to the client’s IT administrator when they see it listed in their tenant. For example: MyApp — Microsoft Graph Access
The name is cosmetic and can be changed later. It does not affect authentication.
Supported account types #
Select Accounts in this organisational directory only (Single tenant). VBAuth always connects to a specific tenant — it does not support multi-tenant or personal Microsoft accounts.
Important — single tenant only. Do not select multi-tenant options. VBAuth licence files are bound to specific tenant IDs. Choosing the wrong account type here will cause authentication to fail or produce unexpected behaviour.
Redirect URI #
This tells Azure where to send the browser after the user has signed in. Set it as follows:
- Platform: Public client/native (mobile & desktop)
- URI: http://localhost
Why http://localhost? VBAuth catches the redirect internally — it does not need a real web server. The http://localhost address is the standard for native desktop applications using the OAuth 2.0 authorisation code flow. Using any other URI will cause the authentication handshake to fail.
| Step | Action |
|---|---|
| Step 5 | Click Register. Azure creates the app registration and takes you to its Overview page. |
2.3 Record the Application ID and Tenant ID #
This is the most important step — do not skip it.
On the Overview page you will see three key values in the Essentials section:
- Application (Client) ID
- Object ID (you do not need this one)
- Directory (Tenant) ID
⚠️ Copy these IDs now — before you leave this page. You will need both the Application (Client) ID and the Directory (Tenant) ID when configuring VBAuth. Copy them to a safe location immediately. They are always available from the Overview blade, but forming the habit of copying them at this point prevents mistakes later. In VBAuth, these correspond to the ClientId and TenantId parameters used in SetEntraAPPIdValues().
3. Setting API Permissions #
The App Registration defines the maximum set of Microsoft Graph API actions that your application is allowed to perform. This is called the permission pool. At the point of making an actual Graph API call from VBA, you specify a scope — a subset of these permissions — for that call. You cannot use a scope that has not been added here first.
Think of it as a menu. The permissions you add here are the menu of what your app CAN do. The scope you pass in your VBA code is what you ORDER from that menu for a specific call. This separation is intentional — it means you can have a broad permission pool but call only what is needed at any given moment.
3.1 Add Microsoft Graph Permissions #
| Step | Action |
|---|---|
| Step 1 | In the left-hand menu of your App Registration, click API permissions. |
| Step 2 | Click Add a permission. |
| Step 3 | In the panel that opens, click Microsoft Graph. It is listed under Microsoft APIs and is typically the first option. This is the API that VBAuth uses for all its functionality. |
| Step 4 | Select Delegated permissions. VBAuth always acts on behalf of a signed-in user (delegated), not as a background service (application). Always choose Delegated. |
3.2 Finding and Adding Permissions #
Use the search box to find permissions by keyword. For example, typing “send” will show you Mail.Send. Expand the relevant permission group and tick the checkbox next to the permission you want.
| Step | Action |
|---|---|
| Step 5 | Tick the required permissions and click Add permissions. You can add multiple permissions in one go by ticking several checkboxes before clicking Add permissions. |
3.3 Reference — A representative set of Microsoft Graph API permissions #
The table below lists some of the permissions used in the VBAuth Demo databases. It is a useful starting point when configuring your own App Registration. Add only the permissions that your application actually requires — adding unnecessary permissions increases the attack surface and may raise questions from the client’s IT department.
| Permission | Purpose | Admin Consent? |
|---|---|---|
| Mail.Send | Send email as the signed-in user | No |
| Mail.ReadWrite | Read and write email in the user’s mailbox | No |
| Mail.Read | Read email in the user’s mailbox (read-only) | No |
| Calendars.ReadWrite | Create, read, update, and delete calendar events | No |
| Calendars.Read | Read calendar events (read-only) | No |
| Contacts.ReadWrite | Create, read, update, and delete contacts | No |
| Contacts.Read | Read contacts (read-only) | No |
| User.Read | Read the signed-in user’s profile. Required if your code uses the /me endpoint or requests an ID token. | No |
| Files.ReadWrite | Read and write files in OneDrive / SharePoint | No |
A note on User.Read. Microsoft documentation states that User.Read is required to return an ID token and to use the /me endpoint. In practice, some authentication flows work without it — VBAuth does not strictly require it if your code never calls /me or uses ID token claims. That said, it carries no meaningful risk, requires no admin consent, and is always listed by Microsoft as the baseline permission for delegated flows. Including it is the safe default.
offline_access — not in the App Registration. offline_access is not an API permission you add to the App Registration. It is an OIDC scope requested at authentication time. Microsoft documentation confirms that if any delegated permission has been granted, offline_access is implicitly available. VBAuth requests it as part of its scope string automatically — you do not need to add it to the permissions list here.
For the authoritative permission list for each feature, see the individual feature README pages.
3.4 Admin Consent #
The “Admin consent required” column in the table above shows No for all of the listed permissions. This is accurate for this particular set — it reflects Microsoft’s default for these delegated permissions. However, your organisation’s tenant policy may override this: some tenants are configured to require administrator approval for all third-party app permissions, regardless of the default.
Permissions that do require admin consent — for example, Mail.Read.All (read all users’ mail) or User.ReadWrite.All — will show Yes. Those are not in the Features Demo set, but you may encounter them in other scenarios. If you are building features that require such permissions, the client’s administrator must explicitly grant them.
Admin consent is not something you implement in code — it is part of the normal sign-in process. When a user authenticates and the application requests a permission that requires admin consent, Microsoft automatically presents a consent screen at that point. If the signed-in user holds an appropriate administrator role (such as Global Administrator), they can grant consent for the entire tenant there and then. An ordinary user presented with the same screen will see a message telling them that administrator approval is required — they cannot proceed until an administrator has consented.
Alternatively, an administrator can grant consent in advance in the Azure portal — on the API permissions page of the App Registration, click Grant admin consent for [organisation name]. Either way, consent only needs to be granted once per tenant.
Screenshot to be added. A screenshot of the Microsoft admin consent prompt, as it appears during authentication, will be added to this section in a future revision of this document.
What happens if consent has not been granted? The first time a user signs in, they will be prompted to consent to the permissions the app is requesting. If the tenant policy blocks user consent and no administrator has pre-granted consent, the sign-in will fail with an AADSTS error. An administrator must sign in and grant consent — either at the prompt during their own sign-in, or via the Azure portal — before other users can authenticate.
4. Using the IDs in VBAuth #
Once your App Registration is created and permissions are configured, you have the two values you need: the Application (Client) ID and the Directory (Tenant) ID. How those values are stored and passed to VBAuth depends on how your application is structured.
In the VBAuth Features Demo database, these values are not hard-coded into VBA procedures. They are stored in a configuration table alongside the endpoint URLs and scope strings for each feature. This makes the application easy to maintain — changing a Client ID or adding a new scope requires a table edit, not a code change. The VBA code reads from the table at runtime and passes the values to VBAuth accordingly.
Configuration table approach. The Features Demo stores Client ID, Tenant ID, API endpoint URLs, and scope strings in a dedicated configuration table. This pattern is strongly recommended for any production application — it keeps your credentials and API configuration in one place, separate from your business logic, and makes it straightforward to update when moving between clients or tenants.
For your own application, you may choose to store these values in a table, in the Registry, in an INI file, or in any other configuration store that suits your deployment. The important thing is that the Client ID and Tenant ID are passed correctly to SetEntraAPPIdValues() when the application starts — see the Features Demo code and documentation for the recommended pattern.
5. Security and Compliance Considerations #
As a developer distributing VBAuth-enabled applications, you have a responsibility to ensure the App Registration is configured securely. The following guidance is drawn from the VBAuth security white papers, which can be found in the docs section of vbauth.com. Sharing the relevant white papers with a client’s IT administrator is strongly recommended before deployment.
Feature Demo — automated App Registration configuration. The VBAuth Features Demo database includes code that can automate parts of the App Registration configuration process. To use it, you must manually create two Entra App Registrations and apply the appropriate App Roles (application-level security). The relevant white paper is available at vbauth.com/docs.
5.1 Principle of Least Privilege #
Request only the permissions your application genuinely needs. Do not add permissions speculatively “in case we need them later”. Each permission you add extends the potential damage if the application is misused or compromised. It will also be visible to the client’s IT security team, who may question unnecessary permissions.
- Read-only permissions (e.g. Mail.Read) are preferable to read-write (Mail.ReadWrite) unless your application specifically writes data.
- Avoid Files.ReadWrite.All, Sites.FullControl.All, and similar broad permissions unless your application has a specific, documented reason to use them.
5.2 App Registrations are Per-Tenant #
Each client’s Microsoft 365 tenant requires its own App Registration. You cannot reuse an App Registration from one tenant in another tenant’s authentication flow. This is by design — it is a security boundary. The VBAuth licence file contains both the developer tenant ID and the client tenant ID, which are validated on initialisation.
5.3 The Redirect URI must be http://localhost #
Do not change the Redirect URI to anything else. The http://localhost value is the correct and safe choice for a native desktop application. A custom URI pointing to a real web server would mean authentication tokens are transmitted to an external endpoint — a significant security risk.
5.4 Client Secrets — Not Used by VBAuth #
You will notice a Certificates & secrets section in the App Registration left-hand menu. VBAuth does not use client secrets. Do not create one. The reasons for this — and a full technical explanation of why the approach VBAuth uses is more secure for public clients — are covered in the white paper “Microsoft Graph API Permissions and Security”, available in the Documentation section of vbauth.com.
5.5 Informing the Client’s IT Administrator #
When deploying to a new client, it is good practice to provide their IT administrator with:
- The name and purpose of the App Registration.
- The list of permissions requested, with a plain-English explanation of why each one is needed.
- Confirmation that no client secret is in use.
- Confirmation that the Redirect URI is http://localhost only.
The VBAuth security white papers are available at vbauth.com/docs. Sharing them with the client proactively builds trust and avoids the registration being blocked or deleted by an over-cautious IT department.
6. Quick Reference Checklist #
Use this checklist when setting up a new App Registration for a client. Tick each item off before moving on.
| ☐ | Signed in to portal.azure.com with an account that can register applications in the target tenant. |
| ☐ | Navigated to Microsoft Entra ID → App registrations → New registration. |
| ☐ | Name set to a meaningful value that identifies the application to the client’s IT team. |
| ☐ | Supported account types set to Accounts in this organisational directory only (Single tenant). |
| ☐ | Redirect URI set to: Platform = Public client/native, URI = http://localhost. |
| ☐ | Clicked Register. |
| ☐ | Copied the Application (Client) ID from the Overview page. |
| ☐ | Copied the Directory (Tenant) ID from the Overview page. |
| ☐ | Navigated to API permissions → Add a permission → Microsoft Graph → Delegated permissions. |
| ☐ | Added User.Read (required if using the /me endpoint or ID token claims; safe default to include). |
| ☐ | Added all other permissions required by the application (see Section 3.3). |
| ☐ | Confirmed no permissions with Admin consent required = Yes are included unless the client’s administrator has been advised and has agreed to grant consent. |
| ☐ | No client secret has been created. |
| ☐ | ClientId and TenantId have been recorded and entered into the application configuration (e.g. the VBAuth configuration table in the Features Demo). |
| ☐ | Authentication tested successfully with a user in the target tenant. |
7. Common Problems and Solutions #
Error handling in VBAuth. VBAuth.dll catches all errors internally — there are no uncaught exceptions surfaced to VBA. Authentication errors are returned as structured error results that your VBA code can inspect and handle. The Features Demo database shows the recommended pattern for checking and displaying these results. Where an AADSTS error code is relevant, it will appear in the error detail returned by VBAuth.
“AADSTS50011: The redirect URI specified in the request does not match” #
The Redirect URI in your App Registration does not match what VBAuth is sending. Verify that Authentication → Redirect URIs contains exactly http://localhost and no other values. Check for trailing slashes or https vs http.
“AADSTS65001: The user or administrator has not consented to use the application” #
The user has not yet consented, or the tenant policy blocks user consent. Either ask the user to sign in and consent, or ask the client’s IT administrator to grant admin consent on the API permissions page of the App Registration.
“AADSTS700016: Application not found in the directory” #
The Application (Client) ID or Directory (Tenant) ID is incorrect. Double-check both values against the Overview page. This error almost always means a copy-paste mistake — a missing digit, or using the Object ID instead of the Application (Client) ID.
“Insufficient privileges to complete the operation” (403 from Graph API) #
The permission required for the call you are making has not been added to the App Registration, or has been added but the user has not yet consented to it. Check the API permissions page and ensure the specific permission is listed and that the user has consented.
App Registration was deleted by the client’s IT team #
This occasionally happens when IT teams audit app registrations. Provide the IT administrator with the relevant VBAuth security white papers (available at vbauth.com/docs), the permission list with justifications, and a clear explanation that no client secret is in use. In practice, most IT teams are reassured once they understand the security model.
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