Deleting an Azure Active Directory Device via API

Viewed 192

I am working on an automation to remove devices from InTune and Azure for single users when the laptop or device is being retired. I am trying to make DELETE requests via the graph API to remove the device from AutoPilot, InTune, and Azure Active Directory (AAD).

Currently, this is working for everything except AAD. I am attempting to use the API: https://graph.microsoft.com/beta/admin/windows/updates/updatableAssets based on information from https://docs.microsoft.com/en-us/graph/api/windowsupdates-updatableasset-delete?view=graph-rest-beta&tabs=http.

There doesn't seem to be an equivalent that I can find outside of beta. I am able to make a GET request to list items but trying to retrieve or delete a single item keeps giving me a 404.

Does anyone have any solutions for removing an Azure AD Device via API?

1 Answers

Have to tried Version selector as shown in the MSDN?

although i don't have similar scenario to test, but URl might be like

https://graph.microsoft.com/v1.0/admin/windows/updates/updatableAssets/{updatableAssetId}

One more way, if you have the option of using GraphServiceClient, then you can use this

https://docs.microsoft.com/en-us/graph/api/windowsupdates-updatableasset-delete?view=graph-rest-beta&tabs=csharp

Best part of the GraphServiceClient is default it will prepare a General Release version Api to call.

MSDN:-Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version

Please check at your end, if the GA is providing the operation you are looking for.

Related