You are developing a C# console application that will run on multiple Azure Virtual Machines. The application must authenticate to the Microsoft Identity Platform and access Microsoft Graph using a managed identity. Because the application runs on multiple virtual machines, they must all share the same managed identity. You use MSAL.NET to implement the authentication code. You write the following code:
csharp
string clientId = "00000000-0000-0000-0000-000000000000";
string resource = "https://graph.microsoft.com";
// Initialize the managed identity application
IManagedIdentityApplication app = [Snippet 1]
.Build();
// Acquire the token
AuthenticationResult result = await app.[Snippet 2]
.ExecuteAsync();
Which two code segments should you use to complete the implementation? (Select two.)
- ManagedIdentityApplicationBuilder.Create(ManagedIdentityId.WithUserAssignedClientId(clientId))Cevap
- AcquireTokenForManagedIdentity(resource)Cevap
- CManagedIdentityApplicationBuilder.Create(ManagedIdentityId.SystemAssigned)
- DAcquireTokenForClient(new string[] { resource })