- List the users and groups in your Microsoft Entra directory, including account status and group membership
- Search SharePoint sites and browse a site’s document libraries
- Read organization mailboxes and calendars
- Manage app registrations and their credentials
- Automate other Microsoft 365 and Microsoft Entra administration, such as Teams, Intune devices, and reports, through any Microsoft Graph endpoint that accepts application permissions
Common use cases and example apps
These examples show what you can build with Azure Graph & Entra API, each with a prompt to start from.How Azure Graph & Entra API connections work
The connector authenticates as a Microsoft Entra service principal: an application identity you register in your tenant and give a client secret. Each connection uses the tenant ID, client ID, and client secret of one service principal, and multiple projects in the workspace can share it. Lovable’s connector gateway exchanges the secret for a Microsoft Graph access token, refreshes the token in the background, and forwards each request to Microsoft Graph, so the secret and the token stay on the server and are not exposed to your published app. The connection has no signed-in user. Microsoft Graph authorizes it through application permissions, which apply to your whole organization and take effect only after an administrator consents. Endpoints that only work for a signed-in user, such as/me, are unavailable, so your app addresses tenant resources explicitly, for example a user or a site by its ID.
The connector does not restrict which Microsoft Graph endpoints a connection can call, and it does not distinguish reads from writes. The application permissions an administrator has consented to, together with any directory roles assigned to the service principal, are the only control. Whatever the service principal may do, apps built on the connection can do. Grant the narrowest permissions that cover your app, and prefer read permissions over their ReadWrite counterparts.
Connecting verifies the credentials but not the access. Lovable only confirms that Microsoft Entra issues a Microsoft Graph access token for the service principal, so a connection can verify and still receive 403 responses until the application permissions exist and an administrator has consented. See Troubleshooting.
Azure Graph & Entra API reaches Microsoft Graph only. To call Azure Resource Manager for subscriptions, resources, and costs, create a separate Azure Cloud API connection. The same app registration can back both connections, but a rotated secret must then be updated in both. Prefer a dedicated service principal per connector when the permissions or environments differ.
When you build with the connection in the project chat, Lovable works this way:
- Lovable builds read-only features by default and adds calls that create, change, or delete directory objects, Microsoft 365 data, or app credentials only when you ask for them by name.
- Before generating code for a call that changes your tenant, Lovable states the exact target and the change and asks you to confirm. For destructive, privilege-changing, or credential-related operations, Lovable also explains what else the change affects and whether it can be undone, and asks a second time.
- Lovable builds directory changes such as user creation as a single, bounded action that you confirm, rather than a loop, schedule, or per-signup trigger.
- Lovable keeps every call server-side and does not place the tenant ID, client ID, client secret, or access token in frontend code or chat. Credentials a call returns, such as a new client secret, stay on the server too.
- When Microsoft Graph denies a call, Lovable tells you which application permission or consent to grant instead of retrying.
How to connect Azure Graph & Entra API
Who can create Azure Graph & Entra API connections depends on your plan and workspace settings. App + chat connectors are available by default on Free, Pro, and Business plans. On Enterprise plans, they are effectively disabled at first: Who can create connections and clients defaults to No one until an admin changes it in Connectors → Admin settings → App + chat connectors. You can create multiple Azure Graph & Entra API connections using different service principals, which is useful for separating tenants or environments (for example, development and production), or for giving each app its own set of permissions. When the connection is created, you can link it to the projects where you want to use it. Anyone building in a project can ask Lovable in the project chat to link their project to it.Prerequisites
Before connecting Azure Graph & Entra API, make sure you have:- A Microsoft Entra tenant in which you or an administrator can register an application and create a client secret
- An administrator with the Privileged Role Administrator or Global Administrator role, who can grant tenant-wide admin consent for Microsoft Graph application permissions
- Permission to create connections in your Lovable workspace (see Who can create connections and clients)
Step 1: Create a service principal in Microsoft Entra
The connection authenticates as an application you register in your tenant. Register a dedicated application for Lovable, or reuse one you already have, and create a client secret for it. Registering an application also creates its service principal in your tenant.Register an application
lovable-app, keep the default supported account type (Single tenant only, followed by your tenant name), leave the redirect URI empty, and click Register. See Microsoft’s guide: Register an application.Note the tenant and client IDs
Create a client secret
Step 2: Grant Microsoft Graph application permissions
Registering an application grants it nothing. Add the Microsoft Graph application permissions your app needs, then have an administrator consent to them for your tenant.Add application permissions
User.Read.All lists users, Group.Read.All covers groups and their members, Sites.Read.All searches SharePoint, Mail.Read reads organization mailboxes, and Application.Read.All reads app registrations. Click Add permissions. Each endpoint in the Microsoft Graph permissions reference documents the permissions it accepts.Grant admin consent
Step 3: Connect Azure Graph & Entra API to Lovable
With the permissions granted, create the connection in Lovable.Open Azure Graph & Entra API in Connectors
Add a connection
Name the connection
Configure the connection
- Microsoft Entra Tenant ID: the Directory (tenant) ID from Step 1.
- Service Principal Client ID: the Application (client) ID from Step 1, not the object ID.
- Client Secret: the secret Value from Step 1.
Choose who can use this connection
Connect
Limitations
The Azure Graph & Entra API connector cannot:- Restrict a connection to read-only operations or to specific Microsoft Graph endpoints from inside Lovable. Microsoft Graph application permissions and directory roles are the only control over what apps built on a connection can do.
- Authenticate with a certificate, a managed identity, or a federated credential. The connection needs a client secret.
- Reach national clouds such as Microsoft 365 GCC High, Azure Government, or Azure operated by 21Vianet. The connection uses the global Microsoft Graph endpoint.
- Call Azure Resource Manager. Use a separate Azure Cloud API connection for subscriptions, resources, and costs.
- Receive events from Microsoft, such as Microsoft Graph change notifications. The connection only makes outbound calls.
- Act as a signed-in user or support per-end-user Microsoft login. Each connection represents a single service principal shared across all projects linked to it, so Microsoft Graph endpoints that only support delegated permissions, such as
/me, are unavailable. If you need each user of your app to sign in with their own Microsoft account, use the Microsoft app user connectors for Microsoft 365 data.
Troubleshooting
Use these checks when connecting fails or a Microsoft Graph request returns an unexpected status.Connect failed: Microsoft Entra could not issue a Microsoft Graph access token
Connect failed: Microsoft Entra could not issue a Microsoft Graph access token
- Tenant not found (
AADSTS90002): the Microsoft Entra Tenant ID is wrong. Copy the Directory (tenant) ID from the application’s Overview page, not a domain name or another tenant’s ID. - Application not found in the directory (
AADSTS700016): the Service Principal Client ID is wrong, or the application is registered in a different tenant than the one you entered. Use the Application (client) ID, not the Object ID. - Invalid client secret (
AADSTS7000215): the Client Secret does not match the application. The usual cause is pasting the Secret ID instead of the secret Value. Create a new secret and paste its value. - Client secret expired (
AADSTS7000222): the secret’s expiry has passed. Create a new secret under Certificates & secrets and update the connection. - Application disabled (
AADSTS7000112): the application or its service principal is disabled in your tenant. Re-enable it in Microsoft Entra, or register a new application.
A request returned 403 after connecting
A request returned 403 after connecting
403 with Authorization_RequestDenied or an insufficient-privileges message means the application permission for that call is missing or an administrator has not consented to it. Add the permission under API permissions and grant admin consent. Some Microsoft 365 workloads add their own access policies on top of Microsoft Graph permissions, such as Exchange Online application access policies that limit which mailboxes an application can reach, and return the same 403.Microsoft evaluates permissions on every request, so you do not need to reconnect. When this happens in the project chat, Lovable names the missing permission.A request returned 429 Too Many Requests
A request returned 429 Too Many Requests
429 with a Retry-After header before the request reaches Microsoft. Microsoft Graph also throttles independently per workload and returns its own Retry-After header. See Microsoft Graph throttling.Ask Lovable to cache reads, poll on demand rather than on a frequent fixed timer, and retry throttled calls with increasing delays.Manage your Azure Graph & Entra API connection
Connections are managed from Connectors: select Azure Graph & Entra API, then open the connection.- Unlink projects to remove Azure Graph & Entra API access from specific projects while keeping the connection available for others. See Unlink projects from a connection for the steps.
- Delete the connection to remove it from the workspace entirely. Deleting is permanent. It removes the credentials from all linked projects, and app features that use Azure Graph & Entra API stop working until a new connection is added. See Delete a connection for the steps and who can delete.