Data Governance Meets SQL: Unlocking Insights with Microsoft Purview

Data Governance Meets SQL: Unlocking Insights with Microsoft Purview | SQLYARD

Data Governance Meets SQL: Unlocking Insights with Microsoft Purview


Azure SQL • SQL Server 2022 • SQL Server on Azure Arc • Microsoft Purview

In data-rich enterprises, managing and governing SQL data is no longer optional. Teams focused on performance, backup, indexing, and analytics routines often overlook the governance layer entirely. Without it, the risks include data quality issues, compliance failures, opaque lineage, uncontrolled access, and wasted analytics effort. This article covers how to apply data governance principles across SQL environments using Microsoft Purview, with working SQL examples, governance patterns, and a hands-on workshop for Azure SQL and on-premises SQL Server connected via Azure Arc.

SQL Server-native classification vs Purview governance. SQL Server has a built-in column classification feature (ADD SENSITIVITY CLASSIFICATION) that is separate from Purview. It stores label metadata directly in the database and integrates with SQL Server Audit. Purview can import and extend those labels at the enterprise level. For the SQL Server-native classification feature, see the SQLYARD article on SQL Server Data Classification: Discovery, Labeling, and Audit Integration.
1

Why Data Governance Matters for SQL Systems

Beginner

For every SQL database in an estate, governance addresses six concerns that performance tuning and backups alone cannot solve:

ConcernGovernance Question
Data discovery and catalogingCan users find tables and columns, understand what they mean, and know which business terms apply?
Metadata and lineageWhere does data come from, how is it transformed, and who uses it?
Data qualityAre there rules ensuring minimum standards — no nulls in key columns, consistent formats, valid ranges?
Access control and sensitivityWho can see or modify data, particularly sensitive data like PII?
Compliance and auditabilityIs the organization prepared to show regulators who accessed what, when, and for what purpose?
Business value alignmentIs data governed in a way that accelerates the business rather than blocking it?

SQL systems are often the foundation of analytic, reporting, and operational workloads. Weak governance means downstream analytics in Power BI, dashboards, and ML models receive unreliable results. Fixing poor data governance after the fact is significantly more costly than building it in from the start.

2

Introducing Microsoft Purview

Beginner

Microsoft Purview is Microsoft’s unified data governance platform. Data sources (cloud and on-premises) are registered in Purview, their metadata is scanned and cataloged, data assets are classified and labeled, access policies are defined, lineage is built, and business glossaries are maintained. The result is a governed, discoverable, and trustworthy data estate across all connected sources.

Key capabilities relevant to SQL environments:

CapabilityWhat It Does for SQL
Source registrationRegister Azure SQL, on-premises SQL Server (via Azure Arc), and Azure SQL Managed Instance as data sources
Metadata scanningExtract tables, views, columns, stored procedures, and lineage from views and stored procedures (with prerequisites)
Classification and labelingApply sensitivity labels and information types to data assets — synchronized with SQL Server-native classification where applicable
Access policiesDefine who can view or modify data assets directly from the Purview portal, without writing individual GRANT statements on each instance
Data catalog and glossaryMaintain business glossaries, data products, and domains for discoverability across the estate
Data quality rulesDefine and monitor quality rules against SQL sources and review violations in Purview dashboards
Identity provider note. Microsoft Purview integrates with Microsoft Entra ID (formerly Azure Active Directory, renamed July 2023) for authentication and access control. References to “Azure AD” in older documentation and scripts refer to the same service now called Microsoft Entra ID. No migration is required — only the name changed.
3

Classifying Sensitive Columns

Intermediate

Consider a table in an Azure SQL Database:

CREATE TABLE dbo.Customer (
    CustomerID   INT           PRIMARY KEY,
    FirstName    NVARCHAR(100),
    LastName     NVARCHAR(100),
    Email        NVARCHAR(255),
    CreditCard   CHAR(16),
    CreatedDate  DATETIME2
);
GO

When Purview scans this database, it identifies columns matching known sensitive data patterns and recommends classifications. The CreditCard column is identified and classified as “Credit Card Number” with a “Highly Confidential” sensitivity label. After tagging in the Purview catalog, a protection policy restricts read access to users in a designated security group — all others are blocked from the labeled asset.

The classification taxonomy in Purview aligns with the sensitivity labels defined in the Microsoft 365 Compliance Center. When the same labels are used in Purview and in SQL Server’s native classification feature, the label inventory is consistent across the entire data estate. For SQL Server on-premises instances, the SSMS Data Classification pane can import Purview labels directly, creating a single source of truth for sensitivity labeling.

Purview classification and SQL Server-native classification are separate mechanisms. Purview classification stores metadata in the Purview catalog. SQL Server-native classification (ADD SENSITIVITY CLASSIFICATION) stores metadata in sys.sensitivity_classifications within the database. Both can use the same label taxonomy, and Purview can read SQL Server-native classifications after scanning, but they do not automatically sync in real time. A governance strategy should define which is the authoritative source for each SQL environment.
4

Access Policy for On-Premises SQL Server via Azure Arc

Advanced

On-premises SQL Server 2022 instances connected via Azure Arc can be governed through Purview access policies, allowing data owners rather than DBAs to assign access permissions. The DBA still manages the SQL Server instance, but domain-level access decisions for cataloged assets flow through Purview rather than requiring individual GRANT statements on every instance.

The high-level setup requires registering the SQL Server source in Purview, enabling data policy enforcement for the source, and creating a policy that grants the appropriate group access to the target assets. The Purview managed identity also needs permissions in SQL Server to scan metadata:

-- Grant the Purview managed identity read access for metadata scanning
-- Replace  with the managed identity name from the Purview account
USE YourDatabase;
GO

CREATE USER [] FROM EXTERNAL PROVIDER;
ALTER ROLE db_datareader ADD MEMBER [];
GO
Azure Arc registration is a prerequisite. For on-premises SQL Server instances, Purview access policies and metadata scanning require the SQL Server instance to be registered with Azure Arc and the Azure extension for SQL Server to be installed. Without Arc registration, only Azure SQL Database and Azure SQL Managed Instance support Purview access policies natively.
5

Building Lineage for SQL Views and Stored Procedures

Intermediate

Consider a SQL view that aggregates customer and order data:

CREATE VIEW dbo.vw_SalesSummary AS
SELECT
    c.CustomerID,
    c.LastName,
    SUM(o.Amount) AS TotalSpent
FROM dbo.Customer c
JOIN dbo.Orders   o ON c.CustomerID = o.CustomerID
GROUP BY c.CustomerID, c.LastName;
GO

When Purview scans the database with lineage extraction enabled, it maps the dependency from dbo.vw_SalesSummary to dbo.Customer and dbo.Orders. This lineage appears in the Purview asset view for the view, showing upstream sources and any downstream consumers.

The practical value is in impact analysis: if the schema of dbo.Orders changes (the Amount column is renamed or its data type changes), Purview lineage immediately shows which views, stored procedures, and downstream Power BI reports depend on that column. Without lineage, identifying all affected objects requires manual investigation across the estate.

Lineage extraction for stored procedures requires additional prerequisites. View lineage is extracted automatically during a standard Purview scan. Stored procedure lineage requires enabling the lineage extraction option in the scan configuration and granting the Purview managed identity db_owner or equivalent permissions, which may not be acceptable in all environments. Evaluate the security trade-off against the lineage benefit before enabling stored procedure lineage in production.
6

Governance Domains and Data Products

Intermediate

Purview organizes governed data assets into domains and data products. A domain represents a business area — “Customer and Sales” — and contains data products that package related assets together for consumption by analytics teams.

A data product called “Sales Summary Dataset” inside the “Customer and Sales” domain would include the dbo.vw_SalesSummary view and the underlying tables, with business glossary terms (“CustomerID”, “TotalSpent”, “EmailAddress”) linked to the relevant columns. Analytics teams browsing Purview see the data product as ready, curated, and trusted — without needing to understand the underlying schema or trace which tables feed which views.

Glossary terms link business language to technical column names. A column named Amt becomes discoverable and understandable when linked to a glossary term “TotalSpent (USD, net of returns)” with an owner, a definition, and a reference to the upstream source.

7

Best Practices

Beginner
PracticeDetail
Start smallUse the free Purview tier to catalog a small number of SQL sources and tag high-value assets before expanding to the full estate
Assign ownersEvery domain, collection, and data asset should have a named owner. Ownership drives accountability for quality and classification accuracy
Focus on high-value dataClassify and govern PII, business-critical tables, and regulated data first. Governing everything at once leads to governance fatigue and inconsistent quality
Automate scansSchedule regular incremental scans so metadata stays current. Manual one-time scans quickly become stale in active environments
Link business terms to columnsA column named Amt is far more useful to analysts when linked to the glossary term “TotalSpent” with a definition and data steward contact
Monitor data quality rulesDefine quality rules for key constraints (no nulls in primary keys, no negative amounts) and review the violation dashboard regularly
Use lineage for impact analysisBefore changing a column name or data type, check Purview lineage for downstream consumers — views, stored procedures, reports, and ML pipelines
Apply sensitivity labels earlyLabels applied at source registration time propagate naturally as the data estate grows. Retrofitting labels across a large existing estate is significantly more work
8

Workshop: Hands-On with SQL and Microsoft Purview

Intermediate

The following steps walk through a complete Purview governance setup targeting an Azure SQL Database. The same steps apply to an on-premises SQL Server 2022 instance registered via Azure Arc, with the Arc registration completed first.

Prerequisites: an Azure subscription, an Azure SQL Database or Azure Arc-connected SQL Server 2022 instance, and a Microsoft Purview account in the same Azure tenant.

Step 1: Register the SQL Data Source

In the Purview portal, navigate to Data Map, Sources, Register. Choose Azure SQL Database (or SQL Server on Azure Arc for on-premises instances) and complete the subscription, resource group, and server details. After registration, configure the scan credentials using the Purview managed identity and define the scan scope (full database or selected schemas).

Step 2: Grant Required Permissions in SQL

-- Grant the Purview managed identity read access for scanning
-- Replace  with the managed identity name shown in the Purview account
USE YourDatabase;
GO

CREATE USER [] FROM EXTERNAL PROVIDER;
ALTER ROLE db_datareader ADD MEMBER [];
GO

-- For stored procedure lineage, db_owner is required
-- Evaluate security implications before granting in production
-- ALTER ROLE db_owner ADD MEMBER [];

Step 3: Run the Metadata Scan

In Purview, under the registered source, select New Scan. Choose the target schemas or tables, select the scan rule set (which determines which classifiers run), and execute. After the scan completes, assets appear in the Data Map with their table names, column names, and any automatic classification recommendations applied.

Step 4: Curate Assets and Create Glossary Terms

In the Purview catalog, navigate to the discovered assets. For a key table such as dbo.Customer, add a description, accept or adjust classification recommendations (for example, confirming “Credit Card Number” on the CreditCard column), and assign a data owner. In the Glossary section, define business terms such as “CustomerID”, “TotalSpent”, and “EmailAddress” and link them to the corresponding columns in the asset view.

Step 5: Apply a Sensitivity Label and Protection Policy

Inside Purview, assign a sensitivity label such as “Highly Confidential” to a column flagged as sensitive. Define a protection policy specifying that only members of a designated security group can read items with that label. For supported data sources including Azure SQL and Arc-connected SQL Server 2022, Purview enforces this policy through its integration with Microsoft Entra ID and the Purview managed identity.

SQL Server-native classification and Purview labels can coexist. For on-premises SQL Server instances, the SQL Server-native ADD SENSITIVITY CLASSIFICATION feature stores labels in sys.sensitivity_classifications and integrates with SQL Server Audit. Purview can read these labels during scanning. For the full SQL Server-native classification workflow including SENSITIVE_BATCH_COMPLETED_GROUP audit integration, see the SQLYARD article on SQL Server Data Classification: Discovery, Labeling, and Audit Integration.

Step 6: Explore Lineage

For views and stored procedures, ensure lineage extraction is enabled in the scan configuration. After the scan completes, open the asset view for a view or stored procedure and inspect the Lineage tab. The graph shows upstream source tables and downstream consumers. Select any node to navigate to that asset and see its own lineage, classifications, and ownership.

Step 7: Build a Data Quality Rule (Optional)

In Purview under Data Quality (part of Unified Catalog), connect to the SQL source and define a rule — for example, no nulls in Customer.Email, or TotalSpent must be greater than or equal to zero. After the rule runs against the source data, the Data Quality dashboard shows pass rates, violation counts, and trend over time. Violations can trigger governance workflows to notify the data steward.

Step 8: Review Data Estate Health

In the Purview portal, navigate to Data Estate Health to review which domains have complete classification coverage, which assets are missing owners, and where data quality violations are concentrated. Use this view to prioritize the next governance sprint: onboard additional sources, expand domain coverage, or train data stewards on the classification workflow.

Governance is a journey, not a one-time project. Start with the highest-value assets — PII columns, business-critical tables, regulated data. Build domains and glossaries. Enforce basics like access control and classification. Expand outward as the team builds confidence with the platform. The SQL examples above are a foundation to adapt to each environment.

Discover more from SQLYARD

Subscribe to get the latest posts sent to your email.

Leave a Comment