Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSSQL Linux Server Issue: SQL Server only supports SAFE assemblies [closed]

We recently came across an issue when trying to register some custom SQL CLR assemblies we have created on SQL Server 2017 v14.0.3238.1.

First of all, these assemblies require that they have External Access Permission, as they call external APIs. It seems that this issue is only appearing when trying to run them on an MSSQL Server that is hosted on a Linux Environment.

In addition, we have tried creating asymmetric keys (both with SN.exe tool from Microsoft SDKs and through VS 2017) and also signing these CLR assemblies, without any luck. (Followed instructions as found on: https://techcommunity.microsoft.com/t5/SQL-Server-Support/Deploying-SQL-CLR-assembly-using-Asymmetric-key/ba-p/316727)

When trying to register the assemblies, we are receiving the error: "Assembly 'Sample_CLR' cannot be loaded because this edition of SQL Server only supports SAFE assemblies."

Has anyone stumbled across a similar issue before?

like image 597
PAlexandrou Avatar asked Sep 25 '26 11:09

PAlexandrou


1 Answers

This is documented in Unsupported features & services:

The following features and services are not available SQL Server 2019 on Linux. The support of these features will be increasingly enabled over time.

Database engine

  • Merge replication
  • Stretch DB
  • Distributed query with 3rd-party connections
  • Linked Servers to data sources other than SQL Server
  • System extended stored procedures (XP_CMDSHELL, etc.)
  • Filetable, FILESTREAM
  • CLR assemblies with the EXTERNAL_ACCESS or UNSAFE permission set
  • Buffer Pool Extension

Emphasis mine

You can only use SAFE CLR functions on SQL Server on Linux. There is no work around, as it is a documented unsupported feature.

like image 118
Larnu Avatar answered Sep 27 '26 23:09

Larnu