Thank you for your detailed post!
Error occurred while executing
RemoveDeviceCode: Authorization_RequestDenied
Message: Insufficient privileges to complete the operation.
HttpStatusCode: Forbidden
Based off your error details and reviewing the Remove-AzureADDevice documentation, it does look like you granted your application the correct permissions .
However, since the Directory.AccessAsUser.All delegated permission, allows your application to have the same access to information in the directory as the signed-in user. Please also make sure that the user you're signed in with has one of the following roles assigned.
- Microsoft Entra roles: Global Administrator, Intune Administrator, Windows 365 Administrator, or Cloud Device Administrator.
I hope this helps!
If you have any other questions or are still having issues, please let me know. Thank you for your time and patience throughout this issue.
If the information helped address your question, please Accept the answer. This will help us and also improve searchability for others in the community who might be researching similar information.