title | description | author | ms.author | ms.date | ms.service | ms.subservice | ms.custom | ms.topic |
---|---|---|---|---|---|---|---|---|
Manage Azure SQL Database Auditing using APIs |
Use Azure SQL Database auditing to track database events into an audit log. |
sravanisaluru |
srsaluru |
04/26/2023 |
sql-database |
security |
devx-track-azurepowershell |
conceptual |
[!INCLUDEappliesto-sqldb-asa]
This article provides an overview of the different APIs used for managing Auditing for Azure SQL Database and Azure Synapse Analytics.
PowerShell cmdlets (including WHERE clause support for additional filtering):
- Create or Update Database Auditing Policy (Set-AzSqlDatabaseAudit)
- Create or Update Server Auditing Policy (Set-AzSqlServerAudit)
- Get Database Auditing Policy (Get-AzSqlDatabaseAudit)
- Get Server Auditing Policy (Get-AzSqlServerAudit)
- Remove Database Auditing Policy (Remove-AzSqlDatabaseAudit)
- Remove Server Auditing Policy (Remove-AzSqlServerAudit)
For a script example, see Configure auditing and threat detection using PowerShell.
REST API:
- Create or Update Database Auditing Policy
- Create or Update Server Auditing Policy
- Get Database Auditing Policy
- Get Server Auditing Policy
Extended policy with WHERE clause support for additional filtering:
- Create or Update Database Extended Auditing Policy
- Create or Update Server Extended Auditing Policy
- Get Database Extended Auditing Policy
- Get Server Extended Auditing Policy
You can manage Azure SQL Database auditing using Azure Resource Manager templates, as shown in these examples:
- Deploy an Azure SQL Database with Auditing enabled to write audit logs to Azure Blob storage account
- Deploy an Azure SQL Database with Auditing enabled to write audit logs to Log Analytics
- Deploy an Azure SQL Database with Auditing enabled to write audit logs to Event Hubs
Note
The linked samples are on an external public repository and are provided 'as is', without warranty, and are not supported under any Microsoft support program/service.