Skip to content

Commit 6b438c8

Browse files
committed
updating masking behavoir for auto-generated rg names
1 parent 8240065 commit 6b438c8

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

tests/integration/all-resource-types/modules/LogMasking.psm1

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,15 @@ System.String
9696
#>
9797
function Protect-ResourceGroupName {
9898
param([string]$Value)
99+
100+
if (-not $script:EnableMasking) { return $Value }
101+
if ([string]::IsNullOrWhiteSpace($Value)) { return '<REDACTED:empty>' }
102+
103+
# Preserve the generated suffix for round-trip RGs: <prefix>-<date>-<time>-<rand>-<src|tgt>-rg
104+
if ($Value -match '^([a-z0-9]+)-\d{8}-\d{6}-([a-z0-9]+)-(src|tgt)-rg$') {
105+
return "$($Matches[1])-...-$($Matches[2])-$($Matches[3])-rg"
106+
}
107+
99108
return Protect-Identifier -Value $Value -Prefix 3 -Suffix 7
100109
}
101110

0 commit comments

Comments
 (0)