GraphConnectionHelper.psm1
|
function start-GraphConnectionHelper { <# .SYNOPSIS This module serves as a wrapper to implement connections to Microsoft Graph through supported authentication methods. .DESCRIPTION Trigger function to start connection / authentication to Microsoft Graph. .PARAMETER LOGFOLDERPATH *Required* This is the location of the log file. .PARAMETER ALLOWTELEMETRYCOLLECTION *Optional* Allows the submission of telemetry collection data. .OUTPUTS Logs all activity to the log folder / file created by the module .NOTES The following blog posts maintain documentation regarding this module. https://timmcmic.wordpress.com. .EXAMPLE Start-DistributionListMigration -groupSMTPAddress $groupSMTPAddress -globalCatalogServer server.domain.com -activeDirectoryCredential $cred -logfolderpath c:\temp -dnNoSyncOU "OU" -exchangeOnlineCredential $cred -azureADCredential $cred #> [CmdletBinding()] param ( [Parameter(Mandatory = $true)] [string]$logFolderPath, [Parameter(Mandatory = $false)] [boolean]$allowTelemetryCollection=$TRUE, [Parameter(Mandatory = $true, ParameterSetName = "Interactive")] [string]$msGraphEnvironmentName, [Parameter(Mandatory = $true, ParameterSetName = "Interactive")] [string]$msGraphTenantID, [Parameter(Mandatory = $true, ParameterSetName = "Interactive")] [string]$msGraphScopesRequired ) #Initialize telemetry collection. $appInsightAPIKey = "63d673af-33f4-401c-931e-f0b64a218d89" $traceModuleName = "GraphConnectionHelper" if ($allowTelemetryCollection -eq $TRUE) { start-telemetryConfiguration -allowTelemetryCollection $allowTelemetryCollection -appInsightAPIKey $appInsightAPIKey -traceModuleName $traceModuleName -errorAction STOP } $telemetryStartTime = get-universalDateTime #Start time for telemetry evaluation $telemetryEventName = "Start-GraphConnectionHelper" #Create the log file. new-logFile -logFolderPath $logFolderPath out-logfile -string "************************************************************" out-logfile -string 'Starting GraphConnectionHelper' out-logfile -string "************************************************************" out-logfile -string "Testing that all graph versions are up to date." test-msGraphVersions } |