Hi Partner,
Actually the real thing that is going to be deprecated is WS-Trust authentication, this change impacts custom client applications that use “Office365” authentication and the "OrganizationServiceProxy" or "CrmServiceClient" classes.
We can follow this guide to fix our current code:
https://docs.microsoft.com/en-us/powerapps/developer/data-platform/authenticate-office365-deprecation#what-should-i-do-to-fix-my-application-code-if-affected
"
If your code uses an Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy instance:
If you are passing the OrganizationServiceProxy
instance around to various methods, or returning the instance from a function, replace all occurrences of the type OrganizationServiceProxy
with the IOrganizationService interface. This interface exposes all the core methods used to communicate with Dataverse.
When invoking the constructor, it is recommend you add the NuGet package Microsoft.CrmSdk.XrmTooling.CoreAssembly to your project and replace all use of OrganizationServiceProxy
class constructors with CrmServiceClient class constructors. You will need to alter your coding pattern here, however, for simplicity CrmServiceClient
supports connection strings in addition to complex constructors and the ability to provide external authentication handlers. CrmServiceClient
implements IOrganizationService
, therefore your new authentication code will be portable to the rest of your application code.
"
It seems that "OrganizationServiceManager" class is from a GitHub library called "XrmCoreLibrary", I tested the library with its latest version 9.0.7.
https://www.nuget.org/packages/Pfe.Microsoft.Xrm.CoreV9/
As its release notes said, the library
* depends on CrmServiceClient using oAuth/Modern Authentication
* Removed old constructors relying on organizationserviceproxy - we now 100% rely on CrmServiceClient
So I believe the first action you can take is to update your current Pfe.Xrm package version, and replace ManagedTokenOrganizationServiceProxy with CrmServiceClient class, then get organization service from crmserviceclient.
Here is my code and it runs successfully.

Uri myUri = new Uri("https://org.api.crm5.dynamics.com/XRMServices/2011/Organization.svc", UriKind.Absolute);
var organizationServiceManager = new OrganizationServiceManager(myUri, "admin@CRM123456.onmicrosoft.com", "123456");
CrmServiceClient crmSvc = organizationServiceManager.GetProxy();
if (crmSvc.IsReady)
{
IOrganizationService orgService;
orgService = (IOrganizationService)crmSvc.OrganizationWebProxyClient != null ? (IOrganizationService)crmSvc.OrganizationWebProxyClient : (IOrganizationService)crmSvc.OrganizationServiceProxy;
Guid userID = ((WhoAmIResponse)orgService.Execute(new WhoAmIRequest())).UserId;
if (userID != Guid.Empty)
{
Console.WriteLine("Connection successful" "Your GUID is: " userID);
}
// retrieveContact(orgService);
}

As far as I know, with latest authentication method, an Azure Active Directory app is required to be registered to connect to our Dynamics, however, with the latest OrganizationServiceManager class, I connected to my Dynamics without app id successfully, only username and password are used.
By opening the class, I found that it provides 3 ways for connection.

I think the third way would be the recommended way(AAD app id as parameter), but I am curious about how is the second way achieved due to only username and password are passed as parameters.
You could contact the package owner for technical details.(in NuGet page)
In a word, what you can do are:
1. Update current Microsoft.Pfe.Xrm version.
2. Replace OrganizationServiceProxy with CrmServiceClient.
3. Contact the package owner to confirm that whether the second method will continue to be supported.
4. Register an AAD app for modern authentication with the third way.
https://docs.microsoft.com/en-us/powerapps/developer/data-platform/walkthrough-register-app-azure-active-directory