Skip to content

2.26.0 Set-MgUserManagerByRef Body URL misformed #3150

@jonbartels71

Description

@jonbartels71

Describe the bug

All attempts to execute the Set-MgUserManagerByRef fail with an "Invalid URL format specified in payload." error.

When doing a debug run, the body payload URL has been stripped of all forward slashes:
Body: { "@odata.id": "https:graph.microsoft.comv1.0users4723585c-30e6-3000-7410-5fe10a0081e1" }

Executing the same command with 2.25.0 results in a properly formatted URL:
Body: { "@odata.id": "https://graph.microsoft.com/v1.0/users/4723585c-30e6-3000-7410-5fe10a0081e1" }

Samples with random ObjectIds

Expected behavior

Manager updated without error as long as the parameters and Ids are correct.

How to reproduce

  1. Execute
$mgr = @{"@odata.id"="https://graph.microsoft.com/v1.0/users/4723585c-30e6-3000-7410-5fe10a0081e1"}
Set-MgUserManagerByRef -UserId '40f77e3b-7d6c-33b5-ad32-8b7080acf114' -BodyParameter $mgr -Debug
  1. Watch the error...

SDK Version

2.26.0

Latest version known to work for scenario above?

2.25.0

Known Workarounds

Fall back to 2.25.0

Debug output

Click to expand log ```

DEBUG: [CmdletBeginProcessing]: - Set-MgUserManagerByRef begin processing with parameterSet 'Set'.
DEBUG: [Authentication]: - AuthType: 'Delegated', TokenCredentialType: 'InteractiveBrowser', ContextScope: 'CurrentUser', AppName: 'Microsoft Graph Command Line Tools'.
DEBUG: [Authentication]: - Scopes: [Group.ReadWrite.All, openid, Organization.Read.All, profile, User.Read, User.Read.All, User.ReadWrite.All, UserAuthenticationMethod.Read.All, email].
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
PUT

Absolute Uri:
https://graph.microsoft.com/v1.0/users/40f77e3b-7d6c-33b5-ad32-8b7080acf114/manager/$ref

Headers:
FeatureFlag : 00000003
Cache-Control : no-store, no-cache
User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.26100; en-CA),PowerShell/5.1.26100.2161
SdkVersion : graph-powershell/2.26.0
client-request-id : d99470fd-9c11-4a70-b2c1-1cc9d09440fd

Body:
{
"@odata.id": "https:graph.microsoft.comv1.0users4723585c-30e6-3000-7410-5fe10a0081e1"
}

DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
BadRequest

Headers:
Transfer-Encoding : chunked
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : 56b9a1ef-d8fc-4977-859a-f997fca894dc
client-request-id : d99470fd-9c11-4a70-b2c1-1cc9d09440fd
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"West US 2","Slice":"E","Ring":"4","ScaleUnit":"005","RoleInstance":"MWH0EPF0009A7D1"}}
Date : Thu, 20 Feb 2025 22:22:50 GMT

Body:
{
"error": {
"code": "BadRequest",
"message": "Invalid URL format specified in payload.",
"innerError": {
"date": "2025-02-20T22:22:50",
"request-id": "56b9a1ef-d8fc-4977-859a-f997fca894dc",
"client-request-id": "d99470fd-9c11-4a70-b2c1-1cc9d09440fd"
}
}
}

</details>


### Configuration

- OS: Windows 11 Version 24H2 (OS Build 26100.3194)
- .NET 9.0 Installed
- PowerShell 7.5.0

### Other information

_No response_

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions