Still puzzled by this.
Get-MGDevice returns following properties:
Name
AccountEnabled
AdditionalProperties
AlternativeSecurityIds
ApproximateLastSignInDateTime
ComplianceExpirationDateTime
DeletedDateTime
DeviceId
DeviceMetadata
DeviceVersion
DisplayName
Extensions
Id
IsCompliant
IsManaged
MdmAppId
MemberOf
OnPremisesLastSyncDateTime
OnPremisesSyncEnabled
OperatingSystem
OperatingSystemVersion
PhysicalIds
ProfileType
RegisteredOwners
RegisteredUsers
SystemLabels
TransitiveMemberOf
TrustType
When I check the values for DeviceId, and ID I see two different values, and DeviceId is not empty.
When removing a device, where I need to specify a DeviceId, I would expect the property of the DeviceID, however this is not true:
Get-MgDevice -filter "AccountEnabled eq $False" | % {Remove-MgDevice -DevciceID $_.DeviceID}
This command returns:
Remove-MgDevice_Delete: Resource '22f51fa0-4ae9-4531-b82e-3ad0f8c1cc18' does not exist or one of its queried reference-property objects are not present.
However when i specify the ID value it works
Get-MgDevice -filter "AccountEnabled eq $False" | % {Remove-MgDevice -DeviceId $_.Id}