start-graphConnectionInteractive.ps1
|
function start-GraphConnectionInteractive { [cmdletbinding()] Param ( [Parameter(Mandatory = $true)] [string]$msGraphTenantID, [Parameter(Mandatory = $true)] [string]$msGraphEnvironmentName, [Parameter(Mandatory = $true)] [array]$msGraphScopesRequired ) out-logfile -string "Entering start-GraphConnectionInteractive" try { connect-MGGraph -TenantId $msGraphTenantID -Scopes $msGraphScopesRequired -Environment $msGraphEnvironmentName -ErrorAction Stop out-logfile -string "Graph connection established successfully." } catch { out-logfile -string "Unable to establish a connection to Microsoft Graph." out-logfile -string $_ -isError:$TRUE } out-logfile -string "Exiting start-GraphConnectionInteractive" } |