> ## Documentation Index
> Fetch the complete documentation index at: https://docs.generalvalidation.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Run validation from your Fabric pipeline

> Add two activities to a Fabric pipeline so it validates the Tables it loads and stops when they don't match.

In this guide, you add two activities to the end of a Fabric pipeline. The
first asks General Validation to prepare a Run. The second runs it, and fails
your pipeline when the Tables don't match.

![Screenshot of a Fabric pipeline with a Web activity named Prepare validation followed by an Invoke pipeline activity named Run validation.](https://mintcdn.com/general-validation/ZnesrwsntO0ZfNlJ/images/how-to/pipeline-two-activities.png?fit=max\&auto=format\&n=ZnesrwsntO0ZfNlJ\&q=85\&s=b3748803acca434d56d45ca01e9cae30)

## Prerequisites

* A General Validation [Environment](https://docs.generalvalidation.com/get-started/environment.md) that is set up.
* A [test set](https://docs.generalvalidation.com/validate-data/tests.md#test-sets) with the Tests you want to run.
* A Microsoft Entra administrator, to approve one permission in step 2.

## Step 1: Register an application

Your pipeline signs in to General Validation as an application you own.

1. In the [Microsoft Entra admin center](https://entra.microsoft.com), go to
   **Entra ID** > **App registrations** and select **New registration**.

   ![Screenshot of the Microsoft Entra admin center with App registrations in the menu and New registration highlighted.](https://mintcdn.com/general-validation/ZnesrwsntO0ZfNlJ/images/how-to/entra-new-registration.png?fit=max\&auto=format\&n=ZnesrwsntO0ZfNlJ\&q=85\&s=8fb6490934ce1ff4a70d1e7a5deb5326)

2. Enter a name and select **Register**.

   ![Screenshot of the Register an application form with the name and the Register button highlighted.](https://mintcdn.com/general-validation/ZnesrwsntO0ZfNlJ/images/how-to/entra-register.png?fit=max\&auto=format\&n=ZnesrwsntO0ZfNlJ\&q=85\&s=bde69afc3a6e9136ad592022bf9cee1d)

3. On the **Overview** page, copy the **Application (client) ID** and the
   **Directory (tenant) ID**. You need both in step 4.

   ![Screenshot of an application's Overview page with Application (client) ID and Directory (tenant) ID highlighted.](https://mintcdn.com/general-validation/ZnesrwsntO0ZfNlJ/images/how-to/entra-ids.png?fit=max\&auto=format\&n=ZnesrwsntO0ZfNlJ\&q=85\&s=efb643d6909ee6c57ac85bb76d05b429)

## Step 2: Give the application access to General Validation

1. In the application's menu, select **API permissions**, then **Add a
   permission**.

   ![Screenshot of the API permissions page with API permissions and Add a permission highlighted.](https://mintcdn.com/general-validation/ZnesrwsntO0ZfNlJ/images/how-to/entra-add-permission.png?fit=max\&auto=format\&n=ZnesrwsntO0ZfNlJ\&q=85\&s=92d796fb4ebafb6df05e3079ce296b5a)

2. Select **APIs my organization uses**, search for `General Validation`, and
   select **General Validation Cloud API**.

   ![Screenshot of the Request API permissions pane with the APIs my organization uses tab and General Validation Cloud API highlighted.](https://mintcdn.com/general-validation/ZnesrwsntO0ZfNlJ/images/how-to/entra-select-api.png?fit=max\&auto=format\&n=ZnesrwsntO0ZfNlJ\&q=85\&s=48d290064628da250e5df82df812f917)

3. Select **Application permissions**, tick **GV.APIContributor**, and select
   **Add permissions**.

   ![Screenshot of the General Validation Cloud API permissions with Application permissions, GV.APIContributor, and Add permissions highlighted.](https://mintcdn.com/general-validation/ZnesrwsntO0ZfNlJ/images/how-to/entra-api-permission.png?fit=max\&auto=format\&n=ZnesrwsntO0ZfNlJ\&q=85\&s=6db99674d174e0ca177c3a6b58c50b80)

4. Select **Grant admin consent**, next to **Add a permission**, and confirm.
   The status changes to **Granted**.

   ![Screenshot of the permissions list with the GV.APIContributor status showing Granted.](https://mintcdn.com/general-validation/ZnesrwsntO0ZfNlJ/images/how-to/entra-consent-granted.png?fit=max\&auto=format\&n=ZnesrwsntO0ZfNlJ\&q=85\&s=87120812e274d839272ee02c5e561db0)

## Step 3: Create a client secret

1. In the application's menu, select **Certificates & secrets**.

   ![Screenshot of an application's menu with Certificates and secrets highlighted.](https://mintcdn.com/general-validation/ZnesrwsntO0ZfNlJ/images/how-to/entra-certificates-menu.png?fit=max\&auto=format\&n=ZnesrwsntO0ZfNlJ\&q=85\&s=f5b3cba0802b00f357d4fe498be87d61)

2. Select **New client secret**, enter a description, and select **Add**.

3. Copy the secret's **Value**. Entra shows it only once.

> [!NOTE]
>
> The secret goes into your Fabric connection in the next step and nowhere
> else. General Validation never receives it.

## Step 4: Create the connection to General Validation

1. In Fabric, select the gear icon, then **Manage connections and gateways**.

   ![Screenshot of a Fabric workspace with the Settings pane open, and the gear icon and Manage connections and gateways highlighted.](https://mintcdn.com/general-validation/ZnesrwsntO0ZfNlJ/images/how-to/fabric-settings-menu.png?fit=max\&auto=format\&n=ZnesrwsntO0ZfNlJ\&q=85\&s=b2b034c428fce1eb0efd778c98bb485f)

2. Select **New**.

   ![Screenshot of Fabric's Manage Connections and Gateways page with New highlighted.](https://mintcdn.com/general-validation/ZnesrwsntO0ZfNlJ/images/how-to/fabric-new-connection.png?fit=max\&auto=format\&n=ZnesrwsntO0ZfNlJ\&q=85\&s=0c71bab08cd478bdf243f706ed6be989)

3. Select **Cloud** and fill in the form.

   | Field | Value |
   | - | - |
   | **Connection name** | `General Validation API` |
   | **Connection type** | Web v2 |
   | **Base Url** | `https://api.generalvalidation.com` |
   | **Token Audience Uri** | `api://78d5d8af-9dd6-49dd-b06c-38c3a3c707af` |
   | **Authentication method** | Service Principal |
   | **Tenant ID** | Your Directory (tenant) ID from step 1 |
   | **Service principal ID** | Your Application (client) ID from step 1 |
   | **Service principal key** | Your secret's value from step 3 |
   | **Privacy level** | Organizational |

   ![Screenshot of Fabric's New connection pane filled in for a Web v2 connection that signs in with a service principal.](https://mintcdn.com/general-validation/ZnesrwsntO0ZfNlJ/images/how-to/fabric-connection-api.png?fit=max\&auto=format\&n=ZnesrwsntO0ZfNlJ\&q=85\&s=989c8fc25a76c53fe81baf0dc456703f)

4. Select **Create**.

## Step 5: Create the connection that runs validation

1. Select **New** again, then **Cloud**, and fill in the form.

   | Field | Value |
   | - | - |
   | **Connection name** | `Run General Validation` |
   | **Connection type** | Fabric Data Pipelines |
   | **Authentication method** | Workspace identity |
   | **Privacy level** | Organizational |

   ![Screenshot of Fabric's New connection pane filled in for a Fabric Data Pipelines connection that uses the workspace identity.](https://mintcdn.com/general-validation/ZnesrwsntO0ZfNlJ/images/how-to/fabric-connection-pipeline.png?fit=max\&auto=format\&n=ZnesrwsntO0ZfNlJ\&q=85\&s=b21b2f7dd3a62488f1ae6f04be137383)

2. Select **Create**.

## Step 6: Allow your pipeline's workspace to run validation

1. Open the workspace with your pipeline and select **Workspace
   settings**.

   ![Screenshot of a Fabric workspace with Workspace settings highlighted.](https://mintcdn.com/general-validation/ZnesrwsntO0ZfNlJ/images/how-to/fabric-workspace-settings.png?fit=max\&auto=format\&n=ZnesrwsntO0ZfNlJ\&q=85\&s=58646f4a191a9790323b6bab2af14890)

2. Select **Workspace identity**. If the workspace has no identity yet,
   select **+ Workspace identity** to create one.

   ![Screenshot of Workspace settings with Workspace identity highlighted and the identity's details shown.](https://mintcdn.com/general-validation/ZnesrwsntO0ZfNlJ/images/how-to/fabric-workspace-identity.png?fit=max\&auto=format\&n=ZnesrwsntO0ZfNlJ\&q=85\&s=5ebfe872e956c26db976ede415a39ada)

3. Open your General Validation workspace, the one whose name starts with
   **General Validation**, and select **Manage access**.

   ![Screenshot of the General Validation workspace in Fabric with Manage access highlighted.](https://mintcdn.com/general-validation/ZnesrwsntO0ZfNlJ/images/how-to/fabric-manage-access.png?fit=max\&auto=format\&n=ZnesrwsntO0ZfNlJ\&q=85\&s=ebfdf6676694fd2527e86d0a41efb66b)

4. Select **Add people or groups**. Search for the name of your pipeline's
   workspace, choose **Contributor**, and select **Add**.

   ![Screenshot of the Add people pane with a workspace's identity selected and the Contributor role chosen.](https://mintcdn.com/general-validation/ZnesrwsntO0ZfNlJ/images/how-to/fabric-add-contributor.png?fit=max\&auto=format\&n=ZnesrwsntO0ZfNlJ\&q=85\&s=23af0cabe3463eba4ac5c63866893468)

> [!NOTE]
>
> Contributor on the General Validation workspace can also read the Results
> Lakehouse, so grant it only to pipeline workspaces you trust with those
> Results. Allow a few minutes after granting the role before your first run
> while Fabric applies it.

## Step 7: Copy the request for your test set

1. In General Validation, select **Tests** and open your test set.

   ![Screenshot of the Tests page in General Validation with Tests and a test set highlighted.](https://mintcdn.com/general-validation/ZnesrwsntO0ZfNlJ/images/how-to/app-tests.png?fit=max\&auto=format\&n=ZnesrwsntO0ZfNlJ\&q=85\&s=c1b0c7f53079eef2752f5e0c27ca7a1e)

2. Under **Run from your pipeline**, select **Copy**. The request already
   includes your test set's ID.

   ![Screenshot of the Run from your pipeline panel with Copy and the test set ID highlighted.](https://mintcdn.com/general-validation/ZnesrwsntO0ZfNlJ/images/how-to/test-set-run-from-pipeline.png?fit=max\&auto=format\&n=ZnesrwsntO0ZfNlJ\&q=85\&s=2cddc7d1b12f89b8abbc934a003c9716)

## Step 8: Add the two activities to your pipeline

Add them after the activity that finishes loading your target Table.

1. Open your pipeline. On the **Activities** tab, select **Web** and name the
   activity `Prepare validation`.

   ![Screenshot of the Fabric pipeline editor with the Activities tab and Web highlighted.](https://mintcdn.com/general-validation/ZnesrwsntO0ZfNlJ/images/how-to/pipeline-web-activity.png?fit=max\&auto=format\&n=ZnesrwsntO0ZfNlJ\&q=85\&s=81d821ca72477163f076f86d580e91f4)

2. On the activity's **Settings** tab, fill in the fields.

   | Field | Value |
   | - | - |
   | **Connection** | `General Validation API` |
   | **Relative URL** | `/api/v1/fabric/runs` |
   | **Method** | POST |
   | **Body** | The request you copied, with your own Tables filled in |
   | **Headers** | `Content-Type` with the value `application/json` |

   ![Screenshot of the Prepare validation activity selected on the canvas, with its Settings tab showing the connection, relative URL, method, body, and header.](https://mintcdn.com/general-validation/ZnesrwsntO0ZfNlJ/images/how-to/pipeline-prepare-validation.png?fit=max\&auto=format\&n=ZnesrwsntO0ZfNlJ\&q=85\&s=17a2277f94fc56a070f78580babc20f7)

   In the body, use `@{guid()}` as the `id`, and give each Table's workspace
   ID, Lakehouse ID, and path. Both IDs are in the Lakehouse's address in
   Fabric.

   ```json theme={null}
   {
     "id": "@{guid()}",
     "source": {
       "workspace_id": "<workspace ID>",
       "lakehouse_id": "<Lakehouse ID>",
       "path": "Tables/bronze/orders",
       "format": "delta"
     },
     "target": {
       "workspace_id": "<workspace ID>",
       "lakehouse_id": "<Lakehouse ID>",
       "path": "Tables/silver/orders",
       "format": "delta"
     },
     "test_set_id": "<your test set's ID>"
   }
   ```

3. On the **General** tab, expand **Advanced** and tick **Secure output**.

   ![Screenshot of the Prepare validation activity's General tab with Secure output ticked.](https://mintcdn.com/general-validation/ZnesrwsntO0ZfNlJ/images/how-to/pipeline-secure-output.png?fit=max\&auto=format\&n=ZnesrwsntO0ZfNlJ\&q=85\&s=79567d108fb065c7408fc6b7c7577886)

4. On the **Home** tab, select **Invoke pipeline**. Name the activity
   `Run validation` and connect it to run after `Prepare validation`.

   ![Screenshot of the Fabric pipeline editor with the Home tab and Invoke pipeline highlighted.](https://mintcdn.com/general-validation/ZnesrwsntO0ZfNlJ/images/how-to/pipeline-invoke-activity.png?fit=max\&auto=format\&n=ZnesrwsntO0ZfNlJ\&q=85\&s=a3defde6328514609bc85922ddc9c659)

5. On its **Settings** tab, choose **Fabric**, the `Run General Validation`
   connection, your General Validation workspace, and the pipeline named
   **General Validation**. Then set the parameters.

   | Parameter | Value |
   | - | - |
   | `mode` | `run` |
   | `payload_base64` | `@activity('Prepare validation').output.payload_base64` |
   | `run_id` | `@activity('Prepare validation').output.id` |
   | `report_token` | `@activity('Prepare validation').output.report.token` |

   ![Screenshot of the Run validation activity selected on the canvas, with its Settings tab showing the connection, workspace, pipeline, and parameters.](https://mintcdn.com/general-validation/ZnesrwsntO0ZfNlJ/images/how-to/pipeline-run-validation.png?fit=max\&auto=format\&n=ZnesrwsntO0ZfNlJ\&q=85\&s=0ad4c8439be5e5b4351ef408a116faaa)

6. On the **General** tab of `Run validation`, expand **Advanced**, tick
   **Secure input** (so `report_token` is not logged), and set an activity
   timeout. Keep **Retry** at `0` on both `Prepare validation` and `Run
   validation`.

> [!TIP]
>
> To validate an existing Table Pair instead of naming source and target Tables,
> send `@concat('{"id":"', guid(), '","pair_id":"<pair-id>"}')` as the body of
> `Prepare validation`. To validate whichever Table a run loaded, use your
> pipeline's parameters in the body, for example
> `Tables/bronze/@{pipeline().parameters.table}` as the path. Each source gets
> its own Table Pair the first time it is validated.

## Step 9: Run your pipeline

Run your pipeline. When the Tables match, `Run validation` succeeds and your
pipeline continues. When they don't, `Run validation` fails with the verdict
and a link to the Run, and the activities after it don't run.

Open **Results** in General Validation to see each Run.

![Screenshot of the Results page in General Validation with Results and a Run's Passed result highlighted.](https://mintcdn.com/general-validation/ZnesrwsntO0ZfNlJ/images/how-to/app-results.png?fit=max\&auto=format\&n=ZnesrwsntO0ZfNlJ\&q=85\&s=2f64332b870c9fd22cddd0fcbae87943)

> [!NOTE]
>
> General Validation needs read access to each Table it compares. If a Run
> ends with **Could not read a Table**, open the Table Pair in General
> Validation, copy the snippet from **Access for validation** and run it in a
> Fabric notebook as a workspace Admin (or send the request it shows), and run
> your pipeline again.

## Step 10: Run your pipeline on a schedule

This step is optional. Fabric starts your pipeline at the times you choose.

1. Open your pipeline. On the **Home** tab, select **Schedule**, then **Add
   Schedule**.
2. Choose how often it runs, its start and end dates, and your time zone, then
   select **Save**.
3. To get Fabric's email when a scheduled run fails, add people or groups
   under **Failure notifications**.

Fabric runs a schedule as the person who last saved it, and the schedule
expires when that person has not signed in to Fabric for 90 days. Fabric also
turns a schedule off after about 10 failed runs in a row, and `Run validation`
fails whenever the Tables don't match. Set up
[Monitoring and alerts](https://docs.generalvalidation.com/validate-data/monitoring.md)
so General Validation tells you about the first failure. See
[Scheduled pipeline runs](https://learn.microsoft.com/en-us/fabric/data-factory/pipeline-runs#scheduled-pipeline-runs)
on Microsoft Learn.

## Troubleshooting

* **First run fails with "unable to acquire user token".** The first time your
  pipeline workspace's identity invokes the validation pipeline, Fabric can
  fail to start it with the message `"Job failed to start: unable to acquire
  user token"`. The Invoke pipeline activity can take about half an hour to
  report this. Validation did not run, and the Run stays Prepared until it ends
  in Error. Run your pipeline again, which prepares new Runs.
* **Keep Retry at `0` on both activities.** A retried Web activity prepares a
  second Run, and a Run that has already started cannot be run again.
* **Sequential `ForEach` behavior.** Inside a sequential `ForEach`, items after
  a failed validation still run, and the `ForEach` activity then fails with the
  first failure's message.

## Related content

* [Validate each source a pipeline loads](https://docs.generalvalidation.com/api/run-validation.md#validate-each-source-a-pipeline-loads)
* [API authentication](https://docs.generalvalidation.com/api/authentication.md)
* [Monitoring and alerts](https://docs.generalvalidation.com/validate-data/monitoring.md)
* [Troubleshooting and logs](https://docs.generalvalidation.com/administration/troubleshooting.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.