Recently I bumped into the below error while executing a custom plug-in in Microsoft Dynamics 365. This plug-in was using a NetworkCredential class to authenticate a SOAP request.
On scrutinizing the problem, it was realized that the error was thrown due to the plug-in being registered in the Sandbox environment of Dynamics 365. When registering the same plug-in outside the Sandbox environment, the error was prevailed.
So, if you happen to register the plug-in in the Sandbox instance, you wouldn’t be able to access IP addresses, registry, file system, system event logs and certain network protocols. However, Azure Cloud Services can be accessed by these Sandbox plug-ins.
The thing to be jotted down here is that the Sandbox instances exist for the security reasons. Microsoft Dynamics 365 online supports only sandboxed plugins and thus, be mindful of this restriction when developing systems or migrating CRM to online.