I have tried to create MSAL token for my demon application.
I have tried blow code

IManagedIdentityApplication mi = ManagedIdentityApplicationBuilder.Create(ManagedIdentityId.WithUserAssignedClientId("myspnid"))
.Build();

              AuthenticationResult result = await mi.AcquireTokenForManagedIdentity("https://graph.microsoft.com/.default")
                  .ExecuteAsync()
                  .ConfigureAwait(false);
              _logger.LogInformation("C# HTTP trigger function processed a request."+ result.AccessToken);
              return new OkObjectResult("Welcome to Azure Functions! token" + result.AccessToken);
          }
          catch (Exception ex)
          {
              return new OkObjectResult("Welcome to Azure Functions! error"+ex.Message);
              _logger.LogInformation("C# HTTP trigger function processed a request." +ex.Message);

          }

I don’t want to use secrets.
Cos I already have created app I have SPN service principle ID.

can any one have idea on this?