msgraph-sdk-powershell icon indicating copy to clipboard operation
msgraph-sdk-powershell copied to clipboard

Update-MgDeviceManagementImportedWindowsAutopilotDeviceIdentity is broken

Open Skeb1ns opened this issue 1 year ago • 1 comments

Describe the bug

Trying to update the Group Tag of an Autopilot device and running Update-MgBetaDeviceManagementImportedWindowsAutopilotDeviceIdentity -GroupTag %GroupTag% -ImportedWindowsAutopilotDeviceIdentityId %Id% results in the following error:

No OData route exists that match template ~/singleton/navigation/key with http verb PATCH for request /DeviceEnrollmentFE/StatelessDeviceEnrollmentFEService/deviceManagement/importedWindowsAutopilotDeviceIdentities('9ac9421a-2386-45ca-8380-58d639607e34')

When I manually invoke Invoke-MgGraphRequest using the code below it works fine:

$body = ConvertTo-Json -InputObject @{ "GroupTag" = "$groupTag" }
$uri = "https://graph.microsoft.com/1.0/deviceManagement/windowsAutopilotDeviceIdentities/$($_.Id)/UpdateDeviceProperties"

Invoke-MgGraphRequest -Uri $uri -Method Post -Body $body

My guess when reading the error is that the cmdlet tries to do perform a Patch operation instead of a Post.

Expected behavior

No errors and an updated Group Tag.

How to reproduce

Executing the following:

Update-MgBetaDeviceManagementImportedWindowsAutopilotDeviceIdentity -GroupTag %GroupTag% - ImportedWindowsAutopilotDeviceIdentityId %Id%

SDK Version

2.22.0

Latest version known to work for scenario above?

No idea, this is broken for a while (at least since 2.15.0)

Known Workarounds

No response

Debug output

Click to expand log ```
</details>


### Configuration

Name                           Value
----                           -----
PSVersion                      7.4.3
PSEdition                      Core
GitCommitId                    7.4.3
OS                             Darwin 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6000
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

### Other information

_No response_

Skeb1ns avatar Aug 15 '24 07:08 Skeb1ns

To update the group tag of an Autopilot device, use the Update-MgDeviceManagementWindowsAutopilotDeviceIdentityDeviceProperty cmdlet.

https://learn.microsoft.com/en-us/powershell/module/microsoft.graph.devicemanagement.actions/update-mgdevicemanagementwindowsautopilotdeviceidentitydeviceproperty?view=graph-powershell-1.0

zehadialam avatar Sep 09 '24 23:09 zehadialam