Skip to content

[Bug] ArgumentNullException for keyChainServiceName and attributeKey1 when using MSAL on macOS and Linux with Power Platform MCP Server #5378

@farisnanosoft

Description

@farisnanosoft

Library version used

Microsoft.Identity.Client, Microsoft.Identity.Client.Extensions.Msal - 4.73.1, Microsoft.PowerPlatform.Dataverse.MCP - 0.2.310025

.NET version

Net 8

Scenario

Other - please specify

Issue description and reproduction steps

Hi team,

I'm encountering issues using Microsoft.Identity.Client.Extensions.Msal via the Microsoft.PowerPlatform.Dataverse.MCP tool on macOS and Linux environments.

While following this Microsoft documentation to connect to Dataverse using MCP Server:
https://learn.microsoft.com/en-us/power-apps/maker/data-platform/data-platform-mcp

The tool fails during the authentication step with MSAL, throwing an exception related to missing keyChainServiceName (macOS) or attributeKey1 (Linux). This occurs both when using:

  • Visual Studio Code
  • CLI / Standalone Microsoft.PowerPlatform.Dataverse.MCP
  • On both macOS and Linux platforms

Could you please help here if I've to do any extra configuration apart from what is mentioned in the guide. Is this a known issue? Posting here since Microsoft.Identity.Client related error.

  • Tried from both claude desktop and vscode as well as running Microsoft.PowerPlatform.Dataverse.MCP standalone, same below error is thrown.
  • Using latest Microsoft.PowerPlatform.Dataverse.MCP available in nuget. Tried with latest dll of MSAL in the nuget package as well.

Microsoft.Identity.Client, Microsoft.Identity.Client.Extensions.Msal - 4.70.2/4.73.1, Microsoft.PowerPlatform.Dataverse.MCP - 0.2.310025

Error from macOS:

2025-07-11 09:37:06.101 [info] Connection state: Running
2025-07-11 09:37:08.371 [warning] [server stderr] Unhandled exception. System.ArgumentNullException: Value cannot be null. (Parameter 'keyChainServiceName')
2025-07-11 09:37:08.371 [warning] [server stderr]    at Microsoft.Identity.Client.Extensions.Msal.MacKeychainAccessor..ctor(String cacheFilePath, String keyChainServiceName, String keyChainAccountName, TraceSourceLogger logger)
2025-07-11 09:37:08.371 [warning] [server stderr]    at Microsoft.Identity.Client.Extensions.Msal.Storage.Create(StorageCreationProperties creationProperties, TraceSource logger)
2025-07-11 09:37:08.371 [warning] [server stderr]    at Microsoft.Identity.Client.Extensions.Msal.MsalCacheHelper..ctor(StorageCreationProperties storageCreationProperties, TraceSource logger, HashSet`1 knownAccountIds, FileSystemWatcher cacheWatcher)
2025-07-11 09:37:08.371 [warning] [server stderr]    at Microsoft.Identity.Client.Extensions.Msal.MsalCacheHelper.CreateAsync(StorageCreationProperties storageCreationProperties, TraceSource logger)
2025-07-11 09:37:08.371 [warning] [server stderr]    at PowerPlatformMCPProxy.Auth.AuthenticationService.GetMsalClient() in C:\__w\1\s\src\MCPServers\PowerPlatformMCPProxy\Auth\AuthenticationService.cs:line 95
2025-07-11 09:37:08.371 [warning] [server stderr]    at PowerPlatformMCPProxy.Auth.AuthenticationService..ctor(ILoggerFactory loggerFactory, String[] scopes, ConfigOptions configOptions, String environmentId, String cacheName, String clientId) in C:\__w\1\s\src\MCPServers\PowerPlatformMCPProxy\Auth\AuthenticationService.cs:line 35
2025-07-11 09:37:08.371 [warning] [server stderr]    at PowerPlatformMCPProxy.Auth.AuthenticationServiceFactory.GetAuthenticationService(ILoggerFactory loggerFactory, String[] scopes, String environmentId, String cacheName, String clientId) in C:\__w\1\s\src\MCPServers\PowerPlatformMCPProxy\Auth\AuthenticationServiceFactory.cs:line 19
2025-07-11 09:37:08.371 [warning] [server stderr]    at CMSClient..ctor(IHttpClientFactory httpClientFactory, ILoggerFactory loggerFactory, IHTTPLogger httpLogger, IAuthenticationServiceFactory authenticationServiceFactory, UrlConnectionDetails connectionDetails, ConfigOptions options, IRequestMessageBuilder requestMessageBuilder) in C:\__w\1\s\src\MCPServers\PowerPlatformMCPProxy\Clients\CMSClient.cs:line 31
2025-07-11 09:37:08.371 [warning] [server stderr]    at CMSClientFactory.GetCMSClient(IHttpClientFactory httpClientFactory, ILoggerFactory loggerFactory, IHTTPLogger httpLogger, IAuthenticationServiceFactory authenticationServiceFactory, UrlConnectionDetails connectionDetails, ConfigOptions options, IRequestMessageBuilder requestMessageBuilder) in C:\__w\1\s\src\MCPServers\PowerPlatformMCPProxy\Clients\CMSClientFactory.cs:line 19
2025-07-11 09:37:08.372 [warning] [server stderr]    at PowerPlatformMCPProxy.Runtime.MCPServerProxy.RunAsync() in C:\__w\1\s\src\MCPServers\PowerPlatformMCPProxy\Runtime\MCPServerProxy.cs:line 60
2025-07-11 09:37:08.372 [warning] [server stderr]    at Program.<Main>$(String[] args) in C:\__w\1\s\src\MCPServers\PowerPlatformMCPProxy\Program.cs:line 35
2025-07-11 09:37:08.372 [warning] [server stderr]    at Program.<Main>(String[] args

Error from linux:

Unhandled exception. System.ArgumentNullException: Value cannot be null. (Parameter 'attributeKey1')
   at Microsoft.Identity.Client.Extensions.Msal.LinuxKeyringAccessor..ctor(String cacheFilePath, String keyringCollection, String keyringSchemaName, String keyringSecretLabel, String attributeKey1, String attributeValue1, String attributeKey2, String attributeValue2, TraceSourceLogger logger)
   at Microsoft.Identity.Client.Extensions.Msal.Storage.Create(StorageCreationProperties creationProperties, TraceSource logger)
   at Microsoft.Identity.Client.Extensions.Msal.MsalCacheHelper..ctor(StorageCreationProperties storageCreationProperties, TraceSource logger, HashSet`1 knownAccountIds, FileSystemWatcher cacheWatcher)
   at Microsoft.Identity.Client.Extensions.Msal.MsalCacheHelper.CreateAsync(StorageCreationProperties storageCreationProperties, TraceSource logger)
   at PowerPlatformMCPProxy.Auth.AuthenticationService.GetMsalClient() in C:\__w\1\s\src\MCPServers\PowerPlatformMCPProxy\Auth\AuthenticationService.cs:line 95
   at PowerPlatformMCPProxy.Auth.AuthenticationService..ctor(ILoggerFactory loggerFactory, String[] scopes, ConfigOptions configOptions, String environmentId, String cacheName, String clientId) in C:\__w\1\s\src\MCPServers\PowerPlatformMCPProxy\Auth\AuthenticationService.cs:line 35
   at PowerPlatformMCPProxy.Auth.AuthenticationServiceFactory.GetAuthenticationService(ILoggerFactory loggerFactory, String[] scopes, String environmentId, String cacheName, String clientId) in C:\__w\1\s\src\MCPServers\PowerPlatformMCPProxy\Auth\AuthenticationServiceFactory.cs:line 19
   at CMSClient..ctor(IHttpClientFactory httpClientFactory, ILoggerFactory loggerFactory, IHTTPLogger httpLogger, IAuthenticationServiceFactory authenticationServiceFactory, UrlConnectionDetails connectionDetails, ConfigOptions options, IRequestMessageBuilder requestMessageBuilder) in C:\__w\1\s\src\MCPServers\PowerPlatformMCPProxy\Clients\CMSClient.cs:line 31
   at CMSClientFactory.GetCMSClient(IHttpClientFactory httpClientFactory, ILoggerFactory loggerFactory, IHTTPLogger httpLogger, IAuthenticationServiceFactory authenticationServiceFactory, UrlConnectionDetails connectionDetails, ConfigOptions options, IRequestMessageBuilder requestMessageBuilder) in C:\__w\1\s\src\MCPServers\PowerPlatformMCPProxy\Clients\CMSClientFactory.cs:line 19
   at PowerPlatformMCPProxy.Runtime.MCPServerProxy.RunAsync() in C:\__w\1\s\src\MCPServers\PowerPlatformMCPProxy\Runtime\MCPServerProxy.cs:line 60
   at Program.<Main>$(String[] args) in C:\__w\1\s\src\MCPServers\PowerPlatformMCPProxy\Program.cs:line 35
   at Program.<Main>(String[] args)
Aborted (core dumped)

Relevant code snippets

Expected behavior

No response

Identity provider

Microsoft Entra ID (Work and School accounts and Personal Microsoft accounts)

Regression

No response

Solution and workarounds

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions