SlideShare a Scribd company logo
SQL SERVER 2017 Eduardo Piairo
@EdPiairo
#PortoDataCLR
ABOUT ME
SQL Server 2017 CLR
@EdPiairo, #PortoData
@EdPiairo
https://pt.linkedin.com/in/jesuspiairo
eduardopiairo@gmail.com
http://www.eduardopiairo.com/
Eduardo Piairo
Friend of Redgate
Operations Engineer
DevOps Porto Founder
INDEX
1. What’s CLR
2. Enable CLR
3. Security (Host Policy)
4. 2017 Breaking change
5. CLR strict security
SQL Server 2017 CLR
@EdPiairo, #PortoData
WHAT IS CLR?
SQL Server 2017 CLR
• .Net runtime engine (CLR) was for first integrated in SQL Server 2005
• This integration allows the execution of code within the context of a query
• This integration is commonly referred as SQLCLR (Microsoft call it CLR integration)
• CLR integration allows to incorporate code written in .Net language into SQL Server engine
• Can be called from a stored procedure or function
• Stored procedures, triggers, user-defined functions, user-defined types, and user-defined aggregates can be
created in managed code
• Does not interact directly with SQL Server (needs to connect to database)
@EdPiairo, #PortoData
WHAT IS CLR?
SQL Server 2017 CLR
• Framework that bridges the environment of the SQL Server database engine
with the rich programming environment of .NET
• Extending capabilities of queries beyond T-SQL built-in functions
• Performing certain operations faster or easier than using T-SQL
• Better interaction with external resources (better then xp_cmdshell)
@EdPiairo, #PortoData
ENABLE CLR
SQL Server 2017 CLR
• EXEC sp_configure ‘clr enabled’, 1; RECONFIGURE;
• EXEC sp_configure ‘clr enabled’, 0; RECONFIGURE;
• 0 - Assembly execution not allowed on SQL Server
• 1 - Assembly execution allowed on SQL Server
@EdPiairo, #PortoData
SECURITY
SQL Server 2017 CLR
• CLR supports Code Access Security (CAS) as security model
• The permissions granted to assemblies are defined in 3 different places:
• Machine policy
• User policy
• Host policy
@EdPiairo, #PortoData
HOST POLICY
SQL Server 2017 CLR
• CAS permissions granted to assemblies are determined by the permission set
specified when creating the assembly (PERMISSION_SET)
• SAFE
• Only internal computation and local data access are allowed
• Most restrictive permission set
• Assembly cannot access external system resources such as files, the network, environment
variables, or the registry
@EdPiairo, #PortoData
HOST POLICY
SQL Server 2017 CLR
• CAS permissions granted to assemblies are determined by the permission set
specified when creating the assembly (PERMISSION_SET)
• EXTERNAL_ACCESS
• Have the same permissions as SAFE
• Ability to access external system resources such as files, networks, environmental variables, and
the registry
@EdPiairo, #PortoData
HOST POLICY
SQL Server 2017 CLR
• CAS permissions granted to assemblies are determined by the permission set
specified when creating the assembly (PERMISSION_SET)
• UNSAFE
• Unrestricted access to resources, both within and outside SQL Server
• Code executing from within an UNSAFE assembly can also call unmanaged code
@EdPiairo, #PortoData
2017 BREAKING CHANGE
SQL Server 2017 CLR
• CAS is no longer supported as security boundary
• SQL Server new option: clr strict security
@EdPiairo, #PortoData
CLR STRICT SECURITY
SQL Server 2017 CLR
• EXEC sp_configure ‘clr strict security’, 1; RECONFIGURE;
• EXEC sp_configure ‘clr strict security’, 0; RECONFIGURE;
• 0 – Disabled
• Provided for backwards compatibility
• Not recommended
• 1 – Enabled (default)
• Causes the Database Engine to ignore the PERMISSION_SET information on the assemblies, and
always interpret them as UNSAFE
@EdPiairo, #PortoData
CLR STRICT SECURITY
SQL Server 2017 CLR
• All assemblies (SAFE, EXTERNAL_ACCESS, UNSAFE) are authorized for
UNSAFE access
• Set database as TRUSTWORTHY;
• Assembly is signed with a certificate that has a corresponding login with UNSAFE
ASSEMBLY permission
• Assembly is signed with an asymmetric key that has a corresponding login with UNSAFE
ASSEMBLY permission
• Trusted assembly list (sys.sp_add_trusted_assembly; sys.sp_drop_trusted_assembly)
@EdPiairo, #PortoData
DEMO
SQL Server 2017 CLR
@EdPiairo, #PortoData
REFERENCES
https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/sql/introduction-to-sql-server-clr-integration
http://www.sqlservercentral.com/articles/Stairway+Series/104406/
https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/clr-strict-security
https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/clr-enabled-server-configuration-option
https://docs.microsoft.com/en-us/sql/relational-databases/clr-integration/security/clr-integration-code-access-security
https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sys-sp-add-trusted-assembly-
transact-sql
https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sys-sp-drop-trusted-assembly-
transact-sql
https://docs.microsoft.com/en-us/sql/database-engine/breaking-changes-to-database-engine-features-in-sql-server-
2017
http://www.nielsberglund.com/2017/07/23/sql-server-2017-sqlclr-white-listing-assemblies/
SQL Server 2017 CLR
@EdPiairo, #PortoData
Q&A
SQL Server 2017 CLR
@EdPiairo
https://pt.linkedin.com/in/jesuspiairo
eduardopiairo@gmail.com
http://www.eduardopiairo.com/
@EdPiairo, #PortoData

More Related Content

PDF
SQL Server 2017 CLR
PPTX
SANS @Night Talk: SQL Injection Exploited
PDF
Stopping the Hassle of SSH keys by using SSH certificates - Community Summit ...
PDF
Streamline CI/CD with Just-in-Time Access
PPTX
Various Types of OpenSSL Commands and Keytool
PPTX
The Rise of Secrets Management
PPTX
BAUG Meetup #1 2022: Публикация ресурсов в Интернет в Microsoft Azure. Обзор ...
SQL Server 2017 CLR
SANS @Night Talk: SQL Injection Exploited
Stopping the Hassle of SSH keys by using SSH certificates - Community Summit ...
Streamline CI/CD with Just-in-Time Access
Various Types of OpenSSL Commands and Keytool
The Rise of Secrets Management
BAUG Meetup #1 2022: Публикация ресурсов в Интернет в Microsoft Azure. Обзор ...

What's hot (20)

PPTX
Secret Management Architectures
PDF
Neil Saunders (Beamly) - Securing your AWS Infrastructure with Hashicorp Vault
PPTX
Prowler: BlackHat Europe Arsenal 2018
PDF
Hardening Apache Web Server by Aswin
PDF
Whats new in oracle orachk & exachk 18.2.0
ODP
SFS (Secure File System)
PPTX
Types of ssl commands and keytool
PDF
Introduction to vault
PPTX
Secure Keystone Deployment
PPTX
ACME and Let's Encrypt: HTTPS made easy
PPTX
NoSQL Exploitation Framework
PPTX
Security for devs
PDF
Web Server Hardening
PDF
Credential store using HashiCorp Vault
PPTX
The Key to Strong Cloud Security
ODP
Apache CXF Security Solutions
PDF
Let's Encrypt!
DOC
Oracle Audit vault
PPTX
How to Never Leave Your Deployment Unattended
PDF
Security with VA Smalltalk
Secret Management Architectures
Neil Saunders (Beamly) - Securing your AWS Infrastructure with Hashicorp Vault
Prowler: BlackHat Europe Arsenal 2018
Hardening Apache Web Server by Aswin
Whats new in oracle orachk & exachk 18.2.0
SFS (Secure File System)
Types of ssl commands and keytool
Introduction to vault
Secure Keystone Deployment
ACME and Let's Encrypt: HTTPS made easy
NoSQL Exploitation Framework
Security for devs
Web Server Hardening
Credential store using HashiCorp Vault
The Key to Strong Cloud Security
Apache CXF Security Solutions
Let's Encrypt!
Oracle Audit vault
How to Never Leave Your Deployment Unattended
Security with VA Smalltalk
Ad

Similar to SQL Server 2017 CLR (20)

PPTX
OUGLS 2016: Guided Tour On The MySQL Source Code
PPTX
Secure360 - Extracting Password from Windows
PDF
12.2 secure configureconsole_adop_changes_aioug_appsdba_nov17
PPTX
Extracting Credentials From Windows
PDF
Building scalbale cloud native apps with .NET 8
PPTX
Finding The Weak Link in Windows Binaries
PDF
BYOP: Custom Processor Development with Apache NiFi
PPTX
Oracle Goldengate Architecture & Setup.pptx
PPTX
Enterprise-class security with PostgreSQL - 1
PDF
ASP.NET MVC Workshop for Women in Technology
PDF
Kangaroot EDB Webinar Best Practices in Security with PostgreSQL
PPTX
MySQL in oracle_environments(Part 2): MySQL Enterprise Monitor & Oracle Enter...
PPTX
Oracle plsql code refactoring - from anonymous block to stored procedure
PPT
kjdiakdnfdifjadsjkjklljlldasgjdjdljgfldjgldjgldjgl.ppt
PPT
ow.ppt
PPT
ukoug2008-oracle-activedirectory-wi-131847.ppt
PPTX
Open Source License Compliance with AGL
PPTX
Security of Oracle EBS - How I can Protect my System (UKOUG APPS 18 edition)
OUGLS 2016: Guided Tour On The MySQL Source Code
Secure360 - Extracting Password from Windows
12.2 secure configureconsole_adop_changes_aioug_appsdba_nov17
Extracting Credentials From Windows
Building scalbale cloud native apps with .NET 8
Finding The Weak Link in Windows Binaries
BYOP: Custom Processor Development with Apache NiFi
Oracle Goldengate Architecture & Setup.pptx
Enterprise-class security with PostgreSQL - 1
ASP.NET MVC Workshop for Women in Technology
Kangaroot EDB Webinar Best Practices in Security with PostgreSQL
MySQL in oracle_environments(Part 2): MySQL Enterprise Monitor & Oracle Enter...
Oracle plsql code refactoring - from anonymous block to stored procedure
kjdiakdnfdifjadsjkjklljlldasgjdjdljgfldjgldjgldjgl.ppt
ow.ppt
ukoug2008-oracle-activedirectory-wi-131847.ppt
Open Source License Compliance with AGL
Security of Oracle EBS - How I can Protect my System (UKOUG APPS 18 edition)
Ad

More from Eduardo Piairo (20)

PDF
ADDO 2021: Why and how to include database changes in the deployment pipeline
PDF
Adding unit tests to the database deployment pipeline
PDF
Start by changing the way of work
PDF
Adding unit tests to the database deployment pipeline
PDF
Adding unit tests with tSQLt to the database deployment pipeline
PDF
Adding unit tests with tSQLt to the database deployment pipeline
PDF
Operations for databases – The DevOps journey
PDF
Deployment pipeline for databases
PDF
Deployment pipeline for databases
PDF
Adding unit tests with tSQLt to the database deployment pipeline
PDF
Operations for databases: the agile/devops journey
PDF
Setting a WordPress website using Azure Web Apps And Azure Database for MySQL
PDF
Deployment pipeline for Azure SQL Databases
PDF
Operations for databases – the agile/devops journey
PDF
Delivering changes for applications and databases @ Azure
PDF
Delivering changes for databases and applications
PDF
Workshop: Delivering chnages for applications and databases
PDF
Database Source Control: Migrations vs State
PDF
Road to database automation: database source control
PDF
Deployment Pipeline for databases (Azure SQL Database, SQL Server)
ADDO 2021: Why and how to include database changes in the deployment pipeline
Adding unit tests to the database deployment pipeline
Start by changing the way of work
Adding unit tests to the database deployment pipeline
Adding unit tests with tSQLt to the database deployment pipeline
Adding unit tests with tSQLt to the database deployment pipeline
Operations for databases – The DevOps journey
Deployment pipeline for databases
Deployment pipeline for databases
Adding unit tests with tSQLt to the database deployment pipeline
Operations for databases: the agile/devops journey
Setting a WordPress website using Azure Web Apps And Azure Database for MySQL
Deployment pipeline for Azure SQL Databases
Operations for databases – the agile/devops journey
Delivering changes for applications and databases @ Azure
Delivering changes for databases and applications
Workshop: Delivering chnages for applications and databases
Database Source Control: Migrations vs State
Road to database automation: database source control
Deployment Pipeline for databases (Azure SQL Database, SQL Server)

Recently uploaded (20)

PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Digital Systems & Binary Numbers (comprehensive )
PDF
iTop VPN Free 5.6.0.5262 Crack latest version 2025
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Cost to Outsource Software Development in 2025
PPTX
history of c programming in notes for students .pptx
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Digital Strategies for Manufacturing Companies
PPTX
assetexplorer- product-overview - presentation
PDF
medical staffing services at VALiNTRY
PDF
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
PPTX
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PPTX
Operating system designcfffgfgggggggvggggggggg
PPTX
L1 - Introduction to python Backend.pptx
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
Designing Intelligence for the Shop Floor.pdf
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Digital Systems & Binary Numbers (comprehensive )
iTop VPN Free 5.6.0.5262 Crack latest version 2025
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Softaken Excel to vCard Converter Software.pdf
Wondershare Filmora 15 Crack With Activation Key [2025
Cost to Outsource Software Development in 2025
history of c programming in notes for students .pptx
Navsoft: AI-Powered Business Solutions & Custom Software Development
Digital Strategies for Manufacturing Companies
assetexplorer- product-overview - presentation
medical staffing services at VALiNTRY
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
How to Choose the Right IT Partner for Your Business in Malaysia
Design an Analysis of Algorithms I-SECS-1021-03
Operating system designcfffgfgggggggvggggggggg
L1 - Introduction to python Backend.pptx
Odoo POS Development Services by CandidRoot Solutions
Designing Intelligence for the Shop Floor.pdf

SQL Server 2017 CLR