Private/Auth/Test-GraphConnection.ps1
|
# Copyright (c) 2026 Sandy Zeng. All rights reserved. # Source-available. All rights reserved. See LICENSE file. <# Test-GraphConnection.ps1 — Returns whether an active Graph sign-in exists. Author: Sandy Zeng Project: IntuneDiff Version History: 1.0.0 Initial release. 2.0.0 No longer depends on Microsoft.Graph.Authentication. #> function Test-GraphConnection { <# .SYNOPSIS Returns $true if there is a current signed-in Graph account with an access token. #> [CmdletBinding()] [OutputType([bool])] param() if (-not $script:GraphCurrent) { return $false } if (-not $script:GraphAccounts) { return $false } return [bool]$script:GraphAccounts[$script:GraphCurrent] } |