Microsoft Entra Agent ID
Security

Call Api Azure Services

In brief

The documentation updates its C# examples, separating app-only, on-behalf-of-user, and user-identification scenarios. Samples now configure agent identity options and pass the credential to the Blob client correctly.

What Entra admins need to know

This improves implementation guidance for administrators and developers using the existing Agent ID documentation. No product launch or administrative action 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. Configure your services to add Azure token credential support:

    using Microsoft.AspNetCore.Authentication.OpenIdConnect;
    using Microsoft.Identity.Web;
    
    var builder = WebApplication.CreateBuilder(args);
            }
    
            // Call Azure service with the agent identity for app only scenario
            public async Task<List<string>> ListBlobsForAgentAsync(ListBlobsForAgentAppOnlyAsync(string agentIdentity)
            {
                // Configure for agent identity
                string agentIdentity = "agent-identity-guid";
                _credential.Options.WithAgentIdentity(agentIdentity);
                _credential.Options.RequestAppToken = true;
    
            }
    
            // Call Azure service with the agent identity for on-behalf of user scenario
            public async Task<List<string>> ListBlobsForAgentAsync(ListBlobsForAgentOnBehalfOfUserAsync(string agentIdentity)
            {
                // Configure for agent identity
                _credential.Options.WithAgentIdentity(agentIdentity);
                _credential.Options.RequestAppToken = false;
    
                var blobClient = new BlobServiceClient(
                    new Uri("https://myaccount.blob.core.windows.net")),
                    _credential);
    
                var container = blobClient.GetBlobContainerClient("agent-data");
                var blobs = new List<string>();
            }
    
            // Use object ID to identify the agent's user account
            public async Task<List<string>> ListBlobsForAgentAsync(ListBlobsForAgentUserByOidAsync(string agentIdentity)
            {
                // Configure for agent identity
                string agentIdentity = "agent-identity-guid";
                string userOid = "user-object-id";
                _credential.Options.WithAgentUserIdentity(agentIdentity, userOid);
    
                return blobs;
            }
    
            // Use UPN to identify the agent's user account\account
            public async Task<List<string>> ListBlobsForAgentAsync(ListBlobsForAgentUserByUpnAsync(string agentIdentity)
            {
                // Configure for agent identity
                string agentIdentity = "agent-identity-guid";
                string userUpn = "[email protected]";
    
                _credential.Options.WithAgentUserIdentity(agentIdentity, userUpn);
    
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…