azure-sql-entra-admin-policy-mod-mi
managedInstances/administrators/write allows modifying the Entra admin assignment on the MI, which is equivalent to modifying the SQL access policy (who holds db_owner on all MI databases).
match
A conjunctive graph pattern. Variables (?x) bind node ids; every clause must hold.
where
node_type(?mi) ==
RelationalDatabase
?mi.provider_type == 'Microsoft.Sql/managedInstances' # Azure SQL Managed Instance
?principal has EFFECTIVE Microsoft.Sql/managedInstances/administrators/write at ?mi scope
emit
| source type | Identity |
|---|---|
| target type | RelationalDatabase |
| source | ?principal |
| target | ?mi |
| permissions | Microsoft.Sql/managedInstances/administrators/write |
| conditions | iam_permission |
| state logic | if a deny assignment or deny Azure Policy covers administrators/write at the effective scope: BLOCKED; else ACTIVE: the principal can modify the Entra admin assignment on the MI, changing the security policy to grant db_owner role to any Entra identity (including themselves). |
Narrative
{principal.name} can modify the SQL access policy by setting the Entra administrator on {mi.name} via Microsoft.Sql/managedInstances/administrators/write.
Raw rule rules/derived/azure/sql.yaml
id: azure-sql-entra-admin-policy-mod-mi
emits: CanModifyPolicy
description: managedInstances/administrators/write allows modifying the Entra admin assignment on the
MI, which is equivalent to modifying the SQL access policy (who holds db_owner on all MI databases).
match:
- - principal: null
- HasPermission
- mi: null
where:
- node_type(?mi) == RelationalDatabase
- '?mi.provider_type == ''Microsoft.Sql/managedInstances'' # Azure SQL Managed Instance'
- ?principal has EFFECTIVE Microsoft.Sql/managedInstances/administrators/write at ?mi scope
emit:
source_type: Identity
target_type: RelationalDatabase
source: ?principal
target: ?mi
permissions:
- Microsoft.Sql/managedInstances/administrators/write
conditions:
- iam_permission
state_logic: 'if a deny assignment or deny Azure Policy covers administrators/write at the effective
scope: BLOCKED; else ACTIVE: the principal can modify the Entra admin assignment on the MI, changing
the security policy to grant db_owner role to any Entra identity (including themselves).'
confidence: '0.97'
derived_from:
- <HasPermission edge_id (administrators/write)>
false_positive_note: This edge captures the POLICY-MODIFICATION aspect of administrators/write, independent
of downstream data access. Both CanModifyPolicy and CanReadData/ CanWriteData are emitted by separate
rules on the same permission.
narrative: '{principal.name} can modify the SQL access policy by setting the Entra administrator on
{mi.name} via Microsoft.Sql/managedInstances/administrators/write.'