AZ_SQL_ADMIN
Summary
Forestall ACL Alias
AZ_SQL_ADMIN
Azure Alias
Microsoft Entra Admin (Azure SQL Server)
Affected Object Types
User, Group, Service Principal -> Azure SQL Server
Exploitation Certainty
Certain
Severity
Critical
Description
AZ_SQL_ADMIN is the relationship where a Microsoft Entra principal (user, group, or service principal) is set as the Microsoft Entra administrator of an Azure SQL logical server.
The Entra admin is the highest-privileged principal on the server, with full control over every database (including master):
Read and modify all data in every database on the server.
Create, alter, and drop users, logins, and roles.
Execute arbitrary T-SQL.
Manage database-level security (permissions, row-level security, dynamic data masking).
Use the server's managed identity — if one is assigned — to pivot to other Azure resources (see AZ_ASSIGNED_MANAGED_IDENTITY).
It is critical because it bypasses all database-level access controls. If the admin is a group, every member inherits these rights; if it is a service principal, its credentials grant the same access.
Note: On Azure SQL Managed Instance the classic on-prem model applies (
sysadminrole,USE, cross-database queries). On Azure SQL Database there is nosysadminrole and each connection is bound to a single database — the differences matter in Exploitation.
Identification
PowerShell (Az Module)
Azure Portal
Open Azure Portal -> the target SQL server.
Under Settings, select Microsoft Entra ID.
The current Entra admin is shown with its Object ID and type. If it is a group, review its membership — every member is a SQL admin.
Exploitation
You need the credentials of the admin principal (a user, a service principal, or any member of the admin group) and network reachability to the server.
Connect as the Entra admin
Sign in to Azure as the admin principal, get an Azure SQL access token, and pass it to Invoke-Sqlcmd with -AccessToken:
Enumerate and extract data
On Azure SQL Database each connection is bound to one database (USE and cross-database queries don't work). List the databases from master, then connect to each one to read its data:
Create a backdoor login
A SQL login keeps working even after your Entra admin rights are removed — as long as SQL authentication is still enabled (azureADOnlyAuthentication == false).
Azure SQL Managed Instance is simpler — one step:
CREATE LOGIN ... WITH PASSWORD;thenALTER SERVER ROLE sysadmin ADD MEMBER [backdoor_admin];.
Abuse the server's managed identity
If the server has a managed identity assigned (see AZ_ASSIGNED_MANAGED_IDENTITY), the admin can obtain its token and pivot to whatever Azure resources that identity's RBAC allows. The token is the server's identity, not the admin's, so enumerate its role assignments to scope the pivot. See Azure SQL Managed Identity Token Extraction.
Mitigation
Assign a security group, not individual users, and control membership with access reviews.
Use PIM for the admin group — eligible membership, MFA, and justification on activation, instead of standing assignments.
Avoid service principals as the admin. If required, use certificate-based auth and restrict who can add secrets.
Enable Microsoft Entra-only authentication (Portal -> SQL server -> Microsoft Entra ID -> Support only Microsoft Entra authentication) to block SQL backdoor logins.
Enable Azure SQL Auditing to a Log Analytics workspace or Storage account.
Restrict the network path with private endpoints and firewall rules.
Detection
The abuse of a standing SQL admin — reading data, creating backdoor logins, altering roles, executing T-SQL — is data-plane activity that the Azure Activity log does not record. It surfaces in Azure SQL Auditing, so that is the primary source.
Azure SQL Auditing (Portal -> SQL server/database -> Auditing; must be enabled and sent to Log Analytics/Storage). Review audited events for:
Sign-ins by the Entra admin principal, and connections from unexpected IPs or at unusual times.
Security changes —
CREATE LOGIN,CREATE USER,ALTER ROLE ... ADD MEMBER(backdoor persistence).Large or unusual
SELECTactivity against sensitive tables (bulk data reads).
Microsoft Entra sign-in logs (Portal -> Microsoft Entra ID -> Sign-in logs). Filter for the admin principal and review IP address, Location, and Status for unexpected sign-ins.
Azure Activity log (Portal -> SQL server -> Activity log). This only shows the control-plane act of setting the admin — filter for
Microsoft.Sql/servers/administrators/writeto catch an unexpected principal being made admin. It reveals who became admin, not what they do afterward.
References
Last updated
Was this helpful?