From 5509e86c96cddb7ab0c8d01e3f7392fde51c5679 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] 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)'"