For File 365 to work, a link between Salesforce and Microsoft 365 (Azure AD) must be set up. You can use the technology and features built into the Salesforce platform to authorize File 365 to access your files in SharePoint in a secure way.
1.1 Configure in Azure AD: Application Registration
First, we must register the application in your Azure tenant and assign the required API permissions. To do this, log in to your Azure Portal as an administrator and select the Azure Active Directory service. You can find it by clicking All Services and searching for Azure Active Directory in the search box.

In the left menu, go to the App registrations [1] section, then click New registration [2].

Give the application a name so you know where it is in use, for example File 365. Select Accounts in this organizational directory only in the supported account types section. Under Redirect URI, select Web as the platform and enter the standard Salesforce callback URL for your environment, using the table below. Click Register to create the application. The application page opens.
| Environment | Redirect URI to enter |
|---|---|
| Sandbox and scratch orgs | https://test.salesforce.com/services/extidp/callback |
| Production | https://login.salesforce.com/services/extidp/callback |

At the top of the application page you will find the Application ID and the Tenant ID. Take note of both, as you will need them for the Connection Setup in Salesforce (see section 1.2). Before moving to Salesforce, there are a few more things to set up on the application.

Create a client secret
Go to the Certificates & secrets [1] section, and click New client secret [2]. This is the secret Salesforce will use in the authorization flow.

Add a Description and set an Expiration date [3]. Do not forget to set a reminder for yourself to renew the secret in both Azure and Salesforce. If the client secret expires, you will get an authentication (401) error. Finish by clicking Add at the bottom of the page.

The secret is generated by the Azure portal. Be sure to copy the Value of the generated secret and store it somewhere safe. You will need it later for the Connection Setup in Salesforce (see section 1.2).

Configure the API permissions
Now configure the API permissions the application requires. Go to the API permissions [1] section. Click Add a permission [2], then Microsoft Graph [3], then Delegated permissions [4].

Under the OpenID permissions, select offline_access, openid and profile, then click Add permissions.

Do the same for the SharePoint delegated permissions. Click Add a permission [1], click SharePoint [2], then Delegated permissions [3]. Expand the AllSites [4] menu.

Select AllSites.FullControl and click Add permissions. Then, after confirming the configured permissions, click Grant admin consent for your directory and confirm in the pop up.

After you have granted admin consent, the permissions section should look like this:

You have now successfully registered the application in your Azure tenant and assigned all the required API permissions.
1.2 Configure in Salesforce: Connection Setup
From File 365 version 5.0 onwards, connecting Salesforce to Microsoft 365 is much simpler. The manual steps that were previously required (creating an Authentication Provider, copying callback URLs between Salesforce and Azure, and setting up legacy Named Credentials by hand) are now handled for you inside the File 365 app.
Already using File 365? If you set up File 365 before version 5.0 and configured the credentials the old way, you do not have to change anything. File 365 version 5.0 and higher stays backward compatible with the legacy Named Credentials. You can migrate to the new Named Credentials whenever it suits you, as described in section 1.3.4.
Before you begin, make sure you have the following four values to hand. Three of them come from the Azure application registration you completed in section 1.1, and the fourth is your SharePoint URL.
| Field | Value |
|---|---|
| Application ID | Application ID of the registered application in Azure (section 1.1) |
| Client Secret | The Value of the secret you created in Azure (section 1.1), not the secret ID |
| Tenant ID | Tenant ID of your Azure tenant (section 1.1) |
| SharePoint URL | The root URL of your SharePoint Online environment, for example https://tenantname.sharepoint.com |
Open the File 365 app in Salesforce and go to the Connection Setup tab. This starts a guided screen flow that walks you through the connection. The flow also includes a link back to this knowledge base article, so you can refer to the Azure steps in section 1.1 if you still need to collect any of the four values.

Selecting Configure next to File Previews creates a trusted URL automatically, which allows users to preview documents stored in SharePoint.
On the first screen, enter the four values, Application ID, Client Secret, Tenant ID and SharePoint URL, then click Next.

When you click Next, File 365 sets up the connection for you. Behind the scenes, the Authentication Provider and the Named Credentials are created automatically.

A few short steps remain to finish the setup. These are covered in section 1.3.
Note on the Client Secret: entering the secret in the flow is optional. A secret entered in the flow can show up in debug logs and flow error messages. The risk is small, but depending on the size of your org and the number of users (especially admins), you may want to avoid it. The alternative is to enter the secret manually after the setup flow has completed, which prevents this exposure.
To enter the secret manually, go to Named Credentials in Setup after the flow has completed, open the External Auth Identity Providers tab, and enter it there.


1.3 Complete the Connection Setup
After the connection has been created, three steps remain: enabling the Named Credentials for callouts, authenticating the principals, and assigning the right permissions.
1.3.1 Enable the Named Credentials for callouts
When Named Credentials are created by a managed package, they are not automatically enabled for callouts, so you need to enable them before File 365 can use them. File 365 creates three Named Credentials:
- Standard, used for everyday File 365 operations.
- Privileged, used for tasks such as creating sites and creating secure folders.
- Graph, used for general Microsoft 365 functions.
Open each Named Credential, select Edit, and toggle on Enabled for Callouts.

1.3.2 Authenticate the principals
File 365 works with two kinds of principals, Named Principals (a service account) and Per User principals. The difference between them, and how to decide which to use, is covered in section 1.3.3. At this point, the Named Principals have to be authenticated.
There are two Named Principals, for the SharePoint Standard and SharePoint Privileged credentials. Open the authentication link provided for each one and sign in with the relevant Microsoft account when prompted. You will need the SharePoint username and password for the service account.

Per User principals cannot be authenticated by an administrator. Each user authenticates themselves the first time they use File 365. That process is described in Authenticate User to SharePoint.
1.3.3 Assign the principals
Before assigning anything, it helps to understand the two kinds of principal File 365 can use.
Named Principal (service account)
Using a Named Principal, which we also call a service account, means File 365 connects to SharePoint with the same account for every Salesforce user. All connections, and therefore all SharePoint audit trail entries, are made under this single account rather than under the individual user who performed the action.
Per User
Using a Per User principal means File 365 connects to SharePoint as each user individually, by impersonating the Salesforce user who triggered the action. The SharePoint audit trail then shows the actual user instead of a service account.
Choosing which principal to assign
How the principals are assigned depends on the credential:
- Privileged and Graph: the service account (Named Principal) is the only principal available, so it must be assigned.
- Standard: you can assign a Named Principal, a Per User principal, or both. You must assign at least one. If you assign both, the order of the principals decides which one is used for the callout. File 365 gives the Per User principal priority during the setup process, so when both are assigned, File 365 uses Per User.
Our recommendation: use the Per User principal wherever possible, so that actions in SharePoint can be traced to the individual user. A Named Principal is the better choice for users who do not have their own access to SharePoint, such as external users. You can also create separate permission sets for different groups, for example a permission set with Per User access for internal users and a permission set with service account access for external users.
To assign the principals, go to Permission Sets in Setup and create a new permission set, for example File 365 Permissions. Open the permission set, find the External Credential Principal Access section, and enable the principals you need by following the rules above. Save the permission set, then assign it to the users who should have access to File 365.
We also recommend adding the File365SalesforceSelf – ServiceAccount principal at this point, as it is required later for Large File Uploads (section 1.5).


Once you have saved, the connection setup is complete.
1.3.4 Migrating from the legacy setup
Customers who set up File 365 before version 5.0 use the legacy Named Credentials together with an Authentication Provider. From version 5.0, File 365 stays backward compatible with this manual setup, so if it is working well you do not have to change anything. If you would like to move to the new Named Credentials, you can migrate at any time by following the steps below.
- Create the new Named Credentials using the Connection Setup process described in sections 1.2 and 1.3.
- Add the standard callback URL as a redirect URI in Microsoft (Azure AD), as described in section 1.1, if it is not already in place.
- Update every existing object location so that it uses the newly created Named Credentials instead of the legacy ones. Each object where File 365 is in use has its own object location, so work through them all.
- Once every object location points at the new Named Credentials, remove the legacy Named Credential and the Authentication Provider.
File 365 is now running entirely on the new Named Credentials.
1.4 Manual Setup for multiple connections
If you cannot use, or prefer not to use, the automatic Connection Setup, or if you need to connect more than one SharePoint site collection or Azure AD tenant, follow the manual setup in Manual Setup: Multiple tenants and SharePoint Site locations.
1.5 Large File Uploads setup
We recommend setting up Large File Uploads for every setup, including the manual setup described in Manual Setup: Multiple tenants and SharePoint Site locations. It is a recommendation, not a requirement.
Before starting the Large File Uploads setup, go to Setup › Users and create a new Integration User called File365IntegrationUser.
Next, go to Permission Sets in Setup and open the permission set File 365 Integration User. The principals required for Large File Uploads are already assigned to this permission set, so assigning it to the new integration user is all that is required.
On the File 365 Connection Setup tab, go to the Large File Uploads section and click Configure next to Automated Setup. On the screen that opens, select the integration user you just created.

Click Setup and wait for the success message. Then click Back to Overview and click Configure next to Manual Steps.
Click the File365 Salesforce Self link, select Edit, and toggle on Enabled for Callouts.

Go back to the File 365 Connection Setup tab, click Refresh next to Signing Certificate, and wait for the success message.
Note: after refreshing the certificate, save its expiry date and set a reminder to refresh it again before it lapses.
1.6 Single Sign On (SSO) based on Microsoft authentication
Single Sign On is a recommendation, not a requirement: File 365 works without it.
The file preview functionality in File 365 works by displaying a page from Microsoft SharePoint in the browser (using an iframe). For previews to work smoothly, the user should be logged into Azure AD with their credentials in their browser session. The easiest way to accomplish this is to set up Single Sign On in Salesforce, so users log in with their Microsoft work account.
We recommend this for every setup, whether you used the Connection Setup or the manual setup. To configure Single Sign On, follow the steps in Microsoft’s tutorial Configure Salesforce for Single sign-on in Microsoft Entra ID.