From a801c484ff59197e2f33040b8fab5de4f4124084 Mon Sep 17 00:00:00 2001 From: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> Date: Mon, 30 Aug 2021 14:59:23 -0700 Subject: [PATCH 1/3] Add random elements to default base name --- eng/common/TestResources/New-TestResources.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/common/TestResources/New-TestResources.ps1 b/eng/common/TestResources/New-TestResources.ps1 index fa75730dcd2d..bb83ec15951b 100644 --- a/eng/common/TestResources/New-TestResources.ps1 +++ b/eng/common/TestResources/New-TestResources.ps1 @@ -190,7 +190,7 @@ try { $BaseName = 't' + (New-Guid).ToString('n').Substring(0, 16) Log "Generated base name '$BaseName' for CI build" } elseif (!$BaseName) { - $BaseName = "$UserName$ServiceDirectory" + $BaseName = "$UserName$ServiceDirectory" + (New-Guid).ToString('n').Substring(0, 4) Log "BaseName was not set. Using default base name '$BaseName'" } From 86133d0830d81626c272ca9b8d94e3b6569bc29a Mon Sep 17 00:00:00 2001 From: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> Date: Mon, 30 Aug 2021 16:12:08 -0700 Subject: [PATCH 2/3] Fix principal --- eng/common/TestResources/New-TestResources.ps1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/eng/common/TestResources/New-TestResources.ps1 b/eng/common/TestResources/New-TestResources.ps1 index bb83ec15951b..71dc4667e89c 100644 --- a/eng/common/TestResources/New-TestResources.ps1 +++ b/eng/common/TestResources/New-TestResources.ps1 @@ -190,7 +190,7 @@ try { $BaseName = 't' + (New-Guid).ToString('n').Substring(0, 16) Log "Generated base name '$BaseName' for CI build" } elseif (!$BaseName) { - $BaseName = "$UserName$ServiceDirectory" + (New-Guid).ToString('n').Substring(0, 4) + $BaseName = "$UserName$ServiceDirectory" Log "BaseName was not set. Using default base name '$BaseName'" } @@ -289,7 +289,8 @@ try { $AzureTestPrincipal } else { Log "TestApplicationId was not specified; creating a new service principal in subscription '$SubscriptionId'" - $global:AzureTestPrincipal = New-AzADServicePrincipal -Role Owner -Scope "/subscriptions/$SubscriptionId" -DisplayName "test-resources-$($baseName).microsoft.com" + $suffix = (New-Guid).ToString('n').Substring(0, 4) + $global:AzureTestPrincipal = New-AzADServicePrincipal -Role Owner -Scope "/subscriptions/$SubscriptionId" -DisplayName "test-resources-$($baseName)$suffix.microsoft.com" $global:AzureTestSubscription = $SubscriptionId Log "Created service principal '$($AzureTestPrincipal.ApplicationId)'" From 77723aa35d3f2bce766c800c19310f9969d5528e Mon Sep 17 00:00:00 2001 From: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> Date: Mon, 30 Aug 2021 16:13:13 -0700 Subject: [PATCH 3/3] tab --- eng/common/TestResources/New-TestResources.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/common/TestResources/New-TestResources.ps1 b/eng/common/TestResources/New-TestResources.ps1 index 71dc4667e89c..508b9b693976 100644 --- a/eng/common/TestResources/New-TestResources.ps1 +++ b/eng/common/TestResources/New-TestResources.ps1 @@ -289,7 +289,7 @@ try { $AzureTestPrincipal } else { Log "TestApplicationId was not specified; creating a new service principal in subscription '$SubscriptionId'" - $suffix = (New-Guid).ToString('n').Substring(0, 4) + $suffix = (New-Guid).ToString('n').Substring(0, 4) $global:AzureTestPrincipal = New-AzADServicePrincipal -Role Owner -Scope "/subscriptions/$SubscriptionId" -DisplayName "test-resources-$($baseName)$suffix.microsoft.com" $global:AzureTestSubscription = $SubscriptionId