0
votes

I have hosted a asp.net website on Windows Azure and trying to connect to Microsoft Dynamics CRM 2011 Online. But I am getting below error:

The data protection operation was unsuccessful. This may have been caused by not having the user profile loaded for the current thread's user context, which may be the case when the thread is impersonating.

Error Source = at System.Security.Cryptography.ProtectedData.Protect(Byte[] userData, Byte[] optionalEntropy, DataProtectionScope scope) at Microsoft.Crm.Services.Utility.DeviceUserName.Encrypt(String value) in c:\DWASFiles\sites\mfs\VirtualDirectory0\site\wwwroot\App_Code\DeviceidManager.cs:line 869 at Microsoft.Crm.Services.Utility.DeviceUserName.UpdateCredentials(String encryptedValue, String decryptedValue) in c:\DWASFiles\sites\mfs\VirtualDirectory0\site\wwwroot\App_Code\DeviceidManager.cs:line 840 at Microsoft.Crm.Services.Utility.DeviceUserName.set_DecryptedPassword(String value) in c:\DWASFiles\sites\mfs\VirtualDirectory0\site\wwwroot\App_Code\DeviceidManager.cs:line 796 at Microsoft.Crm.Services.Utility.DeviceIdManager.GenerateDeviceUserName() in c:\DWASFiles\sites\mfs\VirtualDirectory0\site\wwwroot\App_Code\DeviceidManager.cs:line 390 at Microsoft.Crm.Services.Utility.DeviceIdManager.RegisterDevice(Guid applicationId, Uri issuerUri, String deviceName, String devicePassword) in c:\DWASFiles\sites\mfs\VirtualDirectory0\site\wwwroot\App_Code\DeviceidManager.cs:line 185 at Microsoft.Crm.Services.Utility.DeviceIdManager.LoadOrRegisterDevice(Uri issuerUri, String deviceName, String devicePassword) in c:\DWASFiles\sites\mfs\VirtualDirectory0\site\wwwroot\App_Code\DeviceidManager.cs:line 109 at Microsoft.Crm.Services.Utility.DeviceIdManager.LoadOrRegisterDevice(Uri issuerUri) in c:\DWASFiles\sites\mfs\VirtualDirectory0\site\wwwroot\App_Code\DeviceidManager.cs:line 92 at Microsoft.Crm.Services.Utility.DeviceIdManager.LoadOrRegisterDevice() in c:\DWASFiles\sites\mfs\VirtualDirectory0\site\wwwroot\App_Code\DeviceidManager.cs:line 70 at ServerConnection.ConnectToCRM() in c:\DWASFiles\sites\mfs\VirtualDirectory0\site\wwwroot\App_Code\CrmService.cs:line 56

Can someone help me on this?

Thanks Chandrabhanu

1

1 Answers

0
votes

From your log looks like that you are connecting against a CRM Online instance that is still using Windows Live Id authentication, the DeviceidManager.cs is a big clue but not a complete proof. Windows Live Id authentication still needs the device credentials, this is an issue on Azure hosted apps.

Try to use the simplified connection, you can find an example here:

MS Dynamics CRM online 2011 - Authentication issues