Skip to content

Commit 9f96135

Browse files
Add Block T-SQL CRUD for managed instances to what's new (#36947)
Co-authored-by: Bogdan Gavrilovic <bgavrilovic@microsoft.com>
1 parent 664c15a commit 9f96135

4 files changed

Lines changed: 218 additions & 76 deletions

File tree

azure-sql/database/block-crud-tsql.md

Lines changed: 215 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,111 +1,251 @@
11
---
2-
title: Block T-SQL Commands To Create Or Modify Azure SQL Resources
2+
title: "Block T-SQL Commands to Create or Modify Azure SQL Resources"
3+
titleSuffix: Azure SQL Database & Azure SQL Managed Instance
34
description: This article details features allowing Azure administrators to block T-SQL commands to create or modify Azure SQL Database and Azure SQL Managed Instance resources.
45
author: WilliamDAssafMSFT
56
ms.author: wiassaf
6-
ms.reviewer: wiassaf, mathoma
7-
ms.date: 03/10/2026
7+
ms.reviewer: mathoma
8+
ms.date: 03/27/2026
89
ms.service: azure-sql
910
ms.subservice: security
1011
ms.topic: how-to
11-
ROBOTS: NOINDEX
12-
monikerRange: "=azuresql || =azuresql-db "
13-
ms.custom: sfi-image-nochange
12+
ms.custom:
13+
- sfi-image-nochange
14+
monikerRange: "=azuresql || =azuresql-db || = azuresql-mi"
1415
---
1516

16-
# What is Block T-SQL CRUD?
17+
# How to block T-SQL CRUD
1718

18-
[!INCLUDE[appliesto-sqldb-sqlmi](../includes/appliesto-sqldb-sqlmi.md)]
19+
[!INCLUDE [appliesto-sqldb-sqlmi](../includes/appliesto-sqldb-sqlmi.md)]
1920

20-
The Block T-SQL CRUD features allow Azure administrators to block the creation or modification of Azure SQL resources through T-SQL. Two separate subscription-level preview feature flags are available:
21+
This article teaches you how to use the block T-SQL CRUD feature for Azure SQL resources. By using this feature, Azure administrators can block the creation or modification of Azure SQL resources through T-SQL.
2122

22-
| Preview feature flag | Scope |
23-
| --- | --- |
24-
| **Block T-SQL CRUD for logical servers** (`block-tsql-crud`) | Azure SQL Database (logical server) |
25-
| **Block T-SQL CRUD for managed instances** (`block-tsql-mi-crud`) | Azure SQL Managed Instance |
26-
27-
Each flag is registered independently per subscription. You can enable one or both depending on which Azure SQL services you need to govern.
23+
You can block T-SQL CRUD operations at the subscription level for the following resources:
24+
- The [logical server](logical-servers.md) in Azure
25+
- [Azure SQL Managed Instance](../managed-instance/sql-managed-instance-paas-overview.md)
2826

2927
## Overview
3028

31-
To block creation or modification of resources through T-SQL and enforce resource management through an Azure Resource Manager template (ARM template) for a given subscription, the subscription-level preview features in the Azure portal can be used. This is particularly useful when you are using [Azure Policies](/azure/governance/policy/overview) to enforce organizational standards through ARM templates. Since T-SQL does not adhere to Azure Policies, a block on T-SQL create or modify operations can be applied.
32-
33-
T-SQL CRUD operations can be blocked via the Azure portal, [PowerShell](/powershell/module/az.resources/register-azproviderfeature), or [Azure CLI](/cli/azure/feature#az-feature-register).
34-
35-
## Blocked statements for Azure SQL Database
36-
37-
When the **Block T-SQL CRUD for logical servers** (`block-tsql-crud`) preview feature is registered, the following T-SQL statements are blocked for Azure SQL Database resources:
38-
39-
1. `CREATE DATABASE`
40-
1. `DROP DATABASE`
41-
1. `CREATE DATABASE ... AS COPY OF`
42-
1. `ALTER DATABASE` (edition, service objective, max size, etc.)
43-
1. `ALTER DATABASE ... ADD SECONDARY ON SERVER`
44-
1. `ALTER DATABASE ... REMOVE SECONDARY ON SERVER`
45-
1. `ALTER DATABASE ... FAILOVER`
46-
47-
## Blocked statements for Azure SQL Managed Instance
48-
49-
When the **Block T-SQL CRUD for managed instances** (`block-tsql-mi-crud`) preview feature is registered, the following T-SQL statements are blocked for Azure SQL Managed Instance resources:
50-
51-
1. `CREATE DATABASE`
52-
1. `DROP DATABASE`
53-
1. Cancel in-progress `CREATE DATABASE`
54-
1. `RESTORE DATABASE ... FROM URL`
55-
1. `ALTER DATABASE ... ADD FILE`
56-
1. `ALTER DATABASE ... MODIFY FILE`
57-
1. `ALTER DATABASE ... REMOVE FILE` (on geo-replicated file)
58-
1. `ALTER DATABASE tempdb ADD FILE`
59-
1. `ALTER DATABASE tempdb MODIFY FILE`
60-
1. `ALTER DATABASE tempdb REMOVE FILE`
61-
1. `ALTER DATABASE ... SET` (compatibility level, collation, etc.)
62-
1. `ALTER DATABASE ... SET ENCRYPTION ON/OFF`
63-
1. `ALTER AVAILABILITY GROUP ... FAILOVER` (MI Link / Failover Group)
64-
1. Failover stored procedure configuration
65-
1. `DBCC TRACEON` / `DBCC TRACEOFF` (global trace flags)
66-
1. `sp_configure` (SQL Agent enable/disable)
67-
1. `sp_configure` / MSDTC transition to primary
68-
1. MSDTC network settings (XA, LU, inbound/outbound)
69-
1. Vulnerability Assessment scan trigger via T-SQL
29+
To block creation or modification of resources through T-SQL and enforce resource management through an Azure Resource Manager template (ARM template) for a given subscription, use the subscription-level preview features in the Azure portal. This approach is particularly useful when you're using [Azure Policies](/azure/governance/policy/overview) to enforce organizational standards through ARM templates. Since T-SQL doesn't adhere to Azure Policies, you can block T-SQL create or modify operations.
30+
31+
You can block T-SQL CRUD operations through the Azure portal, [PowerShell](/powershell/module/az.resources/register-azproviderfeature), or [Azure CLI](/cli/azure/feature#az-feature-register).
32+
33+
## Blocked statements
34+
35+
Blocked statements differ between the logical server and SQL managed instance.
36+
37+
### [Logical server](#tab/sqldb)
38+
39+
When you register the **Block T-SQL CRUD for logical servers** (`block-tsql-crud`) feature, the feature blocks the following T-SQL statements for resources associated with the logical server:
40+
41+
- `CREATE DATABASE`
42+
- `DROP DATABASE`
43+
- `CREATE DATABASE ... AS COPY OF`
44+
- `ALTER DATABASE` (edition, service objective, max size, and other settings)
45+
- `ALTER DATABASE ... ADD SECONDARY ON SERVER`
46+
- `ALTER DATABASE ... REMOVE SECONDARY ON SERVER`
47+
- `ALTER DATABASE ... FAILOVER`
48+
49+
### [SQL managed instance](#tab/sqlmi)
50+
51+
When you register the **Block T-SQL CRUD for managed instances** (`block-tsql-mi-crud`) feature, the feature blocks the following T-SQL statements for Azure SQL Managed Instance resources:
52+
53+
- `CREATE DATABASE`
54+
- `DROP DATABASE`
55+
- Cancel in-progress `CREATE DATABASE`
56+
- `RESTORE DATABASE ... FROM URL`
57+
- `ALTER DATABASE ... ADD FILE`
58+
- `ALTER DATABASE ... MODIFY FILE`
59+
- `ALTER DATABASE ... REMOVE FILE` (on geo-replicated file)
60+
- `ALTER DATABASE tempdb ADD FILE`
61+
- `ALTER DATABASE tempdb MODIFY FILE`
62+
- `ALTER DATABASE tempdb REMOVE FILE`
63+
- `ALTER DATABASE ... SET` (compatibility level, collation, and other settings)
64+
- `ALTER DATABASE ... SET ENCRYPTION ON/OFF`
65+
- `ALTER AVAILABILITY GROUP ... FAILOVER` (MI Link / Failover Group)
66+
- Failover stored procedure configuration
67+
- `DBCC TRACEON` / `DBCC TRACEOFF` (global trace flags)
68+
- `sp_configure` (SQL Agent enable/disable)
69+
- `sp_configure` / MSDTC transition to primary
70+
- MSDTC network settings (XA, LU, inbound/outbound)
71+
- Vulnerability Assessment scan trigger via T-SQL
72+
73+
---
7074

7175
## Permissions
7276

73-
In order to register or remove either feature, the Azure user must be a member of the Owner or Contributor role of the subscription.
77+
To register or remove either feature, you must be a member of the **Owner** or **Contributor** role for the subscription.
78+
79+
<a id="register-a-block-t-sq;-crud-feature"></a>
80+
81+
## Enable blocking T-SQL CRUD features
82+
83+
You can enable the feature for the associated Azure SQL resource by using the Azure portal, PowerShell, or the Azure CLI.
84+
85+
The following table lists the name of the feature for the associated Azure SQL resource:
86+
87+
| Feature name | Scope |
88+
| --- | --- |
89+
| **Block T-SQL CRUD for logical servers** (`block-tsql-crud`) | The [logical server in Azure](logical-servers.md) |
90+
| **Block T-SQL CRUD for SQL managed instances** (`block-tsql-mi-crud`) | Azure SQL Managed Instance |
91+
92+
Each feature is registered independently per subscription. You can enable one or both features depending on which Azure SQL services you need to govern.
93+
94+
> [!NOTE]
95+
> Although you can enable and disable T-SQL CRUD blocking by using the **Preview feature** functionality in the Azure portal, the block T-SQL CRUD feature is generally available for both Azure SQL Database and Azure SQL Managed Instance.
96+
97+
### [Azure portal](#tab/azure-portal)
98+
99+
To enable the feature for your subscription in the Azure portal, follow these steps:
100+
101+
1. Go to your [subscription](https://portal.azure.com/#view/Microsoft_Azure_Billing/SubscriptionsBladeV2) in the Azure portal.
102+
1. Under **Settings**, select **Preview Features** to open the **Preview features** pane.
103+
1. On the **Preview features** pane,
104+
1. Enter `CRUD` in the search box.
105+
1. Select the checkbox for the features you want to register for the associated resource. The two features related to blocking T-SQL CRUD operations for Azure SQL resources are:
106+
- **Block T-SQL CRUD for logical servers** — for Azure SQL Database
107+
- **Block T-SQL CRUD for managed instances** — for Azure SQL Managed Instance
108+
1. Select **Register** on the command bar to register the feature to your subscription.
109+
110+
:::image type="content" source="media/block-crud-tsql/block-tsql-crud-register.png" alt-text="Screenshot from the Azure portal of With Block T-SQL CRUD checked, select Register.":::
111+
112+
### [PowerShell](#tab/powershell)
113+
114+
Use [Register-AzProviderFeature](/powershell/module/az.resources/register-azproviderfeature) to register the feature for your subscription.
115+
116+
The following example registers the block T-SQL CRUD feature for logical servers:
117+
118+
```powershell
119+
Register-AzProviderFeature -FeatureName "block-tsql-crud" -ProviderNamespace "Microsoft.Sql"
120+
```
121+
122+
The following example registers the block T-SQL CRUD feature for SQL managed instances:
123+
124+
```powershell
125+
Register-AzProviderFeature -FeatureName "block-tsql-mi-crud" -ProviderNamespace "Microsoft.Sql"
126+
```
127+
128+
To check the registration status, use [Get-AzProviderFeature](/powershell/module/az.resources/get-azproviderfeature):
129+
130+
```powershell
131+
Get-AzProviderFeature -FeatureName "block-tsql-crud" -ProviderNamespace "Microsoft.Sql"
132+
```
133+
134+
### [Azure CLI](#tab/azure-cli)
74135

75-
## Examples
136+
Use [az feature register](/cli/azure/feature#az-feature-register) to register the feature for your subscription.
76137

77-
The following section describes how you can register or unregister a preview feature with the Microsoft.Sql resource provider in the Azure portal.
138+
The following example registers the block T-SQL CRUD feature for logical servers:
78139

79-
### Register a Block T-SQL CRUD feature
140+
```azurecli
141+
az feature register --name block-tsql-crud --namespace Microsoft.Sql
142+
```
80143

81-
1. Go to your subscription in the Azure portal.
82-
1. Select the **Preview Features** tab.
83-
1. Select the feature flag you want to enable:
84-
- **Block T-SQL CRUD for logical servers** — for Azure SQL Database
85-
- **Block T-SQL CRUD for managed instances** — for Azure SQL Managed Instance
86-
1. In the window that opens, select **Register** to register this block with the Microsoft.Sql resource provider.
144+
The following example registers the block T-SQL CRUD feature for SQL managed instances:
87145

88-
:::image type="content" source="media/block-crud-tsql/block-tsql-crud-register.png" alt-text="With 'Block T-SQL CRUD' checked, select Register." lightbox="media/block-crud-tsql/block-tsql-crud-register.png":::
146+
```azurecli
147+
az feature register --name block-tsql-mi-crud --namespace Microsoft.Sql
148+
```
89149

90-
### Re-register Microsoft.Sql resource provider
150+
To check the registration status, use [az feature show](/cli/azure/feature#az-feature-show):
91151

92-
After you register either block feature with the Microsoft.Sql resource provider, you must re-register the Microsoft.Sql resource provider for the changes to take effect. To re-register the Microsoft.Sql resource provider:
152+
```azurecli
153+
az feature show --name block-tsql-crud --namespace Microsoft.Sql --output table
154+
```
93155

94-
1. Go to your subscription in the Azure portal.
156+
---
157+
158+
## Re-register the Microsoft.Sql resource provider
159+
160+
After you register either block feature with the Microsoft.Sql resource provider, you must re-register the Microsoft.Sql resource provider for the changes to take effect.
161+
162+
> [!NOTE]
163+
> The re-registration step is mandatory for the T-SQL block to be applied to your subscription.
164+
165+
### [Azure portal](#tab/azure-portal)
166+
167+
To re-register the Microsoft.Sql resource provider in the Azure portal, follow these steps:
168+
169+
1. Go to your [subscription](https://portal.azure.com/#view/Microsoft_Azure_Billing/SubscriptionsBladeV2) in the Azure portal.
95170
1. Select the **Resource Providers** tab.
96-
1. Search and select **Microsoft.Sql** resource provider.
171+
1. Search for and select the **Microsoft.Sql** resource provider.
97172
1. Select **Re-register**.
98173

99-
> [!NOTE]
100-
> The re-registration step is mandatory for the T-SQL block to be applied to your subscription.
174+
:::image type="content" source="media/block-crud-tsql/block-tsql-crud-re-register.png" alt-text="Screenshot of the Azure portal showing how to re-register the Microsoft.Sql resource provider.":::
175+
176+
### [PowerShell](#tab/powershell)
177+
178+
Use [Register-AzResourceProvider](/powershell/module/az.resources/register-azresourceprovider) to re-register the Microsoft.Sql resource provider:
179+
180+
```powershell
181+
Register-AzResourceProvider -ProviderNamespace "Microsoft.Sql"
182+
```
183+
184+
### [Azure CLI](#tab/azure-cli)
185+
186+
Use [az provider register](/cli/azure/provider#az-provider-register) to re-register the Microsoft.Sql resource provider:
187+
188+
```azurecli
189+
az provider register --namespace Microsoft.Sql
190+
```
191+
192+
---
101193

102-
:::image type="content" source="media/block-crud-tsql/block-tsql-crud-re-register.png" alt-text="Screenshot of the Azure portal showing how to re-register the Microsoft.Sql resource provider." lightbox="media/block-crud-tsql/block-tsql-crud-re-register.png":::
194+
## Remove Block T-SQL CRUD
103195

104-
<a id="removing-block-t-sql-crud"></a>
196+
To remove the block on T-SQL create or modify operations from your subscription, first unregister the previously registered T-SQL block feature. Then, [re-register](#re-register-the-microsoftsql-resource-provider) the Microsoft.Sql resource provider for the removal to take effect.
105197

106-
### Remove Block T-SQL CRUD
198+
### [Azure portal](#tab/azure-portal)
107199

108-
To remove the block on T-SQL create or modify operations from your subscription, first unregister the previously registered T-SQL block. Then, re-register the Microsoft.Sql resource provider as shown above for the removal of T-SQL block to take effect.
200+
To unregister the feature in the Azure portal:
201+
202+
1. Go to your [subscription](https://portal.azure.com/#view/Microsoft_Azure_Billing/SubscriptionsBladeV2) in the Azure portal.
203+
1. Under **Settings**, select **Preview Features**.
204+
1. Select the feature you want to unregister.
205+
1. Select **Unregister**.
206+
207+
### [PowerShell](#tab/powershell)
208+
209+
Use [Unregister-AzProviderFeature](/powershell/module/az.resources/unregister-azproviderfeature) to unregister the feature:
210+
211+
```powershell
212+
Unregister-AzProviderFeature -FeatureName "block-tsql-crud" -ProviderNamespace "Microsoft.Sql"
213+
```
214+
215+
For SQL managed instances:
216+
217+
```powershell
218+
Unregister-AzProviderFeature -FeatureName "block-tsql-mi-crud" -ProviderNamespace "Microsoft.Sql"
219+
```
220+
221+
After unregistering, re-register the resource provider:
222+
223+
```powershell
224+
Register-AzResourceProvider -ProviderNamespace "Microsoft.Sql"
225+
```
226+
227+
### [Azure CLI](#tab/azure-cli)
228+
229+
Use [az feature unregister](/cli/azure/feature#az-feature-unregister) to unregister the feature.
230+
231+
The following example unregisters the feature for logical servers:
232+
233+
```azurecli
234+
az feature unregister --name block-tsql-crud --namespace Microsoft.Sql
235+
```
236+
The following example unregisters the feature for SQL managed instances:
237+
238+
```azurecli
239+
az feature unregister --name block-tsql-mi-crud --namespace Microsoft.Sql
240+
```
241+
242+
After unregistering the feature, use the following command to re-register the resource provider:
243+
244+
```azurecli
245+
az provider register --namespace Microsoft.Sql
246+
```
247+
248+
---
109249

110250
## Related content
111251

-34.3 KB
Loading
-115 KB
Loading

azure-sql/managed-instance/doc-changes-updates-release-notes-whats-new.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Learn about the new features and documentation improvements for Azu
55
author: MashaMSFT
66
ms.author: mathoma
77
ms.reviewer: wiassaf, randolphwest
8-
ms.date: 03/18/2026
8+
ms.date: 03/27/2026
99
ms.service: azure-sql-managed-instance
1010
ms.subservice: service-overview
1111
ms.topic: whats-new
@@ -51,6 +51,7 @@ The following table lists features of Azure SQL Managed Instance that have been
5151

5252
| Feature | GA Month | Details |
5353
| ---| --- |--- |
54+
|[Block T-SQL CRUD commands](../database/block-crud-tsql.md) | March 2026 | Azure administrators can block T-SQL commands to create or modify Azure SQL resources. |
5455
|[SQL Server 2025 update policy](update-policy.md#sql-server-2025-update-policy) | March 2026 | Align your SQL managed instance database format with the SQL Server 2025 database engine. |
5556
|[Regular expression functions](/sql/relational-databases/regular-expressions/overview) | November 2025 | Regular expression (REGEX) functions return text based on values in a search pattern. |
5657
|[Flexible memory](resource-limits.md#flexible-memory) | November 2025 | Save on cost by choosing the memory allocation for your [Next-gen General Purpose](service-tiers-next-gen-general-purpose-use.md) instance based on your workload needs.|
@@ -79,6 +80,7 @@ Learn about significant changes to the Azure SQL Managed Instance documentation.
7980
| Changes | Details |
8081
| --- | --- |
8182
| **Automatic index compaction preview** | Automatic index compaction helps you reduce the consumption of storage space, disk I/O, memory, and improve workload performance without investing time and effort into index maintenance jobs. This feature is now in preview. To learn more, review [Automatic index compaction](/sql/relational-databases/indexes/automatic-index-compaction). |
83+
| **Block T-SQL CRUD GA** | Allow Azure administrators to block the creation or modification of Azure SQL Managed Instance resources through T-SQL. This is enforced at the subscription level to block T-SQL commands from affecting SQL managed instance resources. This feature is generally available for Azure SQL Managed Instance. To learn more, review [Block T-SQL CRUD](../database/block-crud-tsql.md). |
8284
| **Change event streaming preview** | Capture and publish incremental DML changes of data (such as updates, inserts, and deletes) in near real-time. Change event streaming sends details of data changes such as the schema, previous values, and new values to Azure Event Hubs in a simple CloudEvent, serialized as either native JSON or Avro Binary. This feature is now in preview for Azure SQL Managed Instance configured with the SQL Server 2025 and Always-up-to-date update policy. To learn more, review [Change event streaming](/sql/relational-databases/track-changes/change-event-streaming/overview).
8385
| **Deploy free instance with command line tools** | You can now create your free SQL managed instance by using [Azure PowerShell](free-offer.md?tabs=powershell#create-a-free-sql-managed-instance), the [Azure CLI](free-offer.md?tabs=azure-cli#create-a-free-sql-managed-instance), and the [REST API](free-offer.md?tabs=rest-api#create-a-free-sql-managed-instance). |
8486
| **Easily upgrade your free instance** | You can now easily upgrade your free SQL managed instance to a paid offer in the Azure portal. To upgrade, navigate to the **Overview** page for your instance and select **Upgrade** from the navigation bar to open the **Compute + storage** page, where you can choose the paid offer under **Offer type**. For more information, see [Free SQL Managed Instance](free-offer.md#upgrade-to-paid-instance). |

0 commit comments

Comments
 (0)