SlideShare a Scribd company logo
Row level security
Row Level Security
SQLschool.gr
Team
Antonios Chatzipavlis
SQL Server Evangelist • Trainer
Vassilis Ioannidis
SQL Server Expert • Trainer
Fivi Panopoulou
System Engineer • Speaker
Sotiris Karras
System Engineer • Speaker
Followus
insocialmedia
@sqlschool /@SotKarras
fb/sqlschoolgr
yt/c/SqlschoolGr
SQL School Greece group
Helpneeded?
help@sqlschool.gr
Presentation
Content
 Overview
 Setting up RLS
 Filter Predicates
 Blocking Predicates
 Best Practices
 Considerations and Limitations
 First introduced in Azure SQL, in January 2015.
 Row Level Security(RLS) enables the implementation of restrictions on data
row access.
 Row level security introduces predicate based access control where the
predicate is used as a criterion to determine whether or not the user has
the appropriate access to the data.
 The predicate can be anything from the characteristics of the user
executing the query (role membership, execution context) to complex
business logic involving multiple tables of the database to SQL Server
metadata.
 The enforcement logic lies inside the database and schema is bound to
the table.
Overview
Overview
Fine-grained
access control
Application
transparency
RLS works transparently at
query time, no app changes
needed
Compatible with RLS in other
leading products
Centralized
security logic
Enforcement logic resides
inside database and is
schema-bound to the table it
protects providing greater
security. Reduced application
maintenance and complexity
Store data intended for many consumers in a single database/table while at the same time restricting row-level read and write access based on users’ execution
context.
Setting Up RLS
 Predicate Function
 Security Predicates
 Security Policies
Predicate function
 User-defined inline table-valued function (iTVF) implementing security logic.
 Schema bound to the table so that no changes can be done to the security policy
under the hood.
 Can be arbitrarily complicated, containing joins with other tables.
 Performance wise, predicate functions get optimized to provide comparable
performance to views, as if the logic were directly embedded in the original
query statement.
 Still, the more complex the security logic gets, the heavier the performance
impact may get.
Predicate Function
Security Predicate
 Binds a predicate function to a particular table, applying it for all queries.
 Two types of predicates: filter predicates and blocking predicates (more on that
in a bit).
Security Predicate
Security policy
 Collection of security predicates for managing security across multiple tables.
 Can be turned on and off at will (STATE = ON|OFF).
 Can be created either by using SCHEMABINDING or not. The recommended (and
default) practice is with SCHEMABINDING on.
 Attempts to alter the columns of a table referenced by a schema bound security
policy will result in an error. However, columns not referenced by the predicate
can be altered.
 Attempts to add a predicate on a table that already has one defined for the
specified operation (regardless of whether it is enabled or disabled) results in an
error.
 Defining multiple active security policies that contain non-overlapping
predicates, succeeds.
Security Policy
Filter Predicates
 Filter predicates are applied while reading data from the base table, and it affects
all get operations.
 SELECT statements.
 DELETE statements (i.e. user cannot delete rows that are filtered).
 UPDATE statements (i.e. user cannot update rows that are filtered, although it is possible to update rows
in such way that they will be subsequently filtered).
 A filter predicate will silently filter out the rows that fail to pass the security
predicate.
 That means that no error message will be returned to the user if he tries to update or delete rows that
he is not allowed to.
 The application can INSERT any rows, regardless of whether or not they will be
filtered during any other operation.
 If the dbo user, a member of the db_owner role, or the table owner queries against
a table that has a security policy defined and enabled the rows are
filtered/restricted as defined by the security policy.
Filter Predicates
RLS and Filter predicates
Blocking Predicates
 Enforce granular control over write access to data for different users, including
scenarios that require separate access logic for INSERT, UPDATE, and DELETE
operations.
 Blocking predicates affect ALL write operations (inserts/updates/deletes).
 Four options to choose from when declaring a blocking predicate:
 AFTER INSERT and AFTER UPDATE predicates can prevent users from updating rows to values that
violate the predicate.
 BEFORE UPDATE predicates can prevent users from updating rows that currently violate the predicate.
 BEFORE DELETE predicates can block delete operations.
 If none of the above is set then the predicate covers every operation.
Blocking Predicates
Putting Everything together
Best Practices
 Create a separate schema for the security objects.
 And give permissions to that schema to the security manager.
 Additionally the security manager does not require any additional permissions to
the underlying tables.
 Avoid type conversions in the predicate functions and be very careful of
mismatches.
 Recursion can be used.
 If the recursion is direct the optimizer will detect it and optimize it accordingly.
 If the recursion is indirect (e.g. the predicate function uses another function that calls the predicate
function) then the optimizer cannot detect the recursion and a performance issue may occur.
 Do not rely on SET options, especially session-specific ones.
 Keep the security logic as simple as possible to allow easy maintenance and
minimal performance degradation.
Best Practices
Considerations and Limitations
 DBCC SHOW_STATISTICS will show statistics of unfiltered data.
 When using columnstore indexes, it is possible that the optimizer may modify the
query plan such that it does not use batch mode, because row-level security
applies a function.
 Temporal tables are compatible with RLS but the security policy must be applied
individually in each table (current and history).
 Memory optimized tables are compatible with RLS. The predicate function must be
defined using the NATIVE_COMPILATION option.
 Partitioned views are compatible with filter predicates but not with blocking predicates.
 That means that a partitioned view CANNOT be created on top of a table with a block predicate defined
on it.
 Security policies can be created on top of indexed views BUT the creation of
indexed views on top of tables that have a security policy is prohibited. (row
lookups through the inde bypass the policy).
 Row-Level security is incompatible with Filestream.
 RLS is incompatible with Polybase.
Considerations and Limitations
Row level security
Row level security
S E L E C T K N O W L E D G E F R O M S Q L S E R V E R
Copyright © 2015 SQLschool.gr. All right reserved.
PRESENTER MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION

More Related Content

What's hot (20)

Azure security architecture
Azure security architectureAzure security architecture
Azure security architecture
Karl Ots
 
Power BI Row Level Security
Power BI   Row Level SecurityPower BI   Row Level Security
Power BI Row Level Security
JAZ Rathor
 
Azure storage
Azure storageAzure storage
Azure storage
Adam Skibicki
 
Azure Governance
Azure GovernanceAzure Governance
Azure Governance
Benjamin Hüpeden
 
Full Stack Monitoring with Azure Monitor
Full Stack Monitoring with Azure MonitorFull Stack Monitoring with Azure Monitor
Full Stack Monitoring with Azure Monitor
Knoldus Inc.
 
Canvas Apps for the Model-driven mind
Canvas Apps for the Model-driven mindCanvas Apps for the Model-driven mind
Canvas Apps for the Model-driven mind
Jukka Niiranen
 
Azure purview
Azure purviewAzure purview
Azure purview
Shafqat Turza
 
AWS glue technical enablement training
AWS glue technical enablement trainingAWS glue technical enablement training
AWS glue technical enablement training
Info Alchemy Corporation
 
Azure Security Overview
Azure Security OverviewAzure Security Overview
Azure Security Overview
David J Rosenthal
 
SAP on Azure Technical Pitch Deck
SAP on Azure Technical Pitch DeckSAP on Azure Technical Pitch Deck
SAP on Azure Technical Pitch Deck
Nicholas Vossburg
 
AWS VS AZURE VS GCP.pptx
AWS VS AZURE VS GCP.pptxAWS VS AZURE VS GCP.pptx
AWS VS AZURE VS GCP.pptx
Raneesh Ramesan
 
Understanding Azure Data Factory: The What, When, and Why (NIC 2020)
Understanding Azure Data Factory: The What, When, and Why (NIC 2020)Understanding Azure Data Factory: The What, When, and Why (NIC 2020)
Understanding Azure Data Factory: The What, When, and Why (NIC 2020)
Cathrine Wilhelmsen
 
Data Warehouse - Incremental Migration to the Cloud
Data Warehouse - Incremental Migration to the CloudData Warehouse - Incremental Migration to the Cloud
Data Warehouse - Incremental Migration to the Cloud
Michael Rainey
 
Introduction to the Salesforce Security Model
Introduction to the Salesforce Security ModelIntroduction to the Salesforce Security Model
Introduction to the Salesforce Security Model
Salesforce Developers
 
민첩하고 비용효율적인 Data Lake 구축 - 문종민 솔루션즈 아키텍트, AWS
민첩하고 비용효율적인 Data Lake 구축 - 문종민 솔루션즈 아키텍트, AWS민첩하고 비용효율적인 Data Lake 구축 - 문종민 솔루션즈 아키텍트, AWS
민첩하고 비용효율적인 Data Lake 구축 - 문종민 솔루션즈 아키텍트, AWS
Amazon Web Services Korea
 
Managing multiple event types in a single topic with Schema Registry | Bill B...
Managing multiple event types in a single topic with Schema Registry | Bill B...Managing multiple event types in a single topic with Schema Registry | Bill B...
Managing multiple event types in a single topic with Schema Registry | Bill B...
HostedbyConfluent
 
Autonomous Database Explained
Autonomous Database ExplainedAutonomous Database Explained
Autonomous Database Explained
Neagu Alexandru Cristian
 
Hashicorp Corporate Pitch Deck Stenio_v2
Hashicorp Corporate Pitch Deck Stenio_v2 Hashicorp Corporate Pitch Deck Stenio_v2
Hashicorp Corporate Pitch Deck Stenio_v2
Stenio Ferreira
 
Azure Synapse Analytics Overview (r2)
Azure Synapse Analytics Overview (r2)Azure Synapse Analytics Overview (r2)
Azure Synapse Analytics Overview (r2)
James Serra
 
Salesforce Development Best Practices
Salesforce Development Best PracticesSalesforce Development Best Practices
Salesforce Development Best Practices
Vivek Chawla
 
Azure security architecture
Azure security architectureAzure security architecture
Azure security architecture
Karl Ots
 
Power BI Row Level Security
Power BI   Row Level SecurityPower BI   Row Level Security
Power BI Row Level Security
JAZ Rathor
 
Full Stack Monitoring with Azure Monitor
Full Stack Monitoring with Azure MonitorFull Stack Monitoring with Azure Monitor
Full Stack Monitoring with Azure Monitor
Knoldus Inc.
 
Canvas Apps for the Model-driven mind
Canvas Apps for the Model-driven mindCanvas Apps for the Model-driven mind
Canvas Apps for the Model-driven mind
Jukka Niiranen
 
SAP on Azure Technical Pitch Deck
SAP on Azure Technical Pitch DeckSAP on Azure Technical Pitch Deck
SAP on Azure Technical Pitch Deck
Nicholas Vossburg
 
AWS VS AZURE VS GCP.pptx
AWS VS AZURE VS GCP.pptxAWS VS AZURE VS GCP.pptx
AWS VS AZURE VS GCP.pptx
Raneesh Ramesan
 
Understanding Azure Data Factory: The What, When, and Why (NIC 2020)
Understanding Azure Data Factory: The What, When, and Why (NIC 2020)Understanding Azure Data Factory: The What, When, and Why (NIC 2020)
Understanding Azure Data Factory: The What, When, and Why (NIC 2020)
Cathrine Wilhelmsen
 
Data Warehouse - Incremental Migration to the Cloud
Data Warehouse - Incremental Migration to the CloudData Warehouse - Incremental Migration to the Cloud
Data Warehouse - Incremental Migration to the Cloud
Michael Rainey
 
Introduction to the Salesforce Security Model
Introduction to the Salesforce Security ModelIntroduction to the Salesforce Security Model
Introduction to the Salesforce Security Model
Salesforce Developers
 
민첩하고 비용효율적인 Data Lake 구축 - 문종민 솔루션즈 아키텍트, AWS
민첩하고 비용효율적인 Data Lake 구축 - 문종민 솔루션즈 아키텍트, AWS민첩하고 비용효율적인 Data Lake 구축 - 문종민 솔루션즈 아키텍트, AWS
민첩하고 비용효율적인 Data Lake 구축 - 문종민 솔루션즈 아키텍트, AWS
Amazon Web Services Korea
 
Managing multiple event types in a single topic with Schema Registry | Bill B...
Managing multiple event types in a single topic with Schema Registry | Bill B...Managing multiple event types in a single topic with Schema Registry | Bill B...
Managing multiple event types in a single topic with Schema Registry | Bill B...
HostedbyConfluent
 
Hashicorp Corporate Pitch Deck Stenio_v2
Hashicorp Corporate Pitch Deck Stenio_v2 Hashicorp Corporate Pitch Deck Stenio_v2
Hashicorp Corporate Pitch Deck Stenio_v2
Stenio Ferreira
 
Azure Synapse Analytics Overview (r2)
Azure Synapse Analytics Overview (r2)Azure Synapse Analytics Overview (r2)
Azure Synapse Analytics Overview (r2)
James Serra
 
Salesforce Development Best Practices
Salesforce Development Best PracticesSalesforce Development Best Practices
Salesforce Development Best Practices
Vivek Chawla
 

Viewers also liked (10)

Exploring sql server 2016 bi
Exploring sql server 2016 biExploring sql server 2016 bi
Exploring sql server 2016 bi
Antonios Chatzipavlis
 
Introduction to Machine Learning on Azure
Introduction to Machine Learning on AzureIntroduction to Machine Learning on Azure
Introduction to Machine Learning on Azure
Antonios Chatzipavlis
 
Introduction to sql database on azure
Introduction to sql database on azureIntroduction to sql database on azure
Introduction to sql database on azure
Antonios Chatzipavlis
 
Live Query Statistics & Query Store in SQL Server 2016
Live Query Statistics & Query Store in SQL Server 2016Live Query Statistics & Query Store in SQL Server 2016
Live Query Statistics & Query Store in SQL Server 2016
Antonios Chatzipavlis
 
Microsoft SQL Family and GDPR
Microsoft SQL Family and GDPRMicrosoft SQL Family and GDPR
Microsoft SQL Family and GDPR
Antonios Chatzipavlis
 
Dynamic data masking sql server 2016
Dynamic data masking sql server 2016Dynamic data masking sql server 2016
Dynamic data masking sql server 2016
Antonios Chatzipavlis
 
Introduction to azure document db
Introduction to azure document dbIntroduction to azure document db
Introduction to azure document db
Antonios Chatzipavlis
 
Exploring sql server 2016
Exploring sql server 2016Exploring sql server 2016
Exploring sql server 2016
Antonios Chatzipavlis
 
Introduction to Azure Data Lake
Introduction to Azure Data LakeIntroduction to Azure Data Lake
Introduction to Azure Data Lake
Antonios Chatzipavlis
 
Azure SQL Data Warehouse
Azure SQL Data Warehouse Azure SQL Data Warehouse
Azure SQL Data Warehouse
Antonios Chatzipavlis
 

Similar to Row level security (20)

Row-level security and Dynamic Data Masking
Row-level security and Dynamic Data MaskingRow-level security and Dynamic Data Masking
Row-level security and Dynamic Data Masking
SolidQ
 
oracle
oracleoracle
oracle
tarunamoria
 
OER Unit 4 Virtual Private Database
OER Unit 4 Virtual Private DatabaseOER Unit 4 Virtual Private Database
OER Unit 4 Virtual Private Database
Girija Muscut
 
Active database system
Active database systemActive database system
Active database system
Adeolu Olaniyan
 
Active database
Active databaseActive database
Active database
mridul mishra
 
Data Redaction - OTN TOUR LA 2015
Data Redaction - OTN TOUR LA 2015 Data Redaction - OTN TOUR LA 2015
Data Redaction - OTN TOUR LA 2015
Alex Zaballa
 
Database modeling and security
Database modeling and securityDatabase modeling and security
Database modeling and security
Neeharika Nidadavolu
 
Sql server 2016 new features
Sql server 2016 new featuresSql server 2016 new features
Sql server 2016 new features
Ajeet Singh
 
Sql server 2016 new features
Sql server 2016 new featuresSql server 2016 new features
Sql server 2016 new features
Ajeet pratap Singh
 
Less11 Security
Less11 SecurityLess11 Security
Less11 Security
vivaankumar
 
Database security issues
Database security issuesDatabase security issues
Database security issues
n|u - The Open Security Community
 
Data base Access Control a look at Fine grain Access method
Data base Access Control a look at Fine grain Access methodData base Access Control a look at Fine grain Access method
Data base Access Control a look at Fine grain Access method
International Journal of Engineering Inventions www.ijeijournal.com
 
ICT-DBA4-09-0811-Monitor-and-Administer-Database.docx
ICT-DBA4-09-0811-Monitor-and-Administer-Database.docxICT-DBA4-09-0811-Monitor-and-Administer-Database.docx
ICT-DBA4-09-0811-Monitor-and-Administer-Database.docx
AmanGunner
 
Ebook5
Ebook5Ebook5
Ebook5
kaashiv1
 
Sql interview question part 5
Sql interview question part 5Sql interview question part 5
Sql interview question part 5
kaashiv1
 
New Features Sql 2008
New Features Sql 2008New Features Sql 2008
New Features Sql 2008
tomerl
 
Database concepts
Database conceptsDatabase concepts
Database concepts
shanthishyam
 
DB2 LUW Auditing
DB2 LUW AuditingDB2 LUW Auditing
DB2 LUW Auditing
DB2Locksmith
 
Oracle Data Redaction
Oracle Data RedactionOracle Data Redaction
Oracle Data Redaction
Alex Zaballa
 
ch20 Secuity & Admin Transparencies-6E.pptx
ch20 Secuity & Admin Transparencies-6E.pptxch20 Secuity & Admin Transparencies-6E.pptx
ch20 Secuity & Admin Transparencies-6E.pptx
alhashediyemen1
 
Row-level security and Dynamic Data Masking
Row-level security and Dynamic Data MaskingRow-level security and Dynamic Data Masking
Row-level security and Dynamic Data Masking
SolidQ
 
OER Unit 4 Virtual Private Database
OER Unit 4 Virtual Private DatabaseOER Unit 4 Virtual Private Database
OER Unit 4 Virtual Private Database
Girija Muscut
 
Data Redaction - OTN TOUR LA 2015
Data Redaction - OTN TOUR LA 2015 Data Redaction - OTN TOUR LA 2015
Data Redaction - OTN TOUR LA 2015
Alex Zaballa
 
Sql server 2016 new features
Sql server 2016 new featuresSql server 2016 new features
Sql server 2016 new features
Ajeet Singh
 
ICT-DBA4-09-0811-Monitor-and-Administer-Database.docx
ICT-DBA4-09-0811-Monitor-and-Administer-Database.docxICT-DBA4-09-0811-Monitor-and-Administer-Database.docx
ICT-DBA4-09-0811-Monitor-and-Administer-Database.docx
AmanGunner
 
Sql interview question part 5
Sql interview question part 5Sql interview question part 5
Sql interview question part 5
kaashiv1
 
New Features Sql 2008
New Features Sql 2008New Features Sql 2008
New Features Sql 2008
tomerl
 
Oracle Data Redaction
Oracle Data RedactionOracle Data Redaction
Oracle Data Redaction
Alex Zaballa
 
ch20 Secuity & Admin Transparencies-6E.pptx
ch20 Secuity & Admin Transparencies-6E.pptxch20 Secuity & Admin Transparencies-6E.pptx
ch20 Secuity & Admin Transparencies-6E.pptx
alhashediyemen1
 

More from Antonios Chatzipavlis (20)

Data virtualization using polybase
Data virtualization using polybaseData virtualization using polybase
Data virtualization using polybase
Antonios Chatzipavlis
 
SQL server Backup Restore Revealed
SQL server Backup Restore RevealedSQL server Backup Restore Revealed
SQL server Backup Restore Revealed
Antonios Chatzipavlis
 
Migrate SQL Workloads to Azure
Migrate SQL Workloads to AzureMigrate SQL Workloads to Azure
Migrate SQL Workloads to Azure
Antonios Chatzipavlis
 
Machine Learning in SQL Server 2019
Machine Learning in SQL Server 2019Machine Learning in SQL Server 2019
Machine Learning in SQL Server 2019
Antonios Chatzipavlis
 
Workload Management in SQL Server 2019
Workload Management in SQL Server 2019Workload Management in SQL Server 2019
Workload Management in SQL Server 2019
Antonios Chatzipavlis
 
Loading Data into Azure SQL DW (Synapse Analytics)
Loading Data into Azure SQL DW (Synapse Analytics)Loading Data into Azure SQL DW (Synapse Analytics)
Loading Data into Azure SQL DW (Synapse Analytics)
Antonios Chatzipavlis
 
Introduction to DAX Language
Introduction to DAX LanguageIntroduction to DAX Language
Introduction to DAX Language
Antonios Chatzipavlis
 
Building diagnostic queries using DMVs and DMFs
Building diagnostic queries using DMVs and DMFs Building diagnostic queries using DMVs and DMFs
Building diagnostic queries using DMVs and DMFs
Antonios Chatzipavlis
 
Exploring T-SQL Anti-Patterns
Exploring T-SQL Anti-Patterns Exploring T-SQL Anti-Patterns
Exploring T-SQL Anti-Patterns
Antonios Chatzipavlis
 
Designing a modern data warehouse in azure
Designing a modern data warehouse in azure   Designing a modern data warehouse in azure
Designing a modern data warehouse in azure
Antonios Chatzipavlis
 
Modernizing your database with SQL Server 2019
Modernizing your database with SQL Server 2019Modernizing your database with SQL Server 2019
Modernizing your database with SQL Server 2019
Antonios Chatzipavlis
 
Designing a modern data warehouse in azure
Designing a modern data warehouse in azure   Designing a modern data warehouse in azure
Designing a modern data warehouse in azure
Antonios Chatzipavlis
 
SQLServer Database Structures
SQLServer Database Structures SQLServer Database Structures
SQLServer Database Structures
Antonios Chatzipavlis
 
Sqlschool 2017 recap - 2018 plans
Sqlschool 2017 recap - 2018 plansSqlschool 2017 recap - 2018 plans
Sqlschool 2017 recap - 2018 plans
Antonios Chatzipavlis
 
Azure SQL Database for the SQL Server DBA - Azure Bootcamp Athens 2018
Azure SQL Database for the SQL Server DBA - Azure Bootcamp Athens 2018 Azure SQL Database for the SQL Server DBA - Azure Bootcamp Athens 2018
Azure SQL Database for the SQL Server DBA - Azure Bootcamp Athens 2018
Antonios Chatzipavlis
 
Statistics and Indexes Internals
Statistics and Indexes InternalsStatistics and Indexes Internals
Statistics and Indexes Internals
Antonios Chatzipavlis
 
Implementing Mobile Reports in SQL Sserver 2016 Reporting Services
Implementing Mobile Reports in SQL Sserver 2016 Reporting ServicesImplementing Mobile Reports in SQL Sserver 2016 Reporting Services
Implementing Mobile Reports in SQL Sserver 2016 Reporting Services
Antonios Chatzipavlis
 
Auditing Data Access in SQL Server
Auditing Data Access in SQL ServerAuditing Data Access in SQL Server
Auditing Data Access in SQL Server
Antonios Chatzipavlis
 
Stretch db sql server 2016 (sn0028)
Stretch db   sql server 2016 (sn0028)Stretch db   sql server 2016 (sn0028)
Stretch db sql server 2016 (sn0028)
Antonios Chatzipavlis
 
Troubleshooting sql server
Troubleshooting sql serverTroubleshooting sql server
Troubleshooting sql server
Antonios Chatzipavlis
 
Workload Management in SQL Server 2019
Workload Management in SQL Server 2019Workload Management in SQL Server 2019
Workload Management in SQL Server 2019
Antonios Chatzipavlis
 
Loading Data into Azure SQL DW (Synapse Analytics)
Loading Data into Azure SQL DW (Synapse Analytics)Loading Data into Azure SQL DW (Synapse Analytics)
Loading Data into Azure SQL DW (Synapse Analytics)
Antonios Chatzipavlis
 
Building diagnostic queries using DMVs and DMFs
Building diagnostic queries using DMVs and DMFs Building diagnostic queries using DMVs and DMFs
Building diagnostic queries using DMVs and DMFs
Antonios Chatzipavlis
 
Designing a modern data warehouse in azure
Designing a modern data warehouse in azure   Designing a modern data warehouse in azure
Designing a modern data warehouse in azure
Antonios Chatzipavlis
 
Modernizing your database with SQL Server 2019
Modernizing your database with SQL Server 2019Modernizing your database with SQL Server 2019
Modernizing your database with SQL Server 2019
Antonios Chatzipavlis
 
Designing a modern data warehouse in azure
Designing a modern data warehouse in azure   Designing a modern data warehouse in azure
Designing a modern data warehouse in azure
Antonios Chatzipavlis
 
Azure SQL Database for the SQL Server DBA - Azure Bootcamp Athens 2018
Azure SQL Database for the SQL Server DBA - Azure Bootcamp Athens 2018 Azure SQL Database for the SQL Server DBA - Azure Bootcamp Athens 2018
Azure SQL Database for the SQL Server DBA - Azure Bootcamp Athens 2018
Antonios Chatzipavlis
 
Implementing Mobile Reports in SQL Sserver 2016 Reporting Services
Implementing Mobile Reports in SQL Sserver 2016 Reporting ServicesImplementing Mobile Reports in SQL Sserver 2016 Reporting Services
Implementing Mobile Reports in SQL Sserver 2016 Reporting Services
Antonios Chatzipavlis
 

Recently uploaded (20)

Bringing data to life - Crime webinar Accessible.pptx
Bringing data to life - Crime webinar Accessible.pptxBringing data to life - Crime webinar Accessible.pptx
Bringing data to life - Crime webinar Accessible.pptx
Office for National Statistics
 
Lec 12.pdfghhjjhhjkkkkkkkkkkkjfcvhiiugcvvh
Lec 12.pdfghhjjhhjkkkkkkkkkkkjfcvhiiugcvvhLec 12.pdfghhjjhhjkkkkkkkkkkkjfcvhiiugcvvh
Lec 12.pdfghhjjhhjkkkkkkkkkkkjfcvhiiugcvvh
saifalroby72
 
STRABAG SE - Investor Presentation - February 2024.pdf
STRABAG SE - Investor Presentation - February 2024.pdfSTRABAG SE - Investor Presentation - February 2024.pdf
STRABAG SE - Investor Presentation - February 2024.pdf
andrianalampka
 
FT Partners Research - FinTech in Africa-2.pdf
FT Partners Research - FinTech in Africa-2.pdfFT Partners Research - FinTech in Africa-2.pdf
FT Partners Research - FinTech in Africa-2.pdf
Obinna8
 
artificial intelligence (1).pptx hgggfcgfch
artificial intelligence (1).pptx hgggfcgfchartificial intelligence (1).pptx hgggfcgfch
artificial intelligence (1).pptx hgggfcgfch
DevAnshGupta609215
 
apidays New York 2025 - AI for All by Ananya Upadhyay (United Rentals, Inc.)
apidays New York 2025 - AI for All by Ananya Upadhyay (United Rentals, Inc.)apidays New York 2025 - AI for All by Ananya Upadhyay (United Rentals, Inc.)
apidays New York 2025 - AI for All by Ananya Upadhyay (United Rentals, Inc.)
apidays
 
Mathcad Sales Presentation software for use.PPTX
Mathcad Sales Presentation software for use.PPTXMathcad Sales Presentation software for use.PPTX
Mathcad Sales Presentation software for use.PPTX
ManojSharma311544
 
ch068.pptnsnsnjsjjzjzjdjdjdjdjdjdjjdjdjdjdjxj
ch068.pptnsnsnjsjjzjzjdjdjdjdjdjdjjdjdjdjdjxjch068.pptnsnsnjsjjzjzjdjdjdjdjdjdjjdjdjdjdjxj
ch068.pptnsnsnjsjjzjzjdjdjdjdjdjdjjdjdjdjdjxj
MikkoPlanas
 
Kilowatt's Impact Report _ 2024 x
Kilowatt's Impact Report _ 2024                xKilowatt's Impact Report _ 2024                x
Kilowatt's Impact Report _ 2024 x
Kilowatt
 
this is the Dr. ibrahim presentations ppt.pptx
this is the Dr. ibrahim presentations ppt.pptxthis is the Dr. ibrahim presentations ppt.pptx
this is the Dr. ibrahim presentations ppt.pptx
ibrahimabdi22
 
463.8-Bitcoin from university of illinois
463.8-Bitcoin from university of illinois463.8-Bitcoin from university of illinois
463.8-Bitcoin from university of illinois
8gqtkfzwbb
 
DEWDHDIEFHIFHIHGIERHFIHIM SC ID (2).pptx
DEWDHDIEFHIFHIHGIERHFIHIM SC ID (2).pptxDEWDHDIEFHIFHIHGIERHFIHIM SC ID (2).pptx
DEWDHDIEFHIFHIHGIERHFIHIM SC ID (2).pptx
f8jyv28tjr
 
apidays New York 2025 - How AI is Transforming Product Management by Shereen ...
apidays New York 2025 - How AI is Transforming Product Management by Shereen ...apidays New York 2025 - How AI is Transforming Product Management by Shereen ...
apidays New York 2025 - How AI is Transforming Product Management by Shereen ...
apidays
 
14th International Conference on Advanced Computer Science and Information Te...
14th International Conference on Advanced Computer Science and Information Te...14th International Conference on Advanced Computer Science and Information Te...
14th International Conference on Advanced Computer Science and Information Te...
ijitcs
 
IoT, Data Analytics and Big Data Security.pptx
IoT, Data Analytics and Big Data Security.pptxIoT, Data Analytics and Big Data Security.pptx
IoT, Data Analytics and Big Data Security.pptx
fizarcse
 
TUG BD Kick Off Meet up 21 May Slide Deck.pptx
TUG BD Kick Off Meet up 21 May Slide Deck.pptxTUG BD Kick Off Meet up 21 May Slide Deck.pptx
TUG BD Kick Off Meet up 21 May Slide Deck.pptx
SaidAlHaque
 
Faces of the Future The Impact of a Data Science Course in Kerala.pdf
Faces of the Future The Impact of a Data Science Course in Kerala.pdfFaces of the Future The Impact of a Data Science Course in Kerala.pdf
Faces of the Future The Impact of a Data Science Course in Kerala.pdf
jzyphoenix
 
apidays New York 2025 - Build for ALL of Your Users by Anthony Lusardi (liblab)
apidays New York 2025 - Build for ALL of Your Users by Anthony Lusardi (liblab)apidays New York 2025 - Build for ALL of Your Users by Anthony Lusardi (liblab)
apidays New York 2025 - Build for ALL of Your Users by Anthony Lusardi (liblab)
apidays
 
Lec 11.pdfgghjuuyffhkiiiiuuiiiiiiuhffghjiu
Lec 11.pdfgghjuuyffhkiiiiuuiiiiiiuhffghjiuLec 11.pdfgghjuuyffhkiiiiuuiiiiiiuhffghjiu
Lec 11.pdfgghjuuyffhkiiiiuuiiiiiiuhffghjiu
saifalroby72
 
tinywow_Varia_PPT Leadership skills1_80706257.docx
tinywow_Varia_PPT Leadership skills1_80706257.docxtinywow_Varia_PPT Leadership skills1_80706257.docx
tinywow_Varia_PPT Leadership skills1_80706257.docx
abdulrhmansultanfa
 
Lec 12.pdfghhjjhhjkkkkkkkkkkkjfcvhiiugcvvh
Lec 12.pdfghhjjhhjkkkkkkkkkkkjfcvhiiugcvvhLec 12.pdfghhjjhhjkkkkkkkkkkkjfcvhiiugcvvh
Lec 12.pdfghhjjhhjkkkkkkkkkkkjfcvhiiugcvvh
saifalroby72
 
STRABAG SE - Investor Presentation - February 2024.pdf
STRABAG SE - Investor Presentation - February 2024.pdfSTRABAG SE - Investor Presentation - February 2024.pdf
STRABAG SE - Investor Presentation - February 2024.pdf
andrianalampka
 
FT Partners Research - FinTech in Africa-2.pdf
FT Partners Research - FinTech in Africa-2.pdfFT Partners Research - FinTech in Africa-2.pdf
FT Partners Research - FinTech in Africa-2.pdf
Obinna8
 
artificial intelligence (1).pptx hgggfcgfch
artificial intelligence (1).pptx hgggfcgfchartificial intelligence (1).pptx hgggfcgfch
artificial intelligence (1).pptx hgggfcgfch
DevAnshGupta609215
 
apidays New York 2025 - AI for All by Ananya Upadhyay (United Rentals, Inc.)
apidays New York 2025 - AI for All by Ananya Upadhyay (United Rentals, Inc.)apidays New York 2025 - AI for All by Ananya Upadhyay (United Rentals, Inc.)
apidays New York 2025 - AI for All by Ananya Upadhyay (United Rentals, Inc.)
apidays
 
Mathcad Sales Presentation software for use.PPTX
Mathcad Sales Presentation software for use.PPTXMathcad Sales Presentation software for use.PPTX
Mathcad Sales Presentation software for use.PPTX
ManojSharma311544
 
ch068.pptnsnsnjsjjzjzjdjdjdjdjdjdjjdjdjdjdjxj
ch068.pptnsnsnjsjjzjzjdjdjdjdjdjdjjdjdjdjdjxjch068.pptnsnsnjsjjzjzjdjdjdjdjdjdjjdjdjdjdjxj
ch068.pptnsnsnjsjjzjzjdjdjdjdjdjdjjdjdjdjdjxj
MikkoPlanas
 
Kilowatt's Impact Report _ 2024 x
Kilowatt's Impact Report _ 2024                xKilowatt's Impact Report _ 2024                x
Kilowatt's Impact Report _ 2024 x
Kilowatt
 
this is the Dr. ibrahim presentations ppt.pptx
this is the Dr. ibrahim presentations ppt.pptxthis is the Dr. ibrahim presentations ppt.pptx
this is the Dr. ibrahim presentations ppt.pptx
ibrahimabdi22
 
463.8-Bitcoin from university of illinois
463.8-Bitcoin from university of illinois463.8-Bitcoin from university of illinois
463.8-Bitcoin from university of illinois
8gqtkfzwbb
 
DEWDHDIEFHIFHIHGIERHFIHIM SC ID (2).pptx
DEWDHDIEFHIFHIHGIERHFIHIM SC ID (2).pptxDEWDHDIEFHIFHIHGIERHFIHIM SC ID (2).pptx
DEWDHDIEFHIFHIHGIERHFIHIM SC ID (2).pptx
f8jyv28tjr
 
apidays New York 2025 - How AI is Transforming Product Management by Shereen ...
apidays New York 2025 - How AI is Transforming Product Management by Shereen ...apidays New York 2025 - How AI is Transforming Product Management by Shereen ...
apidays New York 2025 - How AI is Transforming Product Management by Shereen ...
apidays
 
14th International Conference on Advanced Computer Science and Information Te...
14th International Conference on Advanced Computer Science and Information Te...14th International Conference on Advanced Computer Science and Information Te...
14th International Conference on Advanced Computer Science and Information Te...
ijitcs
 
IoT, Data Analytics and Big Data Security.pptx
IoT, Data Analytics and Big Data Security.pptxIoT, Data Analytics and Big Data Security.pptx
IoT, Data Analytics and Big Data Security.pptx
fizarcse
 
TUG BD Kick Off Meet up 21 May Slide Deck.pptx
TUG BD Kick Off Meet up 21 May Slide Deck.pptxTUG BD Kick Off Meet up 21 May Slide Deck.pptx
TUG BD Kick Off Meet up 21 May Slide Deck.pptx
SaidAlHaque
 
Faces of the Future The Impact of a Data Science Course in Kerala.pdf
Faces of the Future The Impact of a Data Science Course in Kerala.pdfFaces of the Future The Impact of a Data Science Course in Kerala.pdf
Faces of the Future The Impact of a Data Science Course in Kerala.pdf
jzyphoenix
 
apidays New York 2025 - Build for ALL of Your Users by Anthony Lusardi (liblab)
apidays New York 2025 - Build for ALL of Your Users by Anthony Lusardi (liblab)apidays New York 2025 - Build for ALL of Your Users by Anthony Lusardi (liblab)
apidays New York 2025 - Build for ALL of Your Users by Anthony Lusardi (liblab)
apidays
 
Lec 11.pdfgghjuuyffhkiiiiuuiiiiiiuhffghjiu
Lec 11.pdfgghjuuyffhkiiiiuuiiiiiiuhffghjiuLec 11.pdfgghjuuyffhkiiiiuuiiiiiiuhffghjiu
Lec 11.pdfgghjuuyffhkiiiiuuiiiiiiuhffghjiu
saifalroby72
 
tinywow_Varia_PPT Leadership skills1_80706257.docx
tinywow_Varia_PPT Leadership skills1_80706257.docxtinywow_Varia_PPT Leadership skills1_80706257.docx
tinywow_Varia_PPT Leadership skills1_80706257.docx
abdulrhmansultanfa
 

Row level security

  • 3. SQLschool.gr Team Antonios Chatzipavlis SQL Server Evangelist • Trainer Vassilis Ioannidis SQL Server Expert • Trainer Fivi Panopoulou System Engineer • Speaker Sotiris Karras System Engineer • Speaker
  • 6. Presentation Content  Overview  Setting up RLS  Filter Predicates  Blocking Predicates  Best Practices  Considerations and Limitations
  • 7.  First introduced in Azure SQL, in January 2015.  Row Level Security(RLS) enables the implementation of restrictions on data row access.  Row level security introduces predicate based access control where the predicate is used as a criterion to determine whether or not the user has the appropriate access to the data.  The predicate can be anything from the characteristics of the user executing the query (role membership, execution context) to complex business logic involving multiple tables of the database to SQL Server metadata.  The enforcement logic lies inside the database and schema is bound to the table. Overview
  • 8. Overview Fine-grained access control Application transparency RLS works transparently at query time, no app changes needed Compatible with RLS in other leading products Centralized security logic Enforcement logic resides inside database and is schema-bound to the table it protects providing greater security. Reduced application maintenance and complexity Store data intended for many consumers in a single database/table while at the same time restricting row-level read and write access based on users’ execution context.
  • 9. Setting Up RLS  Predicate Function  Security Predicates  Security Policies
  • 10. Predicate function  User-defined inline table-valued function (iTVF) implementing security logic.  Schema bound to the table so that no changes can be done to the security policy under the hood.  Can be arbitrarily complicated, containing joins with other tables.  Performance wise, predicate functions get optimized to provide comparable performance to views, as if the logic were directly embedded in the original query statement.  Still, the more complex the security logic gets, the heavier the performance impact may get. Predicate Function
  • 11. Security Predicate  Binds a predicate function to a particular table, applying it for all queries.  Two types of predicates: filter predicates and blocking predicates (more on that in a bit). Security Predicate
  • 12. Security policy  Collection of security predicates for managing security across multiple tables.  Can be turned on and off at will (STATE = ON|OFF).  Can be created either by using SCHEMABINDING or not. The recommended (and default) practice is with SCHEMABINDING on.  Attempts to alter the columns of a table referenced by a schema bound security policy will result in an error. However, columns not referenced by the predicate can be altered.  Attempts to add a predicate on a table that already has one defined for the specified operation (regardless of whether it is enabled or disabled) results in an error.  Defining multiple active security policies that contain non-overlapping predicates, succeeds. Security Policy
  • 14.  Filter predicates are applied while reading data from the base table, and it affects all get operations.  SELECT statements.  DELETE statements (i.e. user cannot delete rows that are filtered).  UPDATE statements (i.e. user cannot update rows that are filtered, although it is possible to update rows in such way that they will be subsequently filtered).  A filter predicate will silently filter out the rows that fail to pass the security predicate.  That means that no error message will be returned to the user if he tries to update or delete rows that he is not allowed to.  The application can INSERT any rows, regardless of whether or not they will be filtered during any other operation.  If the dbo user, a member of the db_owner role, or the table owner queries against a table that has a security policy defined and enabled the rows are filtered/restricted as defined by the security policy. Filter Predicates
  • 15. RLS and Filter predicates
  • 17.  Enforce granular control over write access to data for different users, including scenarios that require separate access logic for INSERT, UPDATE, and DELETE operations.  Blocking predicates affect ALL write operations (inserts/updates/deletes).  Four options to choose from when declaring a blocking predicate:  AFTER INSERT and AFTER UPDATE predicates can prevent users from updating rows to values that violate the predicate.  BEFORE UPDATE predicates can prevent users from updating rows that currently violate the predicate.  BEFORE DELETE predicates can block delete operations.  If none of the above is set then the predicate covers every operation. Blocking Predicates
  • 20.  Create a separate schema for the security objects.  And give permissions to that schema to the security manager.  Additionally the security manager does not require any additional permissions to the underlying tables.  Avoid type conversions in the predicate functions and be very careful of mismatches.  Recursion can be used.  If the recursion is direct the optimizer will detect it and optimize it accordingly.  If the recursion is indirect (e.g. the predicate function uses another function that calls the predicate function) then the optimizer cannot detect the recursion and a performance issue may occur.  Do not rely on SET options, especially session-specific ones.  Keep the security logic as simple as possible to allow easy maintenance and minimal performance degradation. Best Practices
  • 22.  DBCC SHOW_STATISTICS will show statistics of unfiltered data.  When using columnstore indexes, it is possible that the optimizer may modify the query plan such that it does not use batch mode, because row-level security applies a function.  Temporal tables are compatible with RLS but the security policy must be applied individually in each table (current and history).  Memory optimized tables are compatible with RLS. The predicate function must be defined using the NATIVE_COMPILATION option.  Partitioned views are compatible with filter predicates but not with blocking predicates.  That means that a partitioned view CANNOT be created on top of a table with a block predicate defined on it.  Security policies can be created on top of indexed views BUT the creation of indexed views on top of tables that have a security policy is prohibited. (row lookups through the inde bypass the policy).  Row-Level security is incompatible with Filestream.  RLS is incompatible with Polybase. Considerations and Limitations
  • 25. S E L E C T K N O W L E D G E F R O M S Q L S E R V E R Copyright © 2015 SQLschool.gr. All right reserved. PRESENTER MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION
  翻译: