The issue is repeatable and have found no workaround. Seems others are having similar problem:
I can connect to Dynamics365 with a correct connection string, can debug the Azure function locally and everything works fine. See snippet below:
try
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
_myTI = new CultureInfo("en-US", false).TextInfo;
_svc = new CrmServiceClient(connectionString);
WhoAmIRequest request = new WhoAmIRequest();
WhoAmIResponse response = (WhoAmIResponse)_svc.Execute(request);
Console.WriteLine("Your UserId is {0}", response.UserId);
exMessage = null;
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
exMessage = ex.Message " | " ex.StackTrace;
}
Please, note that I can test/debug this Azure function locally via Postman.
If I deploy the same function on Azure however, the connection fails. Everything is the same and the connection string is correct. This is the error: "ERROR REQUESTING Token FROM THE Authentication context" and this is the exception: "System.Exception: Unable to Login to Dynamics CRM". I am unable to understand what could cause the difference as the same code connection string works in local.
I have been chasing this issue for a while now (checked all the Xrm.tool and Xrm.Core dependencies etc.) to no avail. Any help would be much appreciated.

Report
All responses (
Answers (