Share via

Enable table level auditing in Azure SQL DB

Vijay Kumar 2,061 Reputation points
2022-04-27T17:36:33.733+00:00

Hi Team,

How to enable table level auditing in Azure SQL DB and Azure SQL MI?

We want to only enable auditing on certain table not on entire database.

Azure SQL Database
0 comments No comments

Answer accepted by question author

Alberto Morillo 35,506 Reputation points MVP Volunteer Moderator
2022-04-27T20:13:10.29+00:00

You can set up the audit as shown below:

Set-AzureRmSqlDatabaseAuditing -ResourceGroupName "resourceGroup"  
 -ServerName "SQL Server Name" -DatabaseName "AdventureWorksLT"    
 -StorageAccountName "storageAccount"   
-AuditActionGroup "SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP", "FAILED_DATABASE_AUTHENTICATION_GROUP", "BATCH_COMPLETED_GROUP"   
 -AuditAction "SELECT ON dbo.myTable BY public"    
 -RetentionInDays 60  

See the audit action available at the database level here.

More AuditActions at the table level:

-AuditAction "DELETE ON dbo.myTable BY public"
-AuditAction "UPDATE ON dbo.myTable BY public"
-AuditAction "INSERT ON dbo.myTable BY public"

Was this answer helpful?


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.