Skip to content

Commit 80f2d1d

Browse files
committed
fix repeated warning regarding conf client scopes
1 parent 792a280 commit 80f2d1d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Connect-AADAssessment.ps1

+3
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ function Connect-AADAssessment {
6868
}
6969
$script:ConnectState.CloudEnvironment = $CloudEnvironment
7070

71+
if ($script:ConnectState.ClientApplication -is [Microsoft.Identity.Client.IConfidentialClientApplication]) {
72+
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.'
73+
}
7174
Confirm-ModuleAuthentication $script:ConnectState.ClientApplication -CloudEnvironment $script:ConnectState.CloudEnvironment -User $User -CorrelationId $script:AppInsightsRuntimeState.OperationStack.Peek().Id -ErrorAction Stop
7275
#Get-MgContext
7376
#Get-AzureADCurrentSessionInfo

src/internal/Confirm-ModuleAuthentication.ps1

-3
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,6 @@ function Confirm-ModuleAuthentication {
9090
}
9191
}
9292
else {
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-
}
9693
$Stopwatch = [System.Diagnostics.Stopwatch]::StartNew()
9794
try {
9895
$MsGraphToken = Get-MsalToken -ConfidentialClientApplication $ClientApplication -Scopes ([IO.Path]::Combine($script:mapMgEnvironmentToMgEndpoint[$CloudEnvironment], '.default')) -CorrelationId $CorrelationId -Verbose:$false -ErrorAction Stop

0 commit comments

Comments
 (0)