microsoftgraph / microsoftgraph/msgraph-sdk-powershell

Graph-MgConnect error: Entry point was not found. Powershell 7.5.0

Open
#3,133 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feedback Needs: Attention :wave: type:bug
Dominant language
C#
Stars
898
Forks
230
Avg merge
2d 5h
Merged PRs (30d)
31

Description

Describe the bug

I have a strange behavior using graph api. If i run a script through Visual Studio Code and Powershell extantion all works well but if i schedule the same script with task scheduler i get the entry point not found error.
I'm using powershell 7.5.0 for both Visual Studio Code and task scheduler execution. I have a lot of script run with task scheduler and all have the same issue.
As installed module i have only Graph module, MSAL.PS and SimplySql

This is the action configured on task scheduler:
Program/script: "C:\Program Files\PowerShell\7\pwsh.exe"
Add Arguments: -ExecutionPolicy Bypass -File "C:\script\test.ps1"

The execution policy is set to RemoteSign for both LocalMachine and CurrentUser

Expected behavior

If script execution works in visual studio code than it should also work with task scheduler

How to reproduce

schedule script with task scheduler

SDK Version

2.25.0

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output
Click to expand log ```

PowerShell transcript start
Start time: 20250214192336
Username: CORPABSTR....
RunAs User: CORPABSTR....
Configuration Name:
Machine: ABS-DC2 (Microsoft Windows NT 10.0.14393.0)
Host Application: C:\Program Files\PowerShell\7\pwsh.dll -ExecutionPolicy Bypass -File C:\script\RenewConsultants\RenewConsultants.ps1
Process ID: 7048
PSVersion: 7.5.0
PSEdition: Core
GitCommitId: 7.5.0
OS: Microsoft Windows 10.0.14393
Platform: Win32NT
PSCompatibleVersions: 1.0, 2.0, 3.0, 4.0, 5.0, 5.1, 6.0, 7.0
PSRemotingProtocolVersion: 2.3
SerializationVersion: 1.1.0.1
WSManStackVersion: 3.0


Transcript started, output file is C:\script\RenewConsultants\logs\transcript.txt
DEBUG: ClientCertificateCredential.GetToken invoked. Scopes: [ https://graph.microsoft.com/.default ] ParentRequestId:
DEBUG: False MSAL 4.66.1.0 MSAL.NetCore .NET 9.0.1 Microsoft Windows 10.0.14393 [2025-02-14 18:23:36Z - 922e791c-3626-46c6-ae91-aaadc725a01d] MSAL MSAL.NetCore with assembly version '4.66.1.0'. CorrelationId(922e791c-3626-46c6-ae91-aaadc725a01d)
DEBUG: False MSAL 4.66.1.0 MSAL.NetCore .NET 9.0.1 Microsoft Windows 10.0.14393 [2025-02-14 18:23:36Z - 922e791c-3626-46c6-ae91-aaadc725a01d] === AcquireTokenForClientParameters ===
SendX5C: False
ForceRefresh: False
DEBUG: False MSAL 4.66.1.0 MSAL.NetCore .NET 9.0.1 Microsoft Windows 10.0.14393 [2025-02-14 18:23:36Z - 922e791c-3626-46c6-ae91-aaadc725a01d]
=== Request Data ===
Authority Provided? - True
Scopes - https://graph.microsoft.com/.default
Extra Query Params Keys (space separated) -
ApiId - AcquireTokenForClient
IsConfidentialClient - True
SendX5C - False
LoginHint ? False
IsBrokerConfigured - False
HomeAccountId - False
CorrelationId - 922e791c-3626-46c6-ae91-aaadc725a01d
UserAssertion set: False
LongRunningOboCacheKey set: False
Region configured:
DEBUG: False MSAL 4.66.1.0 MSAL.NetCore .NET 9.0.1 Microsoft Windows 10.0.14393 [2025-02-14 18:23:36Z - 922e791c-3626-46c6-ae91-aaadc725a01d] === Token Acquisition (ClientCredentialRequest) started:
Scopes: https://graph.microsoft.com/.default
Authority Host: login.microsoftonline.com
DEBUG: False MSAL 4.66.1.0 MSAL.NetCore .NET 9.0.1 Microsoft Windows 10.0.14393 [2025-02-14 18:23:36Z] [Internal cache] Clearing app token cache accessor.
DEBUG: False MSAL 4.66.1.0 MSAL.NetCore .NET 9.0.1 Microsoft Windows 10.0.14393 [2025-02-14 18:23:36Z - 922e791c-3626-46c6-ae91-aaadc725a01d] [Internal cache] Total number of cache partitions found while getting access tokens: 0
DEBUG: False MSAL 4.66.1.0 MSAL.NetCore .NET 9.0.1 Microsoft Windows 10.0.14393 [2025-02-14 18:23:36Z - 922e791c-3626-46c6-ae91-aaadc725a01d] [FindAccessTokenAsync] Discovered 0 access tokens in cache using partition key: d18e5660-6c3a-4084-8952-8ecc666c5592_5f4c80c0-58ee-4e80-8990-b80e85ad9e5b_AppTokenCache
DEBUG: False MSAL 4.66.1.0 MSAL.NetCore .NET 9.0.1 Microsoft Windows 10.0.14393 [2025-02-14 18:23:36Z - 922e791c-3626-46c6-ae91-aaadc725a01d] [Instance Discovery] Instance discovery is enabled and will be performed
DEBUG: False MSAL 4.66.1.0 MSAL.NetCore .NET 9.0.1 Microsoft Windows 10.0.14393 [2025-02-14 18:23:36Z - 922e791c-3626-46c6-ae91-aaadc725a01d] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.66.1.0 MSAL.NetCore .NET 9.0.1 Microsoft Windows 10.0.14393 [2025-02-14 18:23:36Z - 922e791c-3626-46c6-ae91-aaadc725a01d] Fetching instance discovery from the network from host login.microsoftonline.com.
DEBUG: Request [2a3c206e-8648-4401-815c-61718aa5c0f1] GET https://login.microsoftonline.com/common/discovery/instance?api-version=1.1&authorization_endpoint=REDACTED
x-client-SKU:REDACTED
x-client-Ver:REDACTED
x-client-OS:REDACTED
client-request-id:REDACTED
return-client-request-id:REDACTED
x-ms-client-request-id:2a3c206e-8648-4401-815c-61718aa5c0f1
x-ms-return-client-request-id:true
User-Agent:azsdk-net-Identity/1.13.1 (.NET 9.0.1; Microsoft Windows 10.0.14393)
client assembly: Azure.Identity
Connect-MgGraph: C:\script\RenewConsultants\RenewConsultants.ps1:731
Line |
731 | Connect-MgGraph -ClientID $microsoftGraph.appID -TenantId $micros …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Entry point was not found.
Connect-MgGraph: C:\script\RenewConsultants\RenewConsultants.ps1:731
Line |
731 | Connect-MgGraph -ClientID $microsoftGraph.appID -TenantId $micros …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Entry point was not found.


PowerShell transcript end
End time: 20250214192337


</details>


### Configuration

$PSVersionTable output:
Name                           Value
----                           -----
PSVersion                      7.5.0
PSEdition                      Core
GitCommitId                    7.5.0
OS                             Microsoft Windows 10.0.14393
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

OS Version:
Edition: Windows Server 2016
Version: 1607
OS Build: 14393.7785

Architecture:
x64

### Other information

_No response_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing Connect-MgGraph from C:\script\RenewConsultants\RenewConsultants.ps1 line 731 under Task Scheduler and compare it with the Visual Studio Code run. Inspect the Graph SDK 2.25.0 and MSAL dependency-loading behavior on PowerShell 7.5.0 and Windows Server 2016. Done means identifying the cause of the missing entry point and providing a verified fix or compatibility guidance.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
api, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.