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:

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

Step 2: Register a New Application

Fill in the registration details for your app:

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.

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.

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:

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:

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.