Add application permission support to Delete AAD devices

Add application permission support to Delete AAD devices
6

Upvotes

Upvote

 Oct 29 2021
1 Comments (1 New)
New

Add application permission support to Delete AAD devices.

 

This is currently not supported when used with application authentication: https://docs.microsoft.com/en-us/graph/api/device-delete?view=graph-rest-beta&tabs=http

 

$AuthToken = Get-MsalToken -ClientId $ClientId -TenantId $TenantId -ClientCertificate $ClientCertificate

$ResourceUrl = "https://graph.microsoft.com/beta/devices/{id}"
Invoke-RestMethod -Headers @{Authorization = "Bearer $($AuthToken.AccessToken)"} -Uri $ResourceUrl -Method Delete

 

or

 

Remove-MgDevice -DeviceId {id}

Comments
Occasional Visitor

Would be nice to be able to have this functionality in Azure Automation implemented with Application Identities.