microsoftgraph / microsoftgraph/msgraph-sdk-powershell
Update-MgDeviceManagementImportedWindowsAutopilotDeviceIdentity is broken
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 898
- Forks
- 230
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 31
Description
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_
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Update-MgBetaDeviceManagementImportedWindowsAutopilotDeviceIdentity cmdlet and trace how it sends the imported Autopilot device update request. Compare that request with the working Invoke-MgGraphRequest example; done means the cmdlet updates GroupTag without the OData route error, with validation for the reported reproduction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, powershell
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100