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

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

Open cyrkin opened this issue 8 months ago • 12 comments

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

cyrkin avatar Mar 19 '25 10:03 cyrkin

@cyrkin please share your debug output again. I am not able to see the request body.

timayabi2020 avatar Mar 20 '25 09:03 timayabi2020

Okay, that's embarrassing, I wanted to remove our data from the examples I provided, so I provided some with other data, and those examples actually work in 2.26.1... Sorry

Yet, my original use case still does not work in 2.26.1 and works in 2.25. So here are the results for my examples and my original use case.

What works in both versions : examples provided, trying to push a simple list in the extension attribute. What does not work in 2.26.1 : same but the strings in my list are JSON formatted.

1. Works in 2.25.0 and 2.26.1 => Forget this example

$groupID = GROUPID

$values = @()
$values += "Hello"
$values += "Hello2"

$Properties = @{}
$Properties.Add('extension_AppId_extensionName', $values)

Update-MgGroup -GroupId $groupID -BodyParameter $Properties

It actually works in 2.26.1, sorry for the wrong examples

Debug output

Click to expand log
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/GROUPID

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/5.1.19041.5607
SdkVersion                    : graph-powershell/2.26.1
client-request-id             : 5fc1bb05-3545-4df0-8f6e-d318a6da67af

Body:
{
  "extension_AppId_extensionName": [
    "Hello",
    "Hello2"
  ]
}

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

Status Code:
NoContent

Headers:
Strict-Transport-Security     : max-age=31536000
request-id                    : 714573bb-8203-48f1-a45b-a336a6ec94a5
client-request-id             : 5fc1bb05-3545-4df0-8f6e-d318a6da67af
x-ms-ags-diagnostic           : {"ServerInfo":{"DataCenter":"France Central","Slice":"E","Ring":"5","ScaleUnit":"002","RoleInstance":"PA3PEPF0000FD0A"}}
x-ms-resource-unit            : 1
Cache-Control                 : no-cache
Date                          : Fri, 21 Mar 2025 13:32:05 GMT

Body:

DÉBOGUER : [CmdletEndProcessing]: - Update-MgGroup end processing.

2. Works in 2.25.0 **and NOT in ** 2.26.1

$teamProperties = @()
$teamProperties += @{"OriginalDisplayName" = 'Hello'}
$teamProperties += @{"TeamType" = "Hello2" }

$teamPropertiesList = @()
foreach ($teamProperty in $teamProperties)
{
    $teamPropertiesList += $teamProperty | ConvertTo-Json -Compress
}

$Properties = @{}
$Properties.Add('extension_AppId_extensionName', $teamPropertiesList)

Update-MgGroup -GroupId $groupID -BodyParameter $Properties

Update-MgGroup : Invalid property 'extension_AppId_extensionName'.
Status: 400 (BadRequest)     
ErrorCode: Request_BadRequest
Date: 2025-03-21T13:35:40
Headers:
Transfer-Encoding             : chunked
Vary                          : Accept-Encoding
Strict-Transport-Security     : max-age=31536000
request-id                    : f9eeb6d3-6215-46b1-bf0f-1d40ef42f199
client-request-id             : fafca413-e518-4000-b958-497fdc3f3c2b
x-ms-ags-diagnostic           : {"ServerInfo":{"DataCenter":"France Central","Slice":"E","Ring":"5","ScaleUnit":"005","RoleInstance":"PA3PEPF000062F0"}}
x-ms-resource-unit            : 1
Cache-Control                 : no-cache
Date                          : Fri, 21 Mar 2025 13:35:40 GMT
Au caractère Ligne:1 : 1
+ Update-MgGroup -GroupId $groupID -BodyParameter $Properties
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation : ({ GroupId = 8a4...oftGraphGroup }:<>f__AnonymousType0`3) [Update-MgGroup_Update], Exception
    + FullyQualifiedErrorId : Request_BadRequest,Microsoft.Graph.PowerShell.Cmdlets.UpdateMgGroup_Update

Debug output

Click to expand log
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/GROUPID

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/5.1.19041.5607
SdkVersion                    : graph-powershell/2.26.1
client-request-id             : a4df462c-0b4d-4e50-b314-86c0fb567ee0

Body:
{
  "extension_AppId_extensionName": [
    {
      "OriginalDisplayName": "Hello"
    },
    {
      "TeamType": "Hello2"
    }
  ]
}


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

Status Code:
BadRequest

Headers:
Transfer-Encoding             : chunked
Vary                          : Accept-Encoding
Strict-Transport-Security     : max-age=31536000
request-id                    : fd8e1345-1cc2-4391-8c54-d74a66bbee29
client-request-id             : a4df462c-0b4d-4e50-b314-86c0fb567ee0
x-ms-ags-diagnostic           : {"ServerInfo":{"DataCenter":"France Central","Slice":"E","Ring":"5","ScaleUnit":"005","RoleInstance":"PA3PEPF000062F0"}}
x-ms-resource-unit            : 1
Cache-Control                 : no-cache
Date                          : Fri, 21 Mar 2025 13:36:14 GMT

Body:
{
  "error": {
    "code": "Request_BadRequest",
    "message": "Invalid property 'extension_AppId_extensionName'.",
    "innerError": {
      "date": "2025-03-21T13:36:14",
      "request-id": "fd8e1345-1cc2-4391-8c54-d74a66bbee29",
      "client-request-id": "a4df462c-0b4d-4e50-b314-86c0fb567ee0"
    }
  }
}


Invalid property 'extension_AppId_extensionName'.

Status: 400 (BadRequest)
ErrorCode: Request_BadRequest
Date: 2025-03-21T13:36:14

Headers:
Transfer-Encoding             : chunked
Vary                          : Accept-Encoding
Strict-Transport-Security     : max-age=31536000
request-id                    : fd8e1345-1cc2-4391-8c54-d74a66bbee29
client-request-id             : a4df462c-0b4d-4e50-b314-86c0fb567ee0
x-ms-ags-diagnostic           : {"ServerInfo":{"DataCenter":"France Central","Slice":"E","Ring":"5","ScaleUnit":"005","RoleInstance":"PA3PEPF000062F0"}}
x-ms-resource-unit            : 1
Cache-Control                 : no-cache
Date                          : Fri, 21 Mar 2025 13:36:14 GMT

Update-MgGroup : Invalid property 'extension_AppId_extensionName'.
Status: 400 (BadRequest)
ErrorCode: Request_BadRequest
Date: 2025-03-21T13:36:14
Headers:
Transfer-Encoding             : chunked
Vary                          : Accept-Encoding
Strict-Transport-Security     : max-age=31536000
request-id                    : fd8e1345-1cc2-4391-8c54-d74a66bbee29
client-request-id             : a4df462c-0b4d-4e50-b314-86c0fb567ee0
x-ms-ags-diagnostic           : {"ServerInfo":{"DataCenter":"France Central","Slice":"E","Ring":"5","ScaleUnit":"005","RoleInstance":"PA3PEPF000062F0"}}
x-ms-resource-unit            : 1
Cache-Control                 : no-cache
Date                          : Fri, 21 Mar 2025 13:36:14 GMT
Au caractère Ligne:1 : 1
+ Update-MgGroup -GroupId $groupID -BodyParameter $Properties -debug
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation : ({ GroupId = 8a4...oftGraphGroup }:<>f__AnonymousType0`3) [Update-MgGroup_Update], Exception
    + FullyQualifiedErrorId : Request_BadRequest,Microsoft.Graph.PowerShell.Cmdlets.UpdateMgGroup_Update
DÉBOGUER : [CmdletEndProcessing]: - Update-MgGroup end processing.

Now the same Debug output but in 2.25.0 with same code : it works

Click to expand log
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/GROUPID

Headers:
FeatureFlag                   : 00000043
Cache-Control                 : no-store, no-cache
User-Agent                    : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.19045; fr-FR),PowerShell/5.1.19041.5607
Accept-Encoding               : gzip
SdkVersion                    : graph-powershell/2.25.0
client-request-id             : 64db8b47-8d4e-41d9-b5ab-10c5137934ee

Body:
{
  "extension_AppId_extensionName": [
    "{\"OriginalDisplayName\":\"Hello\"}",
    "{\"TeamType\":\"Hello2\"}"
  ]
}

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

Status Code:
NoContent

Headers:A
Strict-Transport-Security     : max-age=31536000
request-id                    : ba9dc009-1be5-4cf9-a12c-4fa158bfb055
client-request-id             : 64db8b47-8d4e-41d9-b5ab-10c5137934ee
x-ms-ags-diagnostic           : {"ServerInfo":{"DataCenter":"France Central","Slice":"E","Ring":"5","ScaleUnit":"004","RoleInstance":"PA2PEPF000115B4"}}
x-ms-resource-unit            : 1
Cache-Control                 : no-cache
Date                          : Fri, 21 Mar 2025 13:40:23 GMT

Body:


DÉBOGUER : [CmdletEndProcessing]: - Update-MgGroup end processing.

As a summary

Using the same parameter, working Body in 2.25.0 :

Body:
{
  "extension_AppId_extensionName": [
    "{\"OriginalDisplayName\":\"Hello\"}",
    "{\"TeamType\":\"Hello2\"}"
  ]
}

And non-working Body in 2.26.1 :

Body:
{
  "extension_AppId_extensionName": [
    {
      "OriginalDisplayName": "Hello"
    },
    {
      "TeamType": "Hello2"
    }
  ]
}

cyrkin avatar Mar 21 '25 13:03 cyrkin

From your debug information, I can see that you are trying to send "extension_AppId_extensionName" as a property. "AppId" in that string is not valid because it needs to be the actual app Id as per what is registered in your tenant. Please refer to this article https://learn.microsoft.com/en-us/graph/api/application-post-extensionproperty?view=graph-rest-1.0&tabs=powershell on how to create an extension property first, then use it in the Update-MgGroup cmdlet.

Here is what I did.

Image

timayabi2020 avatar Mar 24 '25 08:03 timayabi2020

Hello @timayabi2020

I know it needs to be the actual app Id as per what is registered in my tenant, or else it wouldn't work in v2.25.0. I just replaced the actual appId and extensionName in my examples to remove all tenant-related data.

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

As per my examples, it works in 2.25.0 and not in 2.26.1 when I want to update my multi-valued string Directory extension with each line being json-formated. The v2.26.1 somehow converts (or interprets) the Json before generating the Body it then sends, which the v2.25.0 does not do (see part "as a summary" of my last message where I highlighted both Bodys from the debug in v 2.25.0 and then in v2.26.1). v2.25.0 takes the string as it is, even if containing json-formatted content.

Sorry, english is not my native language, if something is not clear, do not hesitate to ask me for another explanation.

cyrkin avatar Mar 24 '25 09:03 cyrkin

Here's how I construct my parameters :

$teamProperties = @()
$teamProperties += @{"OriginalDisplayName" = 'Hello'}
$teamProperties += @{"TeamType" = "Hello2" }

$teamPropertiesList = @()
foreach ($teamProperty in $teamProperties)
{
    $teamPropertiesList += $teamProperty | ConvertTo-Json -Compress
}

$Properties = @{}
$Properties.Add('extension_AppId_extensionName', $teamPropertiesList)

Here's what it looks like at each step :

PS > $teamProperties    

Name                           Value
----                           -----
OriginalDisplayName            Hello
TeamType                       Hello2


PS > $teamPropertiesList
{"OriginalDisplayName":"Hello"}
{"TeamType":"Hello2"}

PS > $Properties

Name                           Value
----                           -----
extension_4cb32694a6c241af9... {{"OriginalDisplayName":"Hello"}, {"TeamType":"Hello2"}}

When I run Update-MgGroup -GroupId $groupID -BodyParameter $Properties -debug

Here is the Body in V2.25.0 :

Body:
{
  "extension_AppId_extensionName": [
    "{\"OriginalDisplayName\":\"Hello\"}",
    "{\"TeamType\":\"Hello2\"}"
  ]
}

And here is the body in V2.26.1 :

Body:
{
  "extension_AppId_extensionName": [
    {
      "OriginalDisplayName": "Hello"
    },
    {
      "TeamType": "Hello2"
    }
  ]
}

V2.25.0 of course succeeds, and V2.26.1 fails with the following error message :

Invalid property 'extension_AppId_extensionName'.

cyrkin avatar Mar 24 '25 09:03 cyrkin

This is now weird. I'm using version 2.25.0

Image. I'm using this tool https://developer.microsoft.com/en-us/graph/graph-explorer too . Please try it on your end and let me know.

Image

timayabi2020 avatar Mar 24 '25 09:03 timayabi2020

Yup definitely weird. Did you declare the Directory extension as multi-valued at first ?

New-MgApplicationExtensionProperty -Name "ExtensionName" -DataType "String" -TargetObjects "Group" -IsMultiValued -ApplicationId "AppId"

Could explain the error in your second screenshot. But for the first one... no clue

cyrkin avatar Mar 24 '25 10:03 cyrkin

Yes I did.

Image

timayabi2020 avatar Mar 24 '25 10:03 timayabi2020

Works for me in Graph Explorer :

Image

Image

cyrkin avatar Mar 24 '25 10:03 cyrkin

You can try and change your request body on graph explorer to the other one and share the outcome. I mean this

{
  "extension_AppId_extensionName": [
    {
      "OriginalDisplayName": "Hello"
    },
    {
      "TeamType": "Hello2"
    }
  ]
}

timayabi2020 avatar Mar 24 '25 11:03 timayabi2020

Not working :

Image

After that, to confirm the name of the extension is the right one, I converted the faulty Body to the working Body by hand (leaving the extension's name untouched) and it works (like in the screenshot in my previous message).

cyrkin avatar Mar 24 '25 11:03 cyrkin

Hello, Any news about this problem ? Is it by chance corrected in v2.27.0 ?

cyrkin avatar Apr 25 '25 09:04 cyrkin