Configuring Azure App Registration for SharePoint Integration in Leapwork
Configuring Azure App Registration for SharePoint Integration in Leapwork
Introduction
With the SharePoint Connection feature in Leapwork, you can easily set up and authenticate a connection to your SharePoint site. This allows you to automate tasks like reading from and writing Excel files stored in SharePoint—right from your test flows. In this article, you’ll learn how to set up and manage an Azure App registration for SharePoint connection using Microsoft Graph. A registered Azure App is required for authentication and access.
Please Note: To ensure a successful integration with Leapwork, use only Microsoft Graph delegated permissions.
Prerequisites:
- Azure AD tenant: Required to register your application.
- Microsoft 365 subscription: Needed for SharePoint access.
- Global/Admin role: Necessary permissions to register applications.
By setting up the Azure App registration correctly, you’ll be able to configure the necessary Client ID, Client Secret, and Tenant ID within Leapwork Studio, enabling Microsoft Graph Connection.
Steps to Register an App in Azure Portal
Step 1: Sign in to the Azure Portal
- Open Azure Portal.
- Sign in with your Global Administrator or Application Administrator account.
Step 2: Register a New Application
- Once you sign in to the Azure portal, go to Azure Active Directory from the left-hand panel.
- Under Manage, select App registrations.
- Click on New registration at the top.
Fill in the registration details for your app:
- Name: Provide a name for your app.
- Supported account types: Choose the appropriate account type:
- Accounts in this organizational directory only: For single tenant apps.
- Accounts in any organizational directory: For multi-tenant apps.
- Redirect URI (optional): You can set this now or leave it blank for later. If you're using a web app, enter the URI (e.g., https://localhost).
- Click Register.
Step 3: Configure API Permissions
Please Note: Only use Microsoft Graph API. Once your app is registered, follow these steps to configure the necessary permissions.
- In the App registrations, select your app.
- Under API permissions, click Add a permission.
- Choose Microsoft Graph API.
- Select Delegated permissions and Application.
- Search for Sites and select the relevant permissions.
Please Note: Both Delegated and Application permissions for Sites.Selected are required in Microsoft Graph to ensure proper access.
Sites.Selected: This allows the app to access specific SharePoint sites.
Step 4: Grant Admin Consent
For Sites.Selected permissions, admin consent may be required for your app to access SharePoint sites.
- After adding the Sites.Selected permission, click on Grant admin consent.
- Confirm the dialog when prompted.
Step 5: Configure App Secrets or Certificates
This app will require authentication with client credentials (such as client secrets or certificates). Please follow the steps below:
- In your registered app, go to Certificates & secrets.
- Under Client secrets, click new client secret and add a description and expiry.
- Click Add to generate a secret. Copy the value immediately as it will not be shown again.
Step 6: Get the App Registration Details
To use the app for authentication and permissions, you'll need the following details. These settings are also necessary to configure the Leapwork Microsoft Graph Connection:
- Application (client) ID: Found under Overview in your registered app.
- Directory (tenant) ID: Also found under Overview.
- Client Secret: The secret ID you generated in Step 5.
Step 7: Assign SharePoint site to App
To assign the necessary SharePoint site ID to a newly registered app, use Graph Explorer, which provides the easiest way to do this. The process starts with the Global administrator signing into Graph Explorer.
The administrator must have full rights to access environmental data. Retrieve the SharePoint site ID by running the query in Graph Explorer:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#sites",
"@microsoft.graph.tips": "Use $select to choose only the properties your app needs, as this can lead to performance improvements. For example: GET sites?$select=displayName,error",
"value": [\
\
{\
\
"id": "leaptestcompany.sharepoint.com,077f62fe-4692-4cf4-b450-26c0fbb56d4b,8b15aec6-522a-4db8-9b4f-a959413a7cfa",\
\
"webUrl": "https://leaptestcompany.sharepoint.com/sites/TestSite",\
\
"displayName": "Test Site"\
\
}\
\
]
}
Here, Test Site refers to the title of the SharePoint site.
Please Note: This is a GET request used to retrieve the required site details.
Next, execute a POST request to associate the retrieved site ID with the newly registered app. This links the site ID to the app, completing the assignment process.
{
"roles": [\
\
"write"\
\
],
"grantedToIdentities": [\
\
{\
\
"application": {\
\
"id": "cfa6b32c-acaa-462b-b7b2-113c72c9faa7", //ClientId for your app registration\
\
"displayName": "Sharepoint Leapwork Client" //A display name for the app, only used to identify it later on this site\
\
}\
\
}\
\
]
}
Now, the newly registered app to establish a connection with SharePoint is ready to be used.
For SharePoint configuration in Leapwork, you can refer this article.
Please Note: In Leapwork Studio, the SharePoint connection feature will be available starting with Release 2025.1.
If you have any questions, please reach out to our Priority Support team.