Skip to content

Commit

Permalink
Use -Mail for test resources local user lookup to support TME
Browse files Browse the repository at this point in the history
  • Loading branch information
benbp committed Dec 12, 2024
1 parent 81963b1 commit 1e4ec29
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions eng/common/TestResources/New-TestResources.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,8 @@ try {
# Make sure the provisioner OID is set so we can pass it through to the deployment.
if (!$ProvisionerApplicationId -and !$ProvisionerApplicationOid) {
if ($context.Account.Type -eq 'User') {
$user = Get-AzADUser -UserPrincipalName $context.Account.Id
# Use -Mail as the lookup works in both corp and TME tenants
$user = Get-AzADUser -Mail $context.Account
$ProvisionerApplicationOid = $user.Id
} elseif ($context.Account.Type -eq 'ServicePrincipal') {
$sp = Get-AzADServicePrincipal -ApplicationId $context.Account.Id
Expand Down Expand Up @@ -383,7 +384,8 @@ try {
Write-Warning "The specified TestApplicationId '$TestApplicationId' will be ignored when -ServicePrincipalAutth is not set."
}

$userAccount = (Get-AzADUser -UserPrincipalName (Get-AzContext).Account)
# Use -Mail as the lookup works in both corp and TME tenants
$userAccount = (Get-AzADUser -Mail (Get-AzContext).Account)
$TestApplicationOid = $userAccount.Id
$TestApplicationId = $testApplicationOid
$userAccountName = $userAccount.UserPrincipalName
Expand Down

0 comments on commit 1e4ec29

Please sign in to comment.