Skip to content

Error: Authentication needed, call Connect-Graph #522

@michaeltheyeti

Description

@michaeltheyeti

Executing the following within an HTTP Triggered Azure Function App

The astericks are just placeholders.

Connect-Graph -CertificateThumbprint ****** -ClientId ******* -TenantId *******

Get-MgContext

Send-MgUserMail -UserId ******** -BodyParameter ********

Disconnect-Graph

The code works in the ISE but not in the Azure Function App

Here is the majority error I'm receiving:
2021-01-28T05:31:11.086 [Error] ERROR: Authentication needed, call Connect-Graph.Exception :Type : System.Security.Authentication.AuthenticationExceptionTargetSite :Name : GetGraphHttpClientDeclaringType : Microsoft.Graph.PowerShell.Authentication.Helpers.HttpHelpersMemberType : MethodModule : Microsoft.Graph.Authentication.dllStackTrace :at Microsoft.Graph.PowerShell.Authentication.Helpers.HttpHelpers.GetGraphHttpClient(IAuthContext authContext)at Microsoft.Graph.PowerShell.Module.BeforeCreatePipeline(InvocationInfo invocationInfo, HttpPipeline& pipeline)at Microsoft.Graph.PowerShell.Module.CreatePipeline(InvocationInfo invocationInfo, String parameterSetName)at Microsoft.Graph.PowerShell.Cmdlets.SendMgUserMail_Send.ProcessRecordAsync()Message : Authentication needed, call Connect-Graph.Source : Microsoft.Graph.AuthenticationHResult : -2146233087CategoryInfo : NotSpecified: (:) [Send-MgUserMail_Send], AuthenticationExceptionFullyQualifiedErrorId : Microsoft.Graph.PowerShell.Cmdlets.SendMgUserMail_SendInvocationInfo :MyCommand : Send-MgUserMail_SendScriptLineNumber : 139OffsetInLine : 13HistoryId : 1ScriptName : D:\home\site\wwwroot\CycleAppService\run.ps1Line : PositionMessage : At D:\home\site\wwwroot\CycleAppService\run.ps1:139 char:13+ Send-MgUserMail -UserId 'c1f70acf-2564-4d6c-ab76-6c1e6dca …+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~PSScriptRoot : D:\home\site\wwwroot\CycleAppServicePSCommandPath : D:\home\site\wwwroot\CycleAppService\run.ps1InvocationName : Send-MgUserMailCommandOrigin : InternalScriptStackTrace : at Send-MgUserMail, D:\home\data\ManagedDependencies\210128051629338.r\Microsoft.Graph.Users.Actions\1.2.0\exports\v1.0\ProxyCmdletDefinitions.ps1: line 17071at , D:\home\site\wwwroot\CycleAppService\run.ps1: line 139PipelineIterationInfo :Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcException : Result: ERROR: Authentication needed, call Connect-Graph.Exception :Type : System.Security.Authentication.AuthenticationExceptionTargetSite :Name : GetGraphHttpClientDeclaringType : Microsoft.Graph.PowerShell.Authentication.Helpers.HttpHelpersMemberType : MethodModule : Microsoft.Graph.Authentication.dllStackTrace :at Microsoft.Graph.PowerShell.Authentication.Helpers.HttpHelpers.GetGraphHttpClient(IAuthContext authContext)at Microsoft.Graph.PowerShell.Module.BeforeCreatePipeline(InvocationInfo invocationInfo, HttpPipeline& pipeline)at Microsoft.Graph.PowerShell.Module.CreatePipeline(InvocationInfo invocationInfo, String parameterSetName)at Microsoft.Graph.PowerShell.Cmdlets.SendMgUserMail_Send.ProcessRecordAsync()Message : Authentication needed, call Connect-Graph.Source : Microsoft.Graph.AuthenticationHResult : -2146233087CategoryInfo : NotSpecified: (:) [Send-MgUserMail_Send], AuthenticationExceptionFullyQualifiedErrorId : Microsoft.Graph.PowerShell.Cmdlets.SendMgUserMail_SendInvocationInfo :MyCommand : Send-MgUserMail_SendScriptLineNumber : 139OffsetInLine : 13HistoryId : 1ScriptName : D:\home\site\wwwroot\CycleAppService\run.ps1Line

It appears that whatever fix was put in place for 'Authentication needed, call Connect-Graph' isn't working yet.
AB#7835

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions