diff --git a/src/Sql/Sql/ChangeLog.md b/src/Sql/Sql/ChangeLog.md index 479e453a8c54..fc2be7e4a2bd 100644 --- a/src/Sql/Sql/ChangeLog.md +++ b/src/Sql/Sql/ChangeLog.md @@ -19,6 +19,7 @@ --> ## Upcoming Release * Fixed parameter description for `InstanceFailoverGroup` command. +* Updated the logic in which schemaName, tableName and columnName are being extracted from the id of SQL Data Classification commands. * Fixed Status and StatusMessage fields in `Get-AzSqlDatabaseImportExportStatus` to conform to documentation ## Version 2.13.0 diff --git a/src/Sql/Sql/DataClassification/Services/DataClassificationAdapter.cs b/src/Sql/Sql/DataClassification/Services/DataClassificationAdapter.cs index edf72dd529d3..fb8141be4290 100644 --- a/src/Sql/Sql/DataClassification/Services/DataClassificationAdapter.cs +++ b/src/Sql/Sql/DataClassification/Services/DataClassificationAdapter.cs @@ -285,12 +285,14 @@ private static SensitivityLabel ToSensitivityLabel(SensitivityLabelModel sensiti private static SensitivityLabelModel ToSensitivityLabelModel(SensitivityLabel sensitivityLabel) { - string[] idComponents = sensitivityLabel.Id.Split('/'); + var match = new global::System.Text.RegularExpressions.Regex("/schemas/(?.*)/tables/(?.*)/columns/(?.*)/sensitivityLabels/", + global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(sensitivityLabel.Id); + return new SensitivityLabelModel { - SchemaName = idComponents[12], - TableName = idComponents[14], - ColumnName = idComponents[16], + SchemaName = match.Groups["schemaName"].Value, + TableName = match.Groups["tableName"].Value, + ColumnName = match.Groups["columnName"].Value, SensitivityLabel = NullifyStringIfEmpty(sensitivityLabel.LabelName), SensitivityLabelId = NullifyStringIfEmpty(sensitivityLabel.LabelId), InformationType = NullifyStringIfEmpty(sensitivityLabel.InformationType),