How can I remove stale devices from Azure AD using MS graph PowerShell module?
Trying with {Device.ReadWrite.All, Directory.ReadWrite.All} scops, even Get-MgDevice show the following error
PS C:\WINDOWS\system32> Get-MgDevice -DeviceId 91140dae-dc4a-4c72-aba2-ea2a391747a9 Get-MgDevice : Resource '91140dae-dc4a-4c7288888' does not exist or one of its queried reference-property
objects are not present.
At line:1 char:1
- Get-MgDevice -DeviceId 91140dae-dc4a-4c72-aba2-ea2a391747a9
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : InvalidOperation: ({ DeviceId = 91...ndProperty = }:<>f__AnonymousType40
3) [Get-MgDevi ce_Get1], RestException
1
- FullyQualifiedErrorId : Request_ResourceNotFound,Microsoft.Graph.PowerShell.Cmdlets.GetMgDevice_Get1