Helper code: DeviceIdManager class
Updated: November 29, 2016
Applies To: Dynamics 365 (online), Dynamics 365 (on-premises), Dynamics CRM 2016, Dynamics CRM Online
The DeviceIdManager class registers a computing device with Microsoft account, through the generation of a device ID and password, and optionally stores that information in an encrypted format on the local disk for later reuse. This functionality is required when authenticating with Microsoft Dynamics 365 (online) through the Microsoft account identity provider. The device registration is stored in the %USERPROFILE%\LiveDeviceID folder on the computing device.
The primary class method to call from your code is LoadOrRegisterDevice. For an example of how the DeviceIdManager class is used, see the GetDeviceCredentials method in the Helper code: ServerConnection class topic.
A Microsoft Azure hosted application that must authenticate with Microsoft Dynamics 365 (online) should either set the PersistToFile property of DeviceIdManager to false or call the two-parameter LoadOrRegisterDevice method passing in the required device ID and password. In both cases, the DeviceIdManager won’t attempt to save the device ID and password to a file.
Download the Microsoft Dynamics CRM SDK package. The source code for the class can be found in the following location in the download package:
SDK\SampleCode\CS\HelperCode\DeviceIdManager.cs
SDK\SampleCode\VB\HelperCode\DeviceIdManager.vb
Requirements
For more information about the requirements for running the sample code provided in this SDK, see Use the sample and helper code.
Demonstrates
The DeviceIdManager class demonstrates how to manage the registration of computing devices with Microsoft account.
Microsoft Dynamics 365
© 2016 Microsoft. All rights reserved. Copyright