microsoftgraph / microsoftgraph/msgraph-sdk-powershell

2.26.1 | Update-MgGroup : Invalid property error when trying to set a value to a custom directory extension

Aperta
#3,230 12 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Status: Needs Investigation type:bug
Lingua principale
C#
Stelle
898
Fork
230
Merge medio
2g 5h
PR unite (30g)
31

Descrizione

Describe the bug

We have defined some custom Directory Extension on Group resource types.
Let's call its fullname "extension_appId_extensionName". Its type is multi-valued string.

When I try to set a value for this extension on a group, I get an error in v2.26.1 but it works fine in 2.25.0.

EDIT : please ignore following examples in this first message. I wanted to make them simpler and actually removed the part that is not working. My second message below show the examples that cause the problem, it seems related to the Json format.

Expected behavior

With "extension_appId_extensionName" being the full name of the custom Directory extension.

PS > $values = @()
PS > $values += "Hello"
PS > $values += "Hello2"
PS > $Properties = @{}
PS > $Properties.Add('extension_appId_extensionName', $values)
PS > Update-MgGroup -GroupId $groupID -BodyParameter $Properties
PS > 
How to reproduce
PS > $values = @()
PS > $values += "Hello"
PS > $values += "Hello2"
PS > $Properties = @{}
PS > $Properties.Add('extension_appId_extensionName', $values)

PS >Update-MgGroup -GroupId $groupID -BodyParameter $Properties
Update-MgGroup : Invalid property 'extension_appId_extensionName'.
Status: 400 (BadRequest)
ErrorCode: Request_BadRequest
Date: 2025-03-19T10:19:59
Headers:
Transfer-Encoding             : chunked
Vary                          : Accept-Encoding
Strict-Transport-Security     : max-age=31536000
request-id                    : 1f152183-7d9e-44b9-b5d6-6a47196024db
client-request-id             : b7ba8b4e-bb8c-4e96-9d1c-7d4789d08173
x-ms-ags-diagnostic           : {"ServerInfo":{"DataCenter":"France Central","Slice":"E","Ring":"5","ScaleUnit":"003","RoleInstance":"PA1PEPF00102A3B"}}
x-ms-resource-unit            : 1
Cache-Control                 : no-cache
Date                          : Wed, 19 Mar 2025 10:19:58 GMT
Au caractère Ligne:18 : 1
+ Update-MgGroup -GroupId $groupID -BodyParameter $Properties
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation : ({ GroupId = de1...oftGraphGroup }:<>f__AnonymousType0`3) [Update-MgGroup_Update], Exception
    + FullyQualifiedErrorId : Request_BadRequest,Microsoft.Graph.PowerShell.Cmdlets.UpdateMgGroup_Update
SDK Version

2.26.1

Latest version known to work for scenario above?

2.25.0

Known Workarounds

Use version 2.25.0 of Microsoft.Graph.Groups

Debug output
Click to expand log
PS > Update-MgGroup -GroupId $groupID -BodyParameter $Properties -debug
DÉBOGUER : [CmdletBeginProcessing]: - Update-MgGroup begin processing with parameterSet 'Update'.

DÉBOGUER : [Authentication]: - AuthType: 'AppOnly', TokenCredentialType: 'ClientCertificate', ContextScope: 'Process', AppName: 'CeA - Microsoft Graph Systèmes-Collaboratifs'.

DÉBOGUER : [Authentication]: - Scopes: [TeamSettings.ReadWrite.All, TeamMember.Read.All, Place.Read.All, Teamwork.Migrate.All, OnlineMeetings.Read.All, UserAuthenticationMethod.Read.All, OnlineMeetingArtifact.Read.All, 
ChannelSettings.Read.All, OnlineMeetingRecording.Read.All, Calendars.Read, Mail.ReadBasic.All, Group.Read.All, Directory.ReadWrite.All, Sites.Read.All, Sites.ReadWrite.All, Team.Create, Group.ReadWrite.All, Directory.Read.All, User.Read.All, 
ChannelMember.Read.All, GroupMember.Read.All, Files.Read.All, LicenseAssignment.ReadWrite.All, AuditLog.Read.All, Reports.Read.All, TeamworkDevice.Read.All].

DÉBOGUER : ============================ HTTP REQUEST ============================

HTTP Method:
PATCH

Absolute Uri:
https://graph.microsoft.com/v1.0/groups/de19ce7e-3894-4af2-bfd0-1b7374afb0a1

Headers:
FeatureFlag                   : 00000003
Cache-Control                 : no-store, no-cache
User-Agent                    : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.19045; fr-FR),PowerShell/2024.4.0
SdkVersion                    : graph-powershell/2.26.1
client-request-id             : 1862cde5-4c7d-438f-8f4b-0ee214a77988

Body:
Skipped: Content body was disposed before the logger could access it.

DÉBOGUER : ============================ HTTP RESPONSE ============================

Status Code:
BadRequest

Headers:
Transfer-Encoding             : chunked
Vary                          : Accept-Encoding
Strict-Transport-Security     : max-age=31536000
request-id                    : e5eedc11-ffae-4670-b0c7-776296981336
client-request-id             : 1862cde5-4c7d-438f-8f4b-0ee214a77988
x-ms-ags-diagnostic           : {"ServerInfo":{"DataCenter":"France Central","Slice":"E","Ring":"5","ScaleUnit":"003","RoleInstance":"PA1PEPF00102A3B"}}
x-ms-resource-unit            : 1
Cache-Control                 : no-cache
Date                          : Wed, 19 Mar 2025 10:20:46 GMT

Body:
{
  "error": {
    "code": "Request_BadRequest",
    "message": "Invalid property 'extension_appId_extensionName'.",
    "innerError": {
      "date": "2025-03-19T10:20:47",
      "request-id": "e5eedc11-ffae-4670-b0c7-776296981336",
      "client-request-id": "1862cde5-4c7d-438f-8f4b-0ee214a77988"
    }
  }
}


Invalid property 'extension_appId_extensionName'.

Status: 400 (BadRequest)
ErrorCode: Request_BadRequest
Date: 2025-03-19T10:20:47

Headers:
Transfer-Encoding             : chunked
Vary                          : Accept-Encoding
Strict-Transport-Security     : max-age=31536000
request-id                    : e5eedc11-ffae-4670-b0c7-776296981336
client-request-id             : 1862cde5-4c7d-438f-8f4b-0ee214a77988
x-ms-ags-diagnostic           : {"ServerInfo":{"DataCenter":"France Central","Slice":"E","Ring":"5","ScaleUnit":"003","RoleInstance":"PA1PEPF00102A3B"}}
x-ms-resource-unit            : 1
Cache-Control                 : no-cache
Date                          : Wed, 19 Mar 2025 10:20:46 GMT

Update-MgGroup : Invalid property 'extension_appId_extensionName'.
Status: 400 (BadRequest)
ErrorCode: Request_BadRequest
Date: 2025-03-19T10:20:47
Headers:
Transfer-Encoding             : chunked
Vary                          : Accept-Encoding
Strict-Transport-Security     : max-age=31536000
request-id                    : e5eedc11-ffae-4670-b0c7-776296981336
client-request-id             : 1862cde5-4c7d-438f-8f4b-0ee214a77988
x-ms-ags-diagnostic           : {"ServerInfo":{"DataCenter":"France Central","Slice":"E","Ring":"5","ScaleUnit":"003","RoleInstance":"PA1PEPF00102A3B"}}
x-ms-resource-unit            : 1
Cache-Control                 : no-cache
Date                          : Wed, 19 Mar 2025 10:20:46 GMT
Au caractère Ligne:1 : 1
+ Update-MgGroup -GroupId $groupID -BodyParameter $Properties -debug
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation : ({ GroupId = de1...oftGraphGroup }:<>f__AnonymousType0`3) [Update-MgGroup_Update], Exception
    + FullyQualifiedErrorId : Request_BadRequest,Microsoft.Graph.PowerShell.Cmdlets.UpdateMgGroup_Update
DÉBOGUER : [CmdletEndProcessing]: - Update-MgGroup end processing.
Configuration

Powershell integrated terminal in VS Code

Name                           Value
----                           -----
PSVersion                      5.1.19041.5607
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.5607
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
Other information

No response

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia riproducendo PATCH tramite Update-MgGroup con Microsoft.Graph.Groups 2.26.1, quindi confronta lo stesso comando con 2.25.0 utilizzando le versioni e la configurazione di PowerShell indicate nel report. Traccia il percorso della richiesta di Update-MgGroup e verifica che le proprietà di estensione della directory personalizzate con più valori vengano nuovamente accettate senza l'errore Invalid property.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
powershell
Ambito
api, cli
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.