8

How can we assign a user , e.g.: the database owner (DBO) the UNSAFE ASSEMBLY permission?

I'm asking it to enable a user to create an assembly and don't know the SA password, so EXEC sp_changedbowner ‘sa’ can't help.

Any idea?

Thank you.

2 Answers 2

8

Only users mapped to a login that's a member of the sysadmin fixed server role can create and alter an assembly with an UNSAFE permission set defined. Therefore, to achieve your desired result you would have to add that respective login to the sysadmin fixed server role.

BOL reference on CREATE ASSEMBLY:

Specifying UNSAFE enables the code in the assembly complete freedom to perform operations in the SQL Server process space that can potentially compromise the robustness of SQL Server. UNSAFE assemblies can also potentially subvert the security system of either SQL Server or the common language runtime. UNSAFE permissions should be granted only to highly trusted assemblies. Only members of the sysadmin fixed server role can create and alter UNSAFE assemblies.

1
  • 1
    This is outdated and needs to be updated for current version of SQL server. So that others finding this from search engine do not get mislead.
    – John C
    Commented Jul 7, 2022 at 19:27
1
USE master
GRANT UNSAFE ASSEMBLY to [<login name>]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.