diff --git a/src/Microsoft.Azure.EventHubs.Processor/AzureStorageCheckpointLeaseManager.cs b/src/Microsoft.Azure.EventHubs.Processor/AzureStorageCheckpointLeaseManager.cs index 1a31648..bb7fc1d 100644 --- a/src/Microsoft.Azure.EventHubs.Processor/AzureStorageCheckpointLeaseManager.cs +++ b/src/Microsoft.Azure.EventHubs.Processor/AzureStorageCheckpointLeaseManager.cs @@ -38,12 +38,15 @@ internal AzureStorageCheckpointLeaseManager(CloudStorageAccount cloudStorageAcco throw new ArgumentNullException(nameof(cloudStorageAccount)); } - // Validate lease container name. - if (!Regex.IsMatch(leaseContainerName, @"^[a-z0-9](([a-z0-9\-[^\-])){1,61}[a-z0-9]$")) + try + { + NameValidator.ValidateContainerName(leaseContainerName); + } + catch (ArgumentException) { throw new ArgumentException( "Azure Storage lease container name is invalid. Please check naming conventions at https://msdn.microsoft.com/en-us/library/azure/dd135715.aspx", - nameof(leaseContainerName)); + nameof(leaseContainerName)); } this.cloudStorageAccount = cloudStorageAccount;