-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
SQL Auditing: Remove AUDIT_CHANGE_GROUP from available AuditActionGroups #4990
Changes from all commits
977061d
f06dddc
8714473
2d1cc1e
2114f53
e68aea8
31817de
84c4182
f928f8c
8f19f74
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,12 +12,15 @@ | |
// limitations under the License. | ||
// ---------------------------------------------------------------------------------- | ||
|
||
using System; | ||
using System.Linq; | ||
using System.Management.Automation; | ||
using Microsoft.Azure.Commands.Common.Authentication.Abstractions; | ||
using Microsoft.Azure.Commands.Common.Authentication.Models; | ||
using Microsoft.Azure.Commands.Sql.Auditing.Model; | ||
using Microsoft.Azure.Commands.Sql.Auditing.Services; | ||
using Microsoft.Azure.Commands.Sql.Common; | ||
using System.Management.Automation; | ||
using Microsoft.Azure.Commands.Sql.Properties; | ||
|
||
namespace Microsoft.Azure.Commands.Sql.Auditing.Cmdlet | ||
{ | ||
|
@@ -61,6 +64,15 @@ protected override SqlAuditAdapter InitModelAdapter(IAzureSubscription subscript | |
/// <param name="baseModel">The model object with the data to be sent to the REST endpoints</param> | ||
protected override ServerBlobAuditingSettingsModel PersistChanges(ServerBlobAuditingSettingsModel baseModel) | ||
{ | ||
if (Array.IndexOf(baseModel.AuditActionGroup, AuditActionGroups.AUDIT_CHANGE_GROUP) > -1) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ranisha2 same comment here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
||
{ | ||
// AUDIT_CHANGE_GROUP is not supported. | ||
WriteWarning(Resources.auditChangeGroupDeprecationMessage); | ||
|
||
// Remove it | ||
baseModel.AuditActionGroup = baseModel.AuditActionGroup.Where(v => v != AuditActionGroups.AUDIT_CHANGE_GROUP).ToArray(); | ||
} | ||
|
||
ModelAdapter.SetServerAuditingPolicy(baseModel, DefaultContext.Environment.GetEndpoint(AzureEnvironment.Endpoint.StorageEndpointSuffix)); | ||
|
||
return null; | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ranisha2 is
model.AuditActionGroup
always going to be an initialized array?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cormacpayne We perform a GetPolicy request in order to override only the provided parameters.
When not provided, we'll use the saved AuditActionGroup value, which is always initialized.