Data Governance Meets SQL: Unlocking Insights with 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.
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.
Contents
Why Data Governance Matters for SQL Systems
BeginnerFor every SQL database in an estate, governance addresses six concerns that performance tuning and backups alone cannot solve:
| Concern | Governance Question |
|---|---|
| Data discovery and cataloging | Can users find tables and columns, understand what they mean, and know which business terms apply? |
| Metadata and lineage | Where does data come from, how is it transformed, and who uses it? |
| Data quality | Are there rules ensuring minimum standards — no nulls in key columns, consistent formats, valid ranges? |
| Access control and sensitivity | Who can see or modify data, particularly sensitive data like PII? |
| Compliance and auditability | Is the organization prepared to show regulators who accessed what, when, and for what purpose? |
| Business value alignment | Is 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.
Introducing Microsoft Purview
BeginnerMicrosoft 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:
| Capability | What It Does for SQL |
|---|---|
| Source registration | Register Azure SQL, on-premises SQL Server (via Azure Arc), and Azure SQL Managed Instance as data sources |
| Metadata scanning | Extract tables, views, columns, stored procedures, and lineage from views and stored procedures (with prerequisites) |
| Classification and labeling | Apply sensitivity labels and information types to data assets — synchronized with SQL Server-native classification where applicable |
| Access policies | Define who can view or modify data assets directly from the Purview portal, without writing individual GRANT statements on each instance |
| Data catalog and glossary | Maintain business glossaries, data products, and domains for discoverability across the estate |
| Data quality rules | Define and monitor quality rules against SQL sources and review violations in Purview dashboards |
Classifying Sensitive Columns
IntermediateConsider 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.
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.
Access Policy for On-Premises SQL Server via Azure Arc
AdvancedOn-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
Building Lineage for SQL Views and Stored Procedures
IntermediateConsider 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.
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.
Governance Domains and Data Products
IntermediatePurview 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.
Best Practices
Beginner| Practice | Detail |
|---|---|
| Start small | Use the free Purview tier to catalog a small number of SQL sources and tag high-value assets before expanding to the full estate |
| Assign owners | Every domain, collection, and data asset should have a named owner. Ownership drives accountability for quality and classification accuracy |
| Focus on high-value data | Classify and govern PII, business-critical tables, and regulated data first. Governing everything at once leads to governance fatigue and inconsistent quality |
| Automate scans | Schedule regular incremental scans so metadata stays current. Manual one-time scans quickly become stale in active environments |
| Link business terms to columns | A 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 rules | Define quality rules for key constraints (no nulls in primary keys, no negative amounts) and review the violation dashboard regularly |
| Use lineage for impact analysis | Before changing a column name or data type, check Purview lineage for downstream consumers — views, stored procedures, reports, and ML pipelines |
| Apply sensitivity labels early | Labels applied at source registration time propagate naturally as the data estate grows. Retrofitting labels across a large existing estate is significantly more work |
Workshop: Hands-On with SQL and Microsoft Purview
IntermediateThe 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.
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.
References
- Microsoft Docs: Microsoft Purview Documentation
- Microsoft Docs: Register and Scan Azure SQL Database in Microsoft Purview
- Microsoft Docs: Register and Scan On-Premises SQL Server in Microsoft Purview
- Microsoft Docs: Microsoft Purview Lineage Overview
- Microsoft Docs: Microsoft Purview Data Classification
- Microsoft Docs: Microsoft Purview Access Policies for SQL
- Microsoft Docs: Microsoft Purview Data Quality Overview
- Microsoft Docs: New Name for Azure Active Directory (Microsoft Entra ID)
- Microsoft Docs: SQL Server on Azure Arc Overview
- SQLYARD: SQL Server Data Classification: Discovery, Labeling, and Audit Integration
- SQLYARD: SQL Server 2022: Azure Integration, Query Intelligence, Security, and Data Virtualization
- SQLYARD: SQL Server Service Account Permissions
Discover more from SQLYARD
Subscribe to get the latest posts sent to your email.


