Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update PSIntuneAuth.psm1 #57

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Modules/PSIntuneAuth/PSIntuneAuth.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ function Get-MSIntuneAuthToken {
# Check if multiple modules exist and determine the module path for the most current version
if (($AzureADModules | Measure-Object).Count -gt 1) {
$LatestAzureADModule = ($AzureADModules | Select-Object -Property Version | Sort-Object)[-1]
$AzureADModulePath = $AzureADModules | Where-Object { $_.Version -like $LatestAzureADModule.Version } | Select-Object -ExpandProperty ModuleBase
$AzureADModulePath = $AzureADModules | Where-Object { $_.Version -like $LatestAzureADModule.Version } | Select-Object -First 1 -ExpandProperty ModuleBase
}
else {
$AzureADModulePath = $AzureADModules | Select-Object -ExpandProperty ModuleBase
Expand Down Expand Up @@ -206,7 +206,7 @@ function Get-MSIntuneAuthToken {
"AuthPrompt" {
# Acquire access token
Write-Verbose -Message "Attempting to acquire access token using user delegation"
$AuthenticationResult = ($AuthenticationContext.AcquireTokenAsync($Resource, $ClientID, $RedirectUri, $PlatformParams)).Result
$AuthenticationResult = ($AuthenticationContext.AcquireTokenAsync($Resource, $ClientID, $RedirectUri, $PlatformParams)).Status
}
"AuthCredential" {
# Construct required identity model user password credential
Expand All @@ -222,7 +222,7 @@ function Get-MSIntuneAuthToken {
$ClientCredential = New-Object -TypeName "Microsoft.IdentityModel.Clients.ActiveDirectory.ClientCredential" -ArgumentList ($ClientID, $ClientSecret) -ErrorAction Stop

# Acquire access token
$AuthenticationResult = ($AuthenticationContext.AcquireTokenAsync($Resource, $ClientCredential)).Result
$AuthenticationResult = ($AuthenticationContext.AcquireTokenAsync($Resource, $ClientCredential)).Status
}
}

Expand Down Expand Up @@ -371,4 +371,4 @@ function Set-MSIntuneAdminConsent {
catch [System.Exception] {
Write-Warning -Message "Unable to load required assemblies (Azure AD PowerShell module) to construct an authentication token. Error: $($_.Exception.Message)" ; break
}
}
}