Skip to content

Commit 0cc0c50

Browse files
committed
Add resource prefix for safe secret standard alerts
Add the prefix to identify RGs that we are creating in our TME tenant to identify them as potentially using local auth and violating our safe secret standards.
1 parent 2cc99d9 commit 0cc0c50

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

eng/common/TestResources/New-TestResources.ps1

+12
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,18 @@ try {
194194
-serviceDirectoryName $serviceName `
195195
-CI $CI
196196

197+
if ($wellKnownTMETenants.Contains($TenantId)) {
198+
# Add a prefix to the resource group name to avoid flagging the usages of local auth
199+
# See details at https://eng.ms/docs/products/onecert-certificates-key-vault-and-dsms/key-vault-dsms/certandsecretmngmt/credfreefaqs#how-can-i-disable-s360-reporting-when-testing-customer-facing-3p-features-that-depend-on-use-of-unsafe-local-auth
200+
$ResourceGroupName = "SSS3PT_" + $ResourceGroupName
201+
}
202+
203+
if ($ResourceGroupName.Length -gt 90) {
204+
# See limits at https://docs.microsoft.com/azure/architecture/best-practices/resource-naming
205+
Write-Warning -Message "Resource group name '$ResourceGroupName' is too long. So pruning it to be the first 90 characters."
206+
$ResourceGroupName = $ResourceGroupName.Substring(0, 90)
207+
}
208+
197209
# Make sure pre- and post-scripts are passed formerly required arguments.
198210
$PSBoundParameters['BaseName'] = $BaseName
199211

eng/scripts/live-test-resource-cleanup.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ function HasValidOwnerTag([object]$ResourceGroup) {
233233
function HasValidAliasInName([object]$ResourceGroup) {
234234
# check compliance (formatting first, then validate alias) and skip if compliant
235235
if ($ResourceGroup.ResourceGroupName `
236-
-match '^(rg-)?(?<alias>(t-|a-|v-)?[a-z,A-Z]+)([-_].*)?$' `
236+
-match '^(SSS3PT_)?(rg-)?(?<alias>(t-|a-|v-)?[a-z,A-Z]+)([-_].*)?$' `
237237
-and (IsValidAlias -Alias $matches['alias']))
238238
{
239239
Write-Host " Found resource group '$($ResourceGroup.ResourceGroupName)' starting with valid alias '$($matches['alias'])'"

0 commit comments

Comments
 (0)