Before you start
- An Owner has activated the Organization and set up the Environment in the app. Both happen once.
- Your tool calls the API with a workload identity that holds
GV.APIContributor; see API authentication. The API reference lists every operation and its schema. - Your tool makes the Fabric calls with an identity that has the Fabric access each step names: its own service principal, or the person it works for when an agent acts on someone’s behalf. A service principal also needs your Fabric administrator to let service principals use Fabric APIs.
Create Tables, a Table Pair, and Tests
Save a reference to each existing Table withPOST /api/v1/fabric/tables,
using the workspace, Lakehouse or Warehouse, and Table that Fabric’s own API
lists. Then create the Table Pair with POST /api/v1/fabric/pairs and add Tests
with POST /api/v1/fabric/tests. GET /api/v1/fabric/catalog lists the
validation functions.
Give the workspace identity read access
Saving a Table Pair in the app gives the workspace identity read access to the pair’s Tables. A pair created through the API does not get it, so give it once per pair before the pair’s first Run. Ask the API what the pair needs:workspaces list means the pair reads only your Environment and
needs nothing. Otherwise, in Fabric, with Admin or Member on each listed
workspace:
- Add the identity as Viewer on the workspace with
POST https://api.fabric.microsoft.com/v1/workspaces/<workspace-id>/roleAssignmentsand the body{"principal": {"id": "<identity_id>", "type": "ServicePrincipal"}, "role": "Viewer"}. A409response means the identity already has a role there; keep it. - For each Lakehouse, give the identity Read on the listed paths through a
OneLake data access role. The app keeps them in the role named
data_access_role, so add the paths there and both stay in one role. Fabric’sPUT .../items/<lakehouse-id>/dataAccessRolesreplaces every role in the Lakehouse, so read the roles first and send the others back unchanged with theETagyou read.
Start a Run
-
Prepare the Run with
POST /api/v1/fabric/runsand a new Run ID:{"id": "<new-uuid>", "pair_id": "<pair-id>"}. The response carriespayload_base64andreport.token. The token comes back only from the call that prepared the Run; treat it as a secret and keep it out of logs. Retry with the same Run ID only to repeat that request. -
Read
workspace_idandpipeline_idfromGET /api/v1/fabric/settings. -
Start the validation pipeline in Fabric with an identity that has
Contributor, Member, or Admin on that workspace:
-
Send the job ID, the last segment of the
Locationheader in Fabric’s answer, withPOST /api/v1/fabric/runs/<run-id>/submissionand the body{"job_id": "<job-id>"}. The app then shows the Run as submitted and links it to Fabric Monitor. -
Read
GET /api/v1/fabric/runs/<run-id>untilstatusispassed,failed, orerror, and read each Test’s Result in the response.
Validate from a Fabric pipeline
A pipeline of yours can run a Table Pair and stop its later steps when validation does not pass. Add two activities before the steps to protect:- A Web activity that prepares the Run. Its connection signs in as your
workload’s app registration with service principal authentication, a
secret, and the audience
api://78d5d8af-9dd6-49dd-b06c-38c3a3c707af(connection typeWebForPipeline), with the base URLhttps://api.generalvalidation.com. Use methodPOST, relative URL/api/v1/fabric/runs, and the body@concat('{"id":"', guid(), '","pair_id":"<pair-id>"}'). Turn on Secure output, because the answer holds the report token. - An Invoke pipeline activity that runs the General Validation
pipeline in your Environment’s workspace and waits for it. Its connection
uses your pipeline workspace’s identity (connection type
FabricDataPipelines). Set the parametersmodetorun,payload_base64to@activity('<web activity>').output.payload_base64,run_idto@activity('<web activity>').output.id, andreport_tokento@activity('<web activity>').output.report.token. Turn on Secure input, and give the activity a timeout.