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}