new-msGraphConnection.ps1
|
function new-msGraphConnection { Param ( #Define other mandatory parameters [Parameter(Mandatory = $true)] $msGraphHashTable, [Parameter(Mandatory = $true)] $exportFile ) out-logfile -string "Entering new-msGraphConnection" $msGraphInteractive = "Interactive" $msGraphCertificate = "Certificate" $msGraphClientSecret = "ClientSecret" $msGraphContext = $null switch ($msGraphhashTable.msGraphAuthenticationType) { $msGraphInteractive { out-logfile -string "Graph interactive authentication specified." new-msGraphInteractive -msGraphHashTable $msGraphHashTable } $msGraphCertificate { out-logfile -string "Graph certificate authentication specified." new-msGraphCertificate -msGraphHashTable $msGraphHashTable } $msGraphClientSecret { out-logfile -string "Graph client secret authentication specified." new-msGraphClientSecret -msGraphHashTable $msGraphHashTable } } out-logfile -string "Record MGContext" $msGraphContext = output-MGContext -exportFile $exportFile out-logfile -string "Validate MSGraph Scopes" verify-msGraphScopes -context $msGraphContext -scope $msGraphHashTable.msGraphScopes out-logfile -string "Exiting new-msGraphConnection" } |