Rohini Patil
Rohini Patil

Reputation: 51

How to push policy on some devices(not on all devices) under same enterprise using Android management API

I have enrolled multiple devices using same QR Code in AMA. I want to re push policies on some device and not on all devices. I have gone through the document and policies are getting applied based on enterprise name . Is there any way to push policies on particular devices?

Upvotes: 1

Views: 514

Answers (2)

Jonas Simonaitis
Jonas Simonaitis

Reputation: 320

If you have enrolled the device under the same policy you cannot modify it for a specific device. To do that you need to enrol the device with a different policy.

Upvotes: 0

Louise
Louise

Reputation: 91

Policies are not applied on the enterprise name but rather on the enrollment token that was used to enroll the device (this is the policy that gets applied on the device upon provisioning). To push a different policy on a specific device you have to retrieve the device name via enterprise.devices.list and update the policy by assigning the policyName on the device object using enterprises.devices.patch.

Sample code:

deviceBody = {
    'policyName':'enterprises/LC0xxxxxxx/policies/policy_2'
}

androidmanagement.enterprises().devices().patch(name='enterprises/LC0xxxxxxx/devices/xxxxxxxxxxxx', updateMask='policyName', body = deviceBody).execute()

Upvotes: 2

Related Questions