Hi,
I have an azure function whose first step is to connect to CRM
following is my code:
public static async Task<HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = null)] HttpRequestMessage req, TraceWriter log)
{
IOrganizationService service = null;
string URL = "">https://xyz.crm.dynamics.com";
string userName = "cf_admin@xyz.com";
string password = "xyz";
// var res = Environment.GetEnvironmentVariable($"URL");
ClientCredentials clientCredentials = new ClientCredentials();
clientCredentials.UserName.UserName = userName;
clientCredentials.UserName.Password = password;
OrganizationServiceProxy organizationServiceProxy = new OrganizationServiceProxy(new Uri("" + URL + "/XRMServices/2011/Organization.svc"), null, clientCredentials, null);
//For Dynamics 365 Customer Engagement V9.X, set Security Protocol as TLS12
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
organizationServiceProxy.Timeout = new TimeSpan(0, 10, 0);
service = (IOrganizationService)organizationServiceProxy;
}
I published the function into azure portal, when I hit the azure function, but it is not connecting to CRM.
Locally this is working perfectly fine but when debugging the code from azure cloud service it does not connects to CRM.
It is giving the following error:
Any help is appreciated.