|
1 | 1 | --- |
2 | 2 | title: "ALTER ASSEMBLY (Transact-SQL) | Microsoft Docs" |
3 | 3 | ms.custom: "" |
4 | | -ms.date: "01/12/2017" |
| 4 | +ms.date: "04/19/2017" |
5 | 5 | ms.prod: "sql-non-specified" |
6 | 6 | ms.reviewer: "" |
7 | 7 | ms.suite: "" |
@@ -32,7 +32,10 @@ manager: "jhubbard" |
32 | 32 | [!INCLUDE[tsql-appliesto-ss2008-xxxx-xxxx-xxx_md](../../includes/tsql-appliesto-ss2008-xxxx-xxxx-xxx-md.md)] |
33 | 33 |
|
34 | 34 | Alters an assembly by modifying the [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] catalog properties of an assembly. ALTER ASSEMBLY refreshes it to the latest copy of the [!INCLUDE[msCoName](../../includes/msconame-md.md)] [!INCLUDE[dnprdnshort](../../includes/dnprdnshort-md.md)] modules that hold its implementation and adds or removes files associated with it. Assemblies are created by using [CREATE ASSEMBLY](../../t-sql/statements/create-assembly-transact-sql.md). |
35 | | - |
| 35 | + |
| 36 | +> [!WARNING] |
| 37 | +> CLR uses Code Access Security (CAS) in the .NET Framework, which has been marked as obsolete. A CLR assembly created with `PERMISSION_SET = SAFE` may be able to access external system resources, call unmanaged code, and acquire sysadmin privileges. Beginning with [!INCLUDE[sssqlv14-md](../../includes/sssqlv14-md.md)], an `sp_configure` option called `clr strict security` is introduced to enhance the security of CLR assemblies. `clr strict security` is enabled by default, and treats `SAFE` and `EXTERNAL_ACCESS` assemblies as if they were marked `UNSAFE`. The `clr strict security` option can be disabled for backward compatibility, but this is not recommended. Microsoft recommends that all assemblies be signed by a certificate or asymmetric key with a corresponding login that has been granted `UNSAFE ASSEMBLY` permission in the master database. For more information, see [CLR strict security](../../database-engine/configure-windows/clr-strict-security.md). |
| 38 | +
|
36 | 39 |  [Transact-SQL Syntax Conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md) |
37 | 40 |
|
38 | 41 | ## Syntax |
@@ -75,7 +78,9 @@ ALTER ASSEMBLY assembly_name |
75 | 78 |
|
76 | 79 | Separate ALTER ASSEMBLY statements must be issued for any dependent assemblies that also require updating. |
77 | 80 |
|
78 | | - PERMISSION_SET = { SAFE | EXTERNAL_ACCESS | UNSAFE } |
| 81 | + PERMISSION_SET = { SAFE | EXTERNAL_ACCESS | UNSAFE } |
| 82 | +> [!IMPORTANT] |
| 83 | +> The `PERMISSION_SET` option is affected by the `clr strict security` option, described in the opening warning. When `clr strict security` is enabled, all assemblies are treated as `UNSAFE`. |
79 | 84 | Specifies the [!INCLUDE[dnprdnshort](../../includes/dnprdnshort-md.md)] code access permission set property of the assembly. For more information about this property, see [CREATE ASSEMBLY (Transact-SQL)](../../t-sql/statements/create-assembly-transact-sql.md). |
80 | 85 |
|
81 | 86 | > [!NOTE] |
@@ -169,6 +174,16 @@ ALTER ASSEMBLY assembly_name |
169 | 174 | - To change the permission set of an assembly to UNSAFE, requires **UNSAFE ASSEMBLY** permission on the server. |
170 | 175 |
|
171 | 176 | - Specifying WITH UNCHECKED DATA, requires **ALTER ANY SCHEMA** permission. |
| 177 | + |
| 178 | + |
| 179 | +### Permissions with CLR strict security |
| 180 | +The following permissions required to alter a CLR assembly when `CLR strict security` is enabled: |
| 181 | + |
| 182 | +- The user must have the `ALTER ASSEMBLY` permission |
| 183 | +- And one of the following conditions must also be true: |
| 184 | + - The assembly is signed with a certificate or asymmetric key that has a corresponding login with the `UNSAFE ASSEMBLY` permission on the server. Signing the assembly is recommended. |
| 185 | + - The database has the `TRUSTWORTHY` property set to `ON`, and the database is owned by a login that has the `UNSAFE ASSEMBLY` permission on the server. This option is not recommended. |
| 186 | + |
172 | 187 |
|
173 | 188 | For more information about assembly permission sets, see [Designing Assemblies](../../relational-databases/clr-integration/assemblies-designing.md). |
174 | 189 |
|
|
0 commit comments