Skip to content

Commit 792a280

Browse files
committed
fix repeated warning regarding conf client scopes
1 parent 7d88add commit 792a280

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/internal/Confirm-ModuleAuthentication.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ function Confirm-ModuleAuthentication {
9090
}
9191
}
9292
else {
93-
Write-Warning 'Using a confidential client is non-interactive and requires that the necessary scopes/permissions be added to the application or have permissions on-behalf-of a user.'
93+
if (!$script:ConnectState.MsGraphToken) {
94+
Write-Warning 'Using a confidential client is non-interactive and requires that the necessary scopes/permissions be added to the application or have permissions on-behalf-of a user.'
95+
}
9496
$Stopwatch = [System.Diagnostics.Stopwatch]::StartNew()
9597
try {
9698
$MsGraphToken = Get-MsalToken -ConfidentialClientApplication $ClientApplication -Scopes ([IO.Path]::Combine($script:mapMgEnvironmentToMgEndpoint[$CloudEnvironment], '.default')) -CorrelationId $CorrelationId -Verbose:$false -ErrorAction Stop

0 commit comments

Comments
 (0)