Skip to content

Commit f52b42d

Browse files
Block T-SQL CRUD page update to include MI (#36816)
* Block crud page includes MI * List instead of table, as original * Minor fixes * Update feature flag names
1 parent d400c7c commit f52b42d

2 files changed

Lines changed: 68 additions & 39 deletions

File tree

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

Lines changed: 65 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,103 @@
11
---
2-
title: Block T-SQL Commands to Create or Modify Azure SQL Resources
3-
description: This article details a feature allowing Azure administrators to 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+
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.
44
author: WilliamDAssafMSFT
55
ms.author: wiassaf
66
ms.reviewer: wiassaf, mathoma
7-
ms.date: 06/13/2025
8-
ms.service: azure-sql-database
7+
ms.date: 03/10/2026
8+
ms.service: azure-sql
99
ms.subservice: security
1010
ms.topic: how-to
1111
ROBOTS: NOINDEX
1212
monikerRange: "=azuresql || =azuresql-db "
1313
ms.custom: sfi-image-nochange
1414
---
1515

16-
# What is Block T-SQL CRUD feature?
16+
# What is Block T-SQL CRUD?
1717

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

20-
This feature allows Azure administrators to block the creation or modification of Azure SQL Database resources through T-SQL. This is enforced at the subscription level to block T-SQL commands from affecting Azure SQL Database resources.
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:
2121

22-
## Overview
23-
24-
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 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. The syntax blocked includes CRUD (create, update, delete) operations for databases in Azure SQL Database.
25-
26-
T-SQL CRUD operations can be blocked via Azure portal, [PowerShell](/powershell/module/az.resources/register-azproviderfeature), or [Azure CLI](/cli/azure/feature#az-feature-register).
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 |
2726

28-
## Blocked statements
27+
Each flag is registered independently per subscription. You can enable one or both depending on which Azure SQL services you need to govern.
2928

30-
The following T-SQL statements are blocked when this feature is enabled:
29+
## Overview
3130

32-
1. `CREATE DATABASE` statements
33-
1. `DROP DATABASE` statements
34-
1. A subset of `ALTER DATABASE` statements, as follows:
35-
- `ALTER DATABASE ... ADD SECONDARY ON SERVER`
36-
- `ALTER DATABASE ... REMOVE SECONDARY ON SERVER`
37-
- `ALTER DATABASE ... FAILOVER`
38-
- `ALTER DATABASE ... MODIFY NAME ...`
39-
- `ALTER DATABASE ... MODIFY (MAXSIZE | EDITION | SERVICE_OBJECTIVE ...)`
40-
- `ALTER DATABASE ... MODIFY BACKUP_STORAGE_REDUNDANCY ...`
41-
- `ALTER DATABASE ... SET ENCRYPTION ...`
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
4270

4371
## Permissions
4472

45-
In order to register or remove this feature, the Azure user must be a member of the Owner or Contributor role of the subscription.
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.
4674

4775
## Examples
4876

49-
The following section describes how you can register or unregister a preview feature with Microsoft.Sql resource provider in Azure portal:
50-
51-
### Register Block T-SQL CRUD
77+
The following section describes how you can register or unregister a preview feature with the Microsoft.Sql resource provider in the Azure portal.
5278

53-
1. Go to your subscription on Azure portal.
54-
1. Select the **Preview Features** tab.
55-
1. Select **Block T-SQL CRUD**.
56-
1. After you select **Block T-SQL CRUD**, a new window will open, select **Register**, to register this block with Microsoft.Sql resource provider.
79+
### Register a Block T-SQL CRUD feature
5780

58-
:::image type="content" source="media/block-crud-tsql/block-tsql-crud.png" alt-text="Screenshot of the Azure portal showing how to select 'Block T-SQL CRUD' in the list of Preview Features." lightbox="media/block-crud-tsql/block-tsql-crud.png":::
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.
5987

6088
:::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":::
6189

6290
### Re-register Microsoft.Sql resource provider
6391

64-
After you register the block of T-SQL CRUD with 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:
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:
6593

66-
1. Go to your subscription on Azure portal.
94+
1. Go to your subscription in the Azure portal.
6795
1. Select the **Resource Providers** tab.
6896
1. Search and select **Microsoft.Sql** resource provider.
69-
1. Select **Re-register**.
97+
1. Select **Re-register**.
7098

7199
> [!NOTE]
72-
> The re-registration step is mandatory for the T-SQL block to be applied to your subscription.
100+
> The re-registration step is mandatory for the T-SQL block to be applied to your subscription.
73101
74102
:::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":::
75103

azure-sql/toc.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@
6161
- name: SQL Vulnerability Assessment
6262
displayName: database
6363
href: /azure/defender-for-cloud/sql-azure-vulnerability-assessment-overview?toc=/azure/azure-sql/toc.json
64+
- name: Block T-SQL CRUD
65+
href: database/block-crud-tsql.md
66+
displayName: block-tsql-crud, block-tsql-mi-crud
6467
- name: Logins, user accounts, roles, and permissions
6568
href: database/logins-create-manage.md
6669
- name: Microsoft Entra authentication
@@ -669,8 +672,6 @@
669672
href: database/elastic-pool-resource-management.md
670673
- name: Hyperscale performance diagnostics
671674
href: database/hyperscale-performance-diagnostics.md
672-
- name: Block T-SQL CRUD
673-
href: database/block-crud-tsql.md
674675
- name: Azure Automation
675676
href: database/automation-manage.md
676677
- name: Block geo-replication of Azure SQL Database backups

0 commit comments

Comments
 (0)