web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Unanswered

How to get AssemblyAuthenticationContext from getService() in plugin?

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I've seen IAssemblyAuthenticationContext used in plugins. I want to instantiate it in particular so I can use its AcquireToken() method. However, whenever I look in serviceProvider that is passed into the Execute() function for it, it is never available. This makes my AssemblyAuthContext variable below always null.

public void Execute(IServiceProvider serviceProvider)
{
    var PluginExecutionContext = serviceProvider.Get();
    var TracingService = new LocalTracingService(serviceProvider);
    
    // This is always null
    var AssemblyAuthContext = serviceProvider.Get();
    
    // What I wwant to do
    string token = AssemblyAuthContext.AcquireToken("url", "authResource, AuthenticationType.ClientAssertionCertificateWithX5c);
}

Anyone know how to make this available in a plugin? Do you have to pass it in somehow?

I have the same question (0)
  • Eric benco Profile Picture
    320 on at

    what if happens if you try

    serviceProvider.GetService(typeof(IAssemblyAuthenticationContext));

  • vdblohowiak Profile Picture
    Microsoft Employee on at

    It's the same method as doing serviceProvider.Get<IAssemblyAuthenticationContext>();

    I can debug the plugin and inspect what's in serviceProvider. Nothing of type "IAssemblyAuthenticationContext" is in there.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Manoj - ManoVerse Profile Picture

Manoj - ManoVerse 125 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 93

#3
Hamza H Profile Picture

Hamza H 46 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans