Microsoft Entra Agent ID
Developer

Call Api Microsoft Graph

In brief

The documentation adds an OpenID Connect using directive and renames two C# sample variables: `applications` to `applicationsForUser` and `me` to `meByOid`.

What Entra admins need to know

Administrators using these samples should use the revised code. No product behavior or configuration change is indicated.

This editorial summary was generated by AI from the documentation changes. Verify important details in the full Microsoft Learn article.

Documentation change

The comparison below shows only the changed extract. Use the full-page view for complete context.

  1. Add the support for Microsoft Graph and agent identities in your service collection.

    using Microsoft.AspNetCore.Authentication.OpenIdConnect;
    using Microsoft.Identity.Web;
    
    var builder = WebApplication.CreateBuilder(args);
          }));
    
      // Call Microsoft Graph APIs with the agent identity for on-behalf of user scenario
      var applicationsapplicationsForUser = await graphServiceClient.Applications
          .GetAsync(r => r.Options.WithAuthenticationOptions(options =>
          {
              options.WithAgentIdentity(agentIdentity);
    
        // Or using OID
        string userOid = "user-object-id";
        var memeByOid = await graphServiceClient.Me
            .GetAsync(r => r.Options.WithAuthenticationOptions(options =>
                options.WithAgentUserIdentity(agentIdentity, userOid)));
        ```
    
Daily Entra.News

Get daily email updates

Get a concise summary of the latest Microsoft Entra updates delivered straight to your inbox.

Loading the secure signup form…