It is not possible for your app to directly access the device ID.
However you can achieve a similar result by exposing a managed configuration in your app with one string and configuring it in the ApplicationPolicy with a different policy for each device. The managed configuration can contain a string property that you set to the device ID for each device.
The managed configuration file in your app would look like:
<restrictions xmlns:android="http://schemas.android.com/apk/res/android">
  <restriction
    android:key="deviceId"
    android:title="ID of the device"
    android:restrictionType="string" />
</restrictions>
And the policy would look like:
{
  "applications": [
    {
      "packageName": "com.example",
      "installType": "FORCE_INSTALLED",
      "managedConfiguration": {
        "deviceId": "1a2b3c4d5e6f"
      }
    }
  ]
}
In addition, to set the policy as soon as a new device is enrolled you can set up Pub/Sub notifications and listen for ENROLLMENT events, the data field of the notification contains a Device resource with the device ID, therefore allowing you to create a new policy and assign it to the device.