microsoftgraph / powershell-intune-samples

This repository of PowerShell sample scripts show how to access Intune service resources. They demonstrate this by making HTTPS RESTful API requests to the Microsoft Graph API from PowerShell.
MIT License
1.36k stars 657 forks source link

GET request to deviceManagement/hardwareConfigurations/{id} returning deleted policy #278

Open JorgeDios opened 1 month ago

JorgeDios commented 1 month ago

Hello,

After successfully deleting an Intune policy of the type 'hardwareConfigurations', I still can retrieve its value when invoking GET request to the API using the policy's Id. Below, a call to a NON-EXISTING policy returning its value before deletion:

GET https://graph.microsoft.com/beta/deviceManagement/hardwareConfigurations/605251cc-5184-403a-a4b8-e83ca660195e

@odata.context              : https://graph.microsoft.com/beta/$metadata#deviceManagement/hardwareConfigurations/$entity
id                          : 605251cc-5184-403a-a4b8-e83ca660195e
version                     : 1
displayName                 : WCP-DELL-D-I: 1.1 (L1)
description                 :
createdDateTime             : 03/10/2024 11:04:56
lastModifiedDateTime        : 03/10/2024 11:04:56
fileName                    : <some_name>.cctk
configurationFileContent    : <some_value>
hardwareConfigurationFormat : dell
roleScopeTagIds             : {0}
perDevicePasswordDisabled   : True

Invoking a LIST request for all deviceManagement/hardwareConfigurations policies does not show the deleted policy, but the existing one(s) instead:

GET https://graph.microsoft.com/beta/deviceManagement/hardwareConfigurations

id                          : 43081aee-8cb4-49e6-9155-11a06d53b7aa
version                     : 1
displayName                 : WCP-DELL-D-I: 1.1 (L1)
description                 :
createdDateTime             : 03/10/2024 11:05:27
lastModifiedDateTime        : 03/10/2024 11:05:27
fileName                    : <some_name>.cctk
configurationFileContent    :
hardwareConfigurationFormat : dell
roleScopeTagIds             : {0}
perDevicePasswordDisabled   : True

Returning the value of a non existing policy is neither the expected nor the desired behavior of a GET request. It is, anyways, a deviation compared to the other intune graph api endpoints.

Please, let me know if you need any additional information in order to be able to correct the issue.