Azure / Azure/azure-functions-host
ClientSecretCredential authentication failed: Expression of type 'System.Diagnostics.Activity' cannot be used for return type 'System.Diagnostics.Activity'
- Dominant language
- C#
- Stars
- 2k
- Forks
- 482
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 36
Description
#### Investigative information
Please provide the following:
I am currently developing the Azure function on localhost. Getting this error while executing any MS graph calls: ClientSecretCredential authentication failed: Expression of type 'System.Diagnostics.Activity' cannot be used for return type 'System.Diagnostics.Activity'
Please check the source code attached below for more details.
- Timestamp:
- Function App version: V3
- Function App name:
- Function name(s) (as appropriate):
- Invocation ID:
- Region:
#### Repro steps
1. Create a new Azure functions project in VS.
2. Create MS graph client using Azure AD application : https://learn.microsoft.com/en-us/graph/sdks/choose-authentication-providers?tabs=CS#client-credentials-provider
3. Make any MS graph API call.
#### Expected behavior
Expected behavior is MS graph API calls should succeed.
#### Actual behavior
Getting this error : ClientSecretCredential authentication failed: Expression of type 'System.Diagnostics.Activity' cannot be used for return type 'System.Diagnostics.Activity'
#### Known workarounds
Provide a description of any known workarounds.
NA
#### Related information
Provide any related information
* Programming language used : C#
* Links to source
* Bindings used
Source
```csharp
private static void callMsGraphClient()
{
var scopes = new[] { "https://graph.microsoft.com/.default" };
var tenantId = "";
var clientId = "";
var clientSecret = "";
var options = new TokenCredentialOptions
{
AuthorityHost = AzureAuthorityHosts.AzurePublicCloud
};
var clientSecretCredential = new ClientSecretCredential(
tenantId, clientId, clientSecret, options);
var graphClient = new GraphServiceClient(clientSecretCredential, scopes);
var users = await graphClient.Users.GetAsync();
}
```
```csharp
net472
v3
```
Contributor guide
Research direction
Start with the callMsGraphClient reproduction and the listed .NET Framework 4.7.2, Azure Functions v3, Azure.Core, Azure.Identity, and Microsoft.Graph package versions. Reproduce a Graph call locally, then trace the authentication failure across the Functions host and dependency versions. Done means the call succeeds without the System.Diagnostics.Activity return-type error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp
- Domain
- backend, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100