Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New-MgApplicationOwnerByRef fails with "Invalid URL format" #3177

Closed
garretth9 opened this issue Feb 24, 2025 · 1 comment
Closed

New-MgApplicationOwnerByRef fails with "Invalid URL format" #3177

garretth9 opened this issue Feb 24, 2025 · 1 comment
Labels
status:duplicate A duplicate issue type:bug A broken experience

Comments

@garretth9
Copy link

garretth9 commented Feb 24, 2025

Describe the bug

I suspect this is related to issue #3154 but i dont see any reference to the New-MgApplicationOwnerByRef function there.

Attempting to assign application owners using powershell using a script that was previously working. In version 2.26.0 it is failing with an error of
Invalid URL format specified in payload. Status: 400 (BadRequest)

Expected behavior

specified owner should be assigned to the app

How to reproduce

$appId = '<app id for the app in question>'
$application = Get-MgApplication -All -Filter "AppId eq '$appId'"
$ownerId = (Get-MgUser -UserId '[email protected]').Id
$params = @{ "@odata.id" = "https://graph.microsoft.com/v1.0/directoryObjects/${ownerId}"}
New-MgApplicationOwnerByRef -ApplicationId $application.id -BodyParameter $params

SDK Version

2.26.0

Latest version known to work for scenario above?

2.18.0

Known Workarounds

No response

Debug output

Click to expand log

DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
POST

Absolute Uri:
https://graph.microsoft.com/v1.0/applications/648f283c-9f86-xxxx-xxxx-4ce67d658b33/owners/$ref

Headers:
FeatureFlag : 00000003
Cache-Control : no-store, no-cache
User-Agent : Mozilla/5.0,(Macintosh; Darwin 24.3.0 Darwin Kernel Version 24.3.0: Thu Jan 2 20:22:58 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T8132; en-US),PowerShell/2025.0.0
SdkVersion : graph-powershell/2.26.0
client-request-id : 31a75c6f-d787-xxxx-xxxx-efdbe7fb1acc
Accept-Encoding : gzip,deflate,b

Body:
{
"@odata.id": "https:graph.microsoft.comv1.0directoryObjectsebbafa77-ee4f-xxxx-xxxx-aeb4c780c409"
}

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

Status Code:
BadRequest

Headers:
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : d6c696c0-6e3c-xxxx-xxxx-ae419aeffee9
client-request-id : 31a75c6f-d787-xxxx-xxxx-efdbe7fb1acc
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"East US","Slice":"E","Ring":"5","ScaleUnit":"000","RoleInstance":"BL6PEPF0001F60B"}}
Date : Mon, 24 Feb 2025 19:29:09 GM

Body:
{
"error": {
"code": "BadRequest",
"message": "Invalid URL format specified in payload.",
"innerError": {
"date": "2025-02-24T19:29:10",
"request-id": "d6c696c0-6e3c-xxxx-xxxx-ae419aeffee9",
"client-request-id": "31a75c6f-d787-xxxx-xxxx-efdbe7fb1acc"
}
}
}

New-MgApplicationOwnerByRef_Create: Invalid URL format specified in payload.

Status: 400 (BadRequest)
ErrorCode: BadRequest
Date: 2025-02-24T19:29:10

Headers:
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : d6c696c0-6e3c-xxxx-xxxx-ae419aeffee9
client-request-id : 31a75c6f-d787-xxxx-xxxx-efdbe7fb1acc
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"East US","Slice":"E","Ring":"5","ScaleUnit":"000","RoleInstance":"BL6PEPF0001F60B"}}
Date : Mon, 24 Feb 2025 19:29:09 GM

Recommendation: See service error codes: https://learn.microsoft.com/graph/errors
DEBUG: [CmdletEndProcessing]: - New-MgApplicationOwnerByRef end processing.

Configuration

Name                           Value
----                           -----
PSVersion                      7.5.0
PSEdition                      Core
GitCommitId                    7.5.0
OS                             Darwin 24.3.0 Darwin Kernel Version 24.3.0: Thu Jan  2 20:22:58 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T8132
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Other information

Debug output indicates that the forward slashes are all being stripped from my body parameter, I suspect this is causing the problem. I confirmed with a coworker running 2.18.0 that his debug output does not have the slashes stripped from the body parameter and his works correctly.

@garretth9 garretth9 added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Feb 24, 2025
@timayabi2020
Copy link
Contributor

Hi @garretth9 sorry for the experience and yes it is related to #3154 and I'll therefore close this as a duplicate. In the meantime please upgrade to 2.26.1

@timayabi2020 timayabi2020 added status:duplicate A duplicate issue and removed status:waiting-for-triage An issue that is yet to be reviewed or assigned labels Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:duplicate A duplicate issue type:bug A broken experience
Projects
None yet
Development

No branches or pull requests

2 participants