@@ -45,19 +45,22 @@ public class SetAzureSqlDatabaseAuditingPolicy : SqlDatabaseAuditingCmdletBase
45
45
/// Defines the set of audit action groups that would be used by the auditing settings
46
46
/// </summary>
47
47
[ Parameter ( Mandatory = false , ValueFromPipelineByPropertyName = true , HelpMessage = "The set of the audit action groups" ) ]
48
+ [ ValidateNotNullOrEmpty ]
48
49
public AuditActionGroups [ ] AuditActionGroup { get ; set ; }
49
50
50
51
/// <summary>
51
52
/// Defines the set of audit actions that would be used by the auditing settings
52
53
/// </summary>
53
54
[ Parameter ( Mandatory = false , ValueFromPipelineByPropertyName = true , HelpMessage = "The set of the audit actions" ) ]
55
+ [ ValidateNotNullOrEmpty ]
54
56
public string [ ] AuditAction { get ; set ; }
55
57
56
58
/// <summary>
57
59
/// Gets or sets the names of the event types to use.
58
60
/// </summary>
59
61
[ Parameter ( Mandatory = false , ValueFromPipelineByPropertyName = true , HelpMessage = "Event types to audit" ) ]
60
62
[ ValidateSet ( SecurityConstants . PlainSQL_Success , SecurityConstants . PlainSQL_Failure , SecurityConstants . ParameterizedSQL_Success , SecurityConstants . ParameterizedSQL_Failure , SecurityConstants . StoredProcedure_Success , SecurityConstants . StoredProcedure_Failure , SecurityConstants . Login_Success , SecurityConstants . Login_Failure , SecurityConstants . TransactionManagement_Success , SecurityConstants . TransactionManagement_Failure , SecurityConstants . All , SecurityConstants . None , IgnoreCase = false ) ]
63
+ [ ValidateNotNullOrEmpty ]
61
64
public string [ ] EventType { get ; set ; }
62
65
63
66
/// <summary>
@@ -126,7 +129,7 @@ private void ApplyUserInputToBlobAuditingModel(DatabaseBlobAuditingPolicyModel m
126
129
model . StorageAccountName = StorageAccountName ;
127
130
}
128
131
129
- if ( ! string . IsNullOrEmpty ( StorageKeyType ) )
132
+ if ( MyInvocation . BoundParameters . ContainsKey ( " StorageKeyType" ) )
130
133
{
131
134
// the user enter a key type - we use it (and override the previously defined key type)
132
135
model . StorageKeyType = ( StorageKeyType == SecurityConstants . Primary )
@@ -144,7 +147,7 @@ private void ApplyUserInputToBlobAuditingModel(DatabaseBlobAuditingPolicyModel m
144
147
model . AuditAction = AuditAction ;
145
148
}
146
149
147
- if ( EventType != null ) // Event types are relevant only for Table auditing
150
+ if ( MyInvocation . BoundParameters . ContainsKey ( " EventType" ) ) // Event types are relevant only for Table auditing
148
151
{
149
152
throw new Exception ( string . Format ( Properties . Resources . EventTypeConfiguringIrrelevantForBlobAuditingPolicy ) ) ;
150
153
}
@@ -170,7 +173,7 @@ private void ApplyUserInputToTableAuditingModel(DatabaseAuditingPolicyModel mode
170
173
171
174
EventType = Util . ProcessAuditEvents ( EventType ) ;
172
175
173
- if ( EventType != null ) // the user provided Table auditing event types
176
+ if ( MyInvocation . BoundParameters . ContainsKey ( " EventType" ) ) // the user provided Table auditing event types
174
177
{
175
178
model . EventType = EventType . Select ( s => SecurityConstants . AuditEventsToAuditEventType [ s ] ) . ToArray ( ) ;
176
179
}
0 commit comments