Skip to content

Commit

Permalink
updated regex expression to support spaces (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
azurekid authored Sep 2, 2023
1 parent af5b474 commit 69ad839
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Public/Add-AzWorkspaceManagerGroup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function Add-AzWorkspaceManagerGroup {

[Parameter(Mandatory = $true, ValueFromPipeline = $false)]
[ValidateNotNullOrEmpty()]
[ValidatePattern('^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$', ErrorMessage="It does not match expected pattern '{1}'")]
[ValidatePattern('^[A-Za-z0-9]+( [A-Za-z0-9-]+[A-Za-z0-9])*$', ErrorMessage="It does not match expected pattern '{1}'")]
[string]$Name,

[Parameter(Mandatory = $false, ValueFromPipeline = $false)]
Expand Down Expand Up @@ -54,7 +54,7 @@ function Add-AzWorkspaceManagerGroup {
if ($SessionVariables.workspaceManagerConfiguration -eq 'Enabled') {
try {
Write-Verbose "Adding Workspace Manager Group to workspace [$WorkspaceName)]"
$uri = "$($SessionVariables.workspace)/providers/Microsoft.SecurityInsights/workspaceManagerGroups/$($Name)?api-version=$($SessionVariables.apiVersion)"
$uri = "$($SessionVariables.workspace)/providers/Microsoft.SecurityInsights/workspaceManagerGroups/$($Name.Replace(' ', '-'))?api-version=$($SessionVariables.apiVersion)"

$requestParam = @{
Headers = $authHeader
Expand Down Expand Up @@ -95,6 +95,8 @@ function Add-AzWorkspaceManagerGroup {
The name of the ResouceGroup where the log analytics workspace is located.
.PARAMETER Name
The name of the workspace manager group.
If an name is provided with spaces in it, the name will be converted to a name without spaces.
The display name will be the name with spaces.
.PARAMETER Description
The description of the workspace manager group. If not specified, the name will be used.
.PARAMETER workspaceManagerMembers
Expand Down

0 comments on commit 69ad839

Please sign in to comment.