Windows Phone 7 – How to find the device unique id windows live anonymous Id and manufacturer

This post details how to use DeviceExtendedProperties and UserExtendedProperties classes from the Microsoft.Phone.Info namespace to find a WP7 device manufacturer, device unique Id and users Anonymous Windows Live ID as follows:

To be able to obtain the Device Unique ID and Windows Live Anonymous ID you must first add the capabilities to do this to your WMAppManifest.xml file within your WP7 project as follows:

      <Capability Name="ID_CAP_IDENTITY_DEVICE"/>
      <Capability Name="ID_CAP_IDENTITY_USER"/>

One important point to note is that you should only really use the device unique id and anonymous windows live Id in your application if really requires it. The reasoning on msdn is as follows:

DeviceExtendedProperties requires the device identity capability. If your application uses this class, the user will be alerted that the application requires access to the device identity when viewing your application on Windows Phone Marketplace. For this reason, it is recommended that you use this class only if your application requires it.

Note: In the example below the manufacturer is returned from GetManufacturer without needing to list the device identity capability within the WMAppManifest but if you tried to get the device Id onr anonymous Id without the capability it will throw an UnauthorizedAccessException.

The following code example demonstrates how to retrieve the Device Manufacturer, Device Unique ID and Windows Live Anonymous ID

using Microsoft.Phone.Info;
namespace NickHarris.Net
    public static class ExtendedPropertyHelper
        private static readonly int ANIDLength = 32;
        private static readonly int ANIDOffset = 2;
        public static string GetManufacturer()
            string result = string.Empty;
            object manufacturer;
            if (DeviceExtendedProperties.TryGetValue("DeviceManufacturer", out manufacturer))
                result = manufacturer.ToString();

            return result;

        //Note: to get a result requires ID_CAP_IDENTITY_DEVICE
        // to be added to the capabilities of the WMAppManifest
        // this will then warn users in marketplace
        public static byte[] GetDeviceUniqueID()
            byte[] result = null;
            object uniqueId;
            if (DeviceExtendedProperties.TryGetValue("DeviceUniqueId", out uniqueId))
                result = (byte[])uniqueId;

            return result;

        // NOTE: to get a result requires ID_CAP_IDENTITY_USER
        //  to be added to the capabilities of the WMAppManifest
        // this will then warn users in marketplace
        public static string GetWindowsLiveAnonymousID()
            string result = string.Empty;
            object anid;
            if (UserExtendedProperties.TryGetValue("ANID", out anid))
                if (anid != null && anid.ToString().Length >= (ANIDLength + ANIDOffset))
                    result = anid.ToString().Substring(ANIDOffset, ANIDLength);

            return result;

Other Extended Device information that can be retrieved using this class are:

    DeviceUniqueId – if you are after an id to identify the user you should not use this, use Microsoft.Phone.Info.UserExtendedProperties with a parameter of “ANID”

More details on these extended properties can be found here


  • Pingback: Finding the Device Model on Windows Phone 7 - Nick Harris .NET

  • Frederik Williams

    Cool, this post was just what I needed. Thx :)
    Only needed to add the reference to Microsoft.Phone in my XNA project.

  • Edon

    Thnx DUDE for this post. Is that possible in WP7 to get the SIM ID number and the SIM number (phone number)? If it is possible can you tell me how to do?

  • Nitin

    Hey thanks for the Information .

    But i still have a question . Is there any way to retrieve or record the Windows Live id of my Windows Phone app Consumer?


  • Nik Rolls

    You can’t get the user’s Microsoft account address; for privacy reasons you must ask the user for this yourself.

    However if all you need is a unique unchanging ID to track the user across multiple devices, then the ANID (ANonymous ID, mentioned above) is the way to go.