How to fetch the record count of classifications using purview API ?

Dhanoordaran V 170 Reputation points
2025-04-17T10:25:37.74+00:00

Let's say the data asset "A" is having the classification as "All full names". similarly, we have x number of data assets across Y number of data sources classified as "All full name".

Q1) In this case how can I fetch the detail "total number of records classified as "All full name" across all data sources and data assets within them.

Q2) I may need to send this information to external reporting systems (such as PowerBi) where I can filter the record count based on "Data sources" or "data assets" for all the system & custom classifications.

Kindly explain in detail how to address these using Purview's API capabilities

Microsoft Purview
Microsoft Purview
A Microsoft data governance service that helps manage and govern on-premises, multicloud, and software-as-a-service data. Previously known as Azure Purview.
1,575 questions
0 comments No comments
{count} votes

Accepted answer
  1. Smaran Thoomu 23,260 Reputation points Microsoft External Staff Moderator
    2025-04-17T11:52:30.54+00:00

    Hi @Dhanoordaran V

    Microsoft Purview provides REST APIs that allow you to query classification metadata across your data estate. However, it’s important to clarify that Purview does not track actual “record counts” of classified data (e.g., number of rows labeled as “All full names”) at the row level. It works at the metadata level, i.e., identifying which columns or assets are classified with specific labels.

    How to get the total number of assets/columns classified as “All full name”

    You can use the Scan Results / Classifications API to list assets or columns that have a specific classification applied.

    Steps:

    • Use the Purview Search API to find all assets with the classification "All full names":
    POST https://<your-purview-account-name>.purview.azure.com/catalog/api/search/query?api-version=2023-09-01-preview
    

    Sample Payload:

    {
      "keywords": null,
      "limit": 100,
      "filter": {
        "classification": ["All full names"]
      } 
    }
    
    • Count the number of results returned (you can paginate using the offset parameter).
    • Optionally, filter by asset type or data source in the request body.

    Exporting this to Power BI with filters by asset or data source

    There’s no direct connector yet, but you can follow this workaround:

    Option 1: Azure Function / Logic App

    • Create an Azure Function or Logic App that calls the Purview Search API regularly.
    • Parse and structure the results (e.g., asset name, data source, classification).
    • Store the results in a staging location (Azure SQL, Blob Storage, or Data Lake).
    • Connect Power BI to that storage for reporting and filtering.

    Option 2: Azure Data Factory (ADF)

    • ADF Web Activity can call the Purview API and capture results.
    • Store and transform that data into a Power BI-friendly format.

    You’ll need to register an Azure AD app, grant it Purview Data Curator or Reader role, and authenticate using OAuth2 when calling the API.

    Reference: https://learn.microsoft.com/en-us/rest/api/purview/

    I hope this information helps. Please do let us know if you have any further queries.


    Kindly consider upvoting the comment if the information provided is helpful. This can assist other community members in resolving similar issues.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.