diff --git a/setup/azurecmdfiles.wxi b/setup/azurecmdfiles.wxi index b82d97f7848c..929b2e393cd2 100644 --- a/setup/azurecmdfiles.wxi +++ b/setup/azurecmdfiles.wxi @@ -38,15 +38,6 @@ - - - - - - - - - @@ -92,9 +83,6 @@ - - - @@ -183,15 +171,6 @@ - - - - - - - - - @@ -231,9 +210,6 @@ - - - @@ -329,15 +305,6 @@ - - - - - - - - - @@ -425,9 +392,6 @@ - - - @@ -670,15 +634,6 @@ - - - - - - - - - @@ -736,9 +691,6 @@ - - - @@ -771,15 +723,6 @@ - - - - - - - - - @@ -807,9 +750,6 @@ - - - @@ -836,15 +776,6 @@ - - - - - - - - - @@ -866,9 +797,6 @@ - - - @@ -937,15 +865,6 @@ - - - - - - - - - @@ -988,9 +907,6 @@ - - - @@ -1334,15 +1250,6 @@ - - - - - - - - - @@ -1397,9 +1304,6 @@ - - - @@ -1426,15 +1330,6 @@ - - - - - - - - - @@ -1471,9 +1366,6 @@ - - - @@ -1491,15 +1383,6 @@ - - - - - - - - - @@ -1563,9 +1446,6 @@ - - - @@ -1702,15 +1582,6 @@ - - - - - - - - - @@ -1756,9 +1627,6 @@ - - - @@ -1785,15 +1653,6 @@ - - - - - - - - - @@ -1845,9 +1704,6 @@ - - - @@ -2064,15 +1920,6 @@ - - - - - - - - - @@ -2214,9 +2061,6 @@ - - - @@ -2302,15 +2146,6 @@ - - - - - - - - - @@ -2374,9 +2209,6 @@ - - - @@ -2427,15 +2259,6 @@ - - - - - - - - - @@ -2547,9 +2370,6 @@ - - - @@ -2576,15 +2396,6 @@ - - - - - - - - - @@ -2708,9 +2519,6 @@ - - - @@ -3011,15 +2819,6 @@ - - - - - - - - - @@ -3074,9 +2873,6 @@ - - - @@ -3121,15 +2917,6 @@ - - - - - - - - - @@ -3250,9 +3037,6 @@ - - - @@ -3510,15 +3294,6 @@ - - - - - - - - - @@ -3660,9 +3435,6 @@ - - - @@ -3680,15 +3452,6 @@ - - - - - - - - - @@ -3752,9 +3515,6 @@ - - - @@ -3840,15 +3600,6 @@ - - - - - - - - - @@ -3894,9 +3645,6 @@ - - - @@ -3915,9 +3663,6 @@ - - - @@ -3933,7 +3678,6 @@ - @@ -3962,9 +3706,6 @@ - - - @@ -3978,7 +3719,6 @@ - @@ -4010,9 +3750,6 @@ - - - @@ -4042,7 +3779,6 @@ - @@ -4113,9 +3849,6 @@ - - - @@ -4135,7 +3868,6 @@ - @@ -4146,9 +3878,6 @@ - - - @@ -4158,7 +3887,6 @@ - @@ -4167,9 +3895,6 @@ - - - @@ -4177,7 +3902,6 @@ - @@ -4200,9 +3924,6 @@ - - - @@ -4217,7 +3938,6 @@ - @@ -4329,9 +4049,6 @@ - - - @@ -4350,7 +4067,6 @@ - @@ -4359,9 +4075,6 @@ - - - @@ -4374,15 +4087,11 @@ - - - - @@ -4404,7 +4113,6 @@ - @@ -4449,9 +4157,6 @@ - - - @@ -4467,7 +4172,6 @@ - @@ -4476,9 +4180,6 @@ - - - @@ -4496,7 +4197,6 @@ - @@ -4565,9 +4265,6 @@ - - - @@ -4615,7 +4312,6 @@ - @@ -4643,9 +4339,6 @@ - - - @@ -4667,7 +4360,6 @@ - @@ -4684,9 +4376,6 @@ - - - @@ -4724,7 +4413,6 @@ - @@ -4733,9 +4421,6 @@ - - - @@ -4777,7 +4462,6 @@ - @@ -4866,9 +4550,6 @@ - - - @@ -4887,7 +4568,6 @@ - @@ -4902,9 +4582,6 @@ - - - @@ -4945,7 +4622,6 @@ - @@ -5021,9 +4697,6 @@ - - - @@ -5071,15 +4744,11 @@ - - - - @@ -5101,7 +4770,6 @@ - @@ -5129,9 +4797,6 @@ - - - @@ -5147,7 +4812,6 @@ - diff --git a/src/ResourceManager/Sql/Commands.Sql/Properties/Resources.Designer.cs b/src/ResourceManager/Sql/Commands.Sql/Properties/Resources.Designer.cs index 75a9ad22cfa2..537c1e1fa5f2 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Properties/Resources.Designer.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Properties/Resources.Designer.cs @@ -105,6 +105,15 @@ internal static string DataMaskingTableAndColumnUsedError { } } + /// + /// Looks up a localized string similar to The {0} cmdlet is deprecated and will be removed in a future release.. + /// + internal static string DeprecatedCmdletUsageWarning { + get { + return ResourceManager.GetString("DeprecatedCmdletUsageWarning", resourceCulture); + } + } + /// /// Looks up a localized string similar to The use of any of these event types is deprecated: DataAccess, SchemaChanges, DataChanges, SecurityExceptions, RevokePermissions. /// @@ -177,6 +186,15 @@ internal static string NewDataMaskingRuleIdAlreadyExistError { } } + /// + /// Looks up a localized string similar to Rule Id cannot contain '<,>,+,=,#,*,%,&,\,/,?' and cannot end with a '.'. + /// + internal static string NewDataMaskingRuleIdIsNotValid { + get { + return ResourceManager.GetString("NewDataMaskingRuleIdIsNotValid", resourceCulture); + } + } + /// /// Looks up a localized string similar to Cannot set auditing policy without a storage account name.. /// diff --git a/src/ResourceManager/Sql/Commands.Sql/Properties/Resources.resx b/src/ResourceManager/Sql/Commands.Sql/Properties/Resources.resx index 7c4a74d3e52b..dca808bc7610 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Properties/Resources.resx +++ b/src/ResourceManager/Sql/Commands.Sql/Properties/Resources.resx @@ -228,4 +228,10 @@ The use of any of these event types is deprecated: DataAccess, SchemaChanges, DataChanges, SecurityExceptions, RevokePermissions + + The {0} cmdlet is deprecated and will be removed in a future release. + + + Rule Id cannot contain '<,>,+,=,#,*,%,&,\,/,?' and cannot end with a '.' + \ No newline at end of file diff --git a/src/ResourceManager/Sql/Commands.Sql/Security/Cmdlet/DataMasking/BuildAzureSqlDatabaseDataMaskingRule.cs b/src/ResourceManager/Sql/Commands.Sql/Security/Cmdlet/DataMasking/BuildAzureSqlDatabaseDataMaskingRule.cs index 2d5503c68075..48f65d22fa69 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Security/Cmdlet/DataMasking/BuildAzureSqlDatabaseDataMaskingRule.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Security/Cmdlet/DataMasking/BuildAzureSqlDatabaseDataMaskingRule.cs @@ -32,16 +32,12 @@ public abstract class BuildAzureSqlDatabaseDataMaskingRule : SqlDatabaseDataMask /// /// Gets or sets the table name /// - [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The table name.")] - [ValidateNotNullOrEmpty] - public string TableName { get; set; } + public virtual string TableName { get; set; } /// /// Gets or sets the column name /// - [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The column name.")] - [ValidateNotNullOrEmpty] - public string ColumnName { get; set; } + public virtual string ColumnName { get; set; } /// /// Gets or sets the masking function - the definition of this property as a cmdlet parameter is done in the subclasses diff --git a/src/ResourceManager/Sql/Commands.Sql/Security/Cmdlet/DataMasking/NewAzureSqlDatabaseDataMaskingRule.cs b/src/ResourceManager/Sql/Commands.Sql/Security/Cmdlet/DataMasking/NewAzureSqlDatabaseDataMaskingRule.cs index 0936924197a7..de061bc3af36 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Security/Cmdlet/DataMasking/NewAzureSqlDatabaseDataMaskingRule.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Security/Cmdlet/DataMasking/NewAzureSqlDatabaseDataMaskingRule.cs @@ -19,6 +19,7 @@ using System.Globalization; using System.Linq; using System.Management.Automation; +using System.Text.RegularExpressions; namespace Microsoft.Azure.Commands.Sql.Security.Cmdlet.DataMasking { @@ -28,6 +29,20 @@ namespace Microsoft.Azure.Commands.Sql.Security.Cmdlet.DataMasking [Cmdlet(VerbsCommon.New, "AzureSqlDatabaseDataMaskingRule")] public class NewAzureSqlDatabaseDataMaskingRule : BuildAzureSqlDatabaseDataMaskingRule { + /// + /// Gets or sets the column name + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The column name.")] + [ValidateNotNullOrEmpty] + public override string ColumnName { get; set; } + + /// + /// Gets or sets the table name + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The table name.")] + [ValidateNotNullOrEmpty] + public override string TableName { get; set; } + /// /// Gets or sets the masking function /// @@ -52,6 +67,12 @@ protected override IEnumerable GetEntity() /// An error message or null if all is fine protected override string ValidateOperation(IEnumerable rules) { + var ruleIdRegex = new Regex("^[^/\\\\#+=<>*%&:?]*[^/\\\\#+=<>*%&:?.]$"); + + if (!ruleIdRegex.IsMatch(RuleId)) // an invalid rule name + { + return string.Format(CultureInfo.InvariantCulture, Resources.NewDataMaskingRuleIdIsNotValid, RuleId); + } if(rules.Any(r=> r.RuleId == RuleId)) { return string.Format(CultureInfo.InvariantCulture, Resources.NewDataMaskingRuleIdAlreadyExistError, RuleId); diff --git a/src/ResourceManager/Sql/Commands.Sql/Security/Cmdlet/DataMasking/SetAzureSqlDatabaseDataMaskingRule.cs b/src/ResourceManager/Sql/Commands.Sql/Security/Cmdlet/DataMasking/SetAzureSqlDatabaseDataMaskingRule.cs index 6d64c6077faf..21482c253f7a 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Security/Cmdlet/DataMasking/SetAzureSqlDatabaseDataMaskingRule.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Security/Cmdlet/DataMasking/SetAzureSqlDatabaseDataMaskingRule.cs @@ -28,6 +28,20 @@ namespace Microsoft.Azure.Commands.Sql.Security.Cmdlet.DataMasking [Cmdlet(VerbsCommon.Set, "AzureSqlDatabaseDataMaskingRule")] public class SetAzureSqlDatabaseDataMaskingRule : BuildAzureSqlDatabaseDataMaskingRule { + + /// + /// Gets or sets the column name + /// + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The column name.")] + public override string ColumnName { get; set; } + + /// + /// Gets or sets the table name + /// + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The table name.")] + public override string TableName { get; set; } + + /// /// Gets or sets the masking function /// diff --git a/src/ResourceManager/Sql/Commands.Sql/Security/Cmdlet/SecureConnection/DisableAzureSqlDatabaseDirectAccess.cs b/src/ResourceManager/Sql/Commands.Sql/Security/Cmdlet/SecureConnection/DisableAzureSqlDatabaseDirectAccess.cs index c69bf3063638..4fccd211bcb5 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Security/Cmdlet/SecureConnection/DisableAzureSqlDatabaseDirectAccess.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Security/Cmdlet/SecureConnection/DisableAzureSqlDatabaseDirectAccess.cs @@ -12,6 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using Microsoft.Azure.Commands.Sql.Properties; using Microsoft.Azure.Commands.Sql.Security.Model; using System.Management.Automation; @@ -41,6 +42,8 @@ public class DisableAzureSqlDatabaseDirectAccess : SqlDatabaseSecureConnectionCm /// A model object protected override DatabaseSecureConnectionPolicyModel ApplyUserInputToModel(DatabaseSecureConnectionPolicyModel model) { + + WriteWarning(string.Format(Resources.DeprecatedCmdletUsageWarning, "Disable-AzureSqlDatabaseDirectAccess")); model.SecureConnectionState = SecureConnectionStateType.Required; return model; } diff --git a/src/ResourceManager/Sql/Commands.Sql/Security/Cmdlet/SecureConnection/EnableAzureSqlDatabaseDirectAccess.cs b/src/ResourceManager/Sql/Commands.Sql/Security/Cmdlet/SecureConnection/EnableAzureSqlDatabaseDirectAccess.cs index 12fe44385895..2943aafe6728 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Security/Cmdlet/SecureConnection/EnableAzureSqlDatabaseDirectAccess.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Security/Cmdlet/SecureConnection/EnableAzureSqlDatabaseDirectAccess.cs @@ -12,6 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using Microsoft.Azure.Commands.Sql.Properties; using Microsoft.Azure.Commands.Sql.Security.Model; using System.Management.Automation; @@ -41,6 +42,7 @@ public class EnableAzureSqlDatabaseDirectAccess : SqlDatabaseSecureConnectionCmd /// A model object protected override DatabaseSecureConnectionPolicyModel ApplyUserInputToModel(DatabaseSecureConnectionPolicyModel model) { + WriteWarning(string.Format(Resources.DeprecatedCmdletUsageWarning, "Enable-AzureSqlDatabaseDirectAccess")); model.SecureConnectionState = SecureConnectionStateType.Optional; return model; }