Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set-AzureRmSqlDatabaseAuditing does not work with AuditAction, Set-AzureRmSqlDatabaseAuditingPolicy works #5046

Closed
zhiweiv opened this issue Nov 29, 2017 · 8 comments
Assignees
Labels
More Info 🏷️ Service Attention This issue is responsible by Azure service team. SQL

Comments

@zhiweiv
Copy link

zhiweiv commented Nov 29, 2017

Azure PowerShell Version
5.0

I want to audit update events only on database, I tried the below code
$AuditAction = "UPDATE ON database::[xxx] BY [public]";
Set-AzureRmSqlDatabaseAuditing -ResourceGroupName "xxx" -ServerName "xxx" -DatabaseName "xxx" -StorageAccountName "xxx" -AuditAction $AuditAction -PassThru -AuditActionGroup "FAILED_DATABASE_AUTHENTICATION_GROUP" -State Enabled

After I executed the script, it did not audit anything. However, the legacy cmdlet Set-AzureRmSqlDatabaseAuditingPolicy works perfectly,
$AuditAction = "UPDATE ON database::[xxx] BY [public]";
Set-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName "xxx" -ServerName "xxx" -DatabaseName "xxx" -StorageAccountName "xxx" -AuditAction $AuditAction -PassThru -AuditActionGroup "FAILED_DATABASE_AUTHENTICATION_GROUP" -AuditType Blob

Since Set-AzureRmSqlDatabaseAuditingPolicy is obsolete and will be removed in the future, please help to verify and fix it in Set-AzureRmSqlDatabaseAuditing.

Thanks

@cormacpayne
Copy link
Member

@zhiweiv Hey Zhiwei, would you mind running the above cmdlets with $DebugPreference = "Continue" and providing the resulting debug output?

Also, if you could run Get-Module -ListAvailable and provide the resulting list of modules and their versions, that would be great.

CC: @ranisha2

@zhiweiv
Copy link
Author

zhiweiv commented Nov 30, 2017

Hi Cormac,

The results are too big to paste here, I have upload them to my OneDrive, you can access them via https://1drv.ms/f/s!Al_DGOKCXcMSj2fqf6fakP3IbYtx.
There are 3 files: Get-Module.txt/ResultOfSet-AzureRmSqlDatabaseAuditing.txt/ResultOfSet-AzureRmSqlDatabaseAuditingPolicy.txt.

I removed account info in them due to privacy reason.

Thanks

@ranisha2
Copy link
Contributor

@zhiweiv
Hi Zhiwei,

Thank you for reporting this.
Turns out it's a bug from our side. We'll fix this as soon as possible.

@zhiweiv
Copy link
Author

zhiweiv commented Nov 30, 2017

Thanks ranisha2.

@ranisha2 ranisha2 mentioned this issue Nov 30, 2017
13 tasks
@zhiweiv
Copy link
Author

zhiweiv commented Dec 1, 2017

@cormacpayne
Hi Cormac, sorry to bother you. After I ran $DebugPreference = "Continue", my scripts keep outputing debug logs, I didn't find a way to turn it off after a lot of Google, I have tried $DebugPreference="SilentlyContinue" and restarted my laptop.
Do you know how to turn off the debug output?

Many thanks

@cormacpayne
Copy link
Member

@zhiweiv Hey Zhiwei, when you start a new PowerShell session and run $DebugPreference, what does it return?

When you set $DebugPreference = "Continue", it should only retain that value for the session. The way to go back to no output is to set $DebugPreference = "SilentlyContinue", so I'm curious as to why it wouldn't change this for you.

Worst case scenario, you can modify your $profile script to set $DebugPreference = "SilentlyContinue" and this will get ran whenever you open a new PowerShell session.

@zhiweiv
Copy link
Author

zhiweiv commented Dec 1, 2017

@cormacpayne
Hi Cormac, it is my fault. I left the $DebugPreference = "Continue" somewhere in my scripts during the test, that is why $DebugPreference = "SilentlyContinue" is not working. It is ok now.

Sorry again.

@maddieclayton
Copy link
Contributor

Closing as fixed. Please reopen this if the issue still exists.

@bsiegel bsiegel added the Service Attention This issue is responsible by Azure service team. label Sep 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
More Info 🏷️ Service Attention This issue is responsible by Azure service team. SQL
Projects
None yet
Development

No branches or pull requests

5 participants