Skip to content

Commit

Permalink
fix repeated warning regarding conf client scopes
Browse files Browse the repository at this point in the history
  • Loading branch information
jazuntee committed Jan 27, 2023
1 parent 792a280 commit 80f2d1d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/Connect-AADAssessment.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ function Connect-AADAssessment {
}
$script:ConnectState.CloudEnvironment = $CloudEnvironment

if ($script:ConnectState.ClientApplication -is [Microsoft.Identity.Client.IConfidentialClientApplication]) {
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.'
}
Confirm-ModuleAuthentication $script:ConnectState.ClientApplication -CloudEnvironment $script:ConnectState.CloudEnvironment -User $User -CorrelationId $script:AppInsightsRuntimeState.OperationStack.Peek().Id -ErrorAction Stop
#Get-MgContext
#Get-AzureADCurrentSessionInfo
Expand Down
3 changes: 0 additions & 3 deletions src/internal/Confirm-ModuleAuthentication.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@ function Confirm-ModuleAuthentication {
}
}
else {
if (!$script:ConnectState.MsGraphToken) {
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.'
}
$Stopwatch = [System.Diagnostics.Stopwatch]::StartNew()
try {
$MsGraphToken = Get-MsalToken -ConfidentialClientApplication $ClientApplication -Scopes ([IO.Path]::Combine($script:mapMgEnvironmentToMgEndpoint[$CloudEnvironment], '.default')) -CorrelationId $CorrelationId -Verbose:$false -ErrorAction Stop
Expand Down

0 comments on commit 80f2d1d

Please sign in to comment.