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-MgBetaGroupSetting not working #3202

Open
AlyaKoni opened this issue Feb 28, 2025 · 1 comment
Open

New-MgBetaGroupSetting not working #3202

AlyaKoni opened this issue Feb 28, 2025 · 1 comment
Assignees
Labels
type:bug A broken experience

Comments

@AlyaKoni
Copy link

Describe the bug

Trying to create a new Group Directory Settings:

# Checking team guest settings
Write-Host "Checking team guest settings" -ForegroundColor $CommandInfo
$SettingTemplate = Get-MgBetaDirectorySettingTemplate | Where-Object { $_.DisplayName -eq "Group.Unified.Guest" }
$Setting = Get-MgBetaGroupSetting -GroupId $Team.GroupId | Where-Object { $_.TemplateId -eq $SettingTemplate.Id }
if (-Not $Setting)
{
    Write-Warning "Setting not yet created. Creating one based on template."
    $Values = @()
    foreach($dval in $SettingTemplate.Values) {
	    $Values += @{Name = $dval.Name; Value = $dval.DefaultValue}
    }
    $Setting = New-MgBetaGroupSetting -GroupId $Team.GroupId -DisplayName "Group.Unified.Guest" -TemplateId $SettingTemplate.Id -Values $Values
    $Setting = Get-MgBetaGroupSetting -GroupId $Team.GroupId | Where-Object { $_.TemplateId -eq $SettingTemplate.Id }
}

This gives the error:

New-MgBetaGroupSetting_CreateExpanded: D:\Repos\PFIBDO-ADM-CloudConfiguration\scripts\teams\Configure-DefaultTeam.ps1:268:5
Line |
 268 |      $Setting = New-MgBetaGroupSetting -GroupId $Team.GroupId -Display …
     |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot convert the literal 'True' to the expected type 'Edm.String'.  Status: 400 (BadRequest) ErrorCode: Request_BadRequest Date: 2025-02-28T21:32:42        
     | Headers: Cache-Control                 : no-cache Vary                          : Accept-Encoding Strict-Transport-Security     : max-age=31536000 request-id 
     | : f64855b2-06e0-4a15-9d4a-fe7229774bd6 client-request-id             : ff8a7b86-4244-4593-acae-9bc1bc612974 x-ms-ags-diagnostic           :
     | {"ServerInfo":{"DataCenter":"Switzerland North","Slice":"E","Ring":"3","ScaleUnit":"001","RoleInstance":"ZRH2EPF000000E8"}} x-ms-resource-unit            : 1 
     | Date                          : Fri, 28 Feb 2025 21:32:41 GMT

  Recommendation: See service error codes: https://learn.microsoft.com/graph/errors

This code works since years.

Expected behavior

The group setting should be created

How to reproduce

Run above code

SDK Version

Microsoft.Graph.Authentication 2.26.1 and Microsoft.Graph.Beta.Identity.DirectoryManagement 2.26.1 Microsoft.Graph.Beta.Groups 2.26.1

Latest version known to work for scenario above?

2.25.x

Known Workarounds

Rolling back modules

Debug output

Click to expand log ```

DEBUG: [CmdletBeginProcessing]: - New-MgBetaGroupSetting begin processing with parameterSet 'CreateExpanded'.
DEBUG: [Authentication]: - AuthType: 'Delegated', TokenCredentialType: 'InteractiveBrowser', ContextScope: 'CurrentUser', AppName: 'Microsoft Graph Command Line Tools'.
DEBUG: [Authentication]: - Scopes: [Application.ReadWrite.All, AppRoleAssignment.ReadWrite.All, AuditLog.Read.All, ChannelMessage.Send, Contacts.Read, CrossTenantInformation.ReadBasic.All, DelegatedPermissionGrant.ReadWrite.All, DeviceManagementApps.Read.All, DeviceManagementApps.ReadWrite.All, DeviceManagementConfiguration.Read.All, DeviceManagementConfiguration.ReadWrite.All, DeviceManagementManagedDevices.Read.All, DeviceManagementManagedDevices.ReadWrite.All, DeviceManagementRBAC.Read.All, DeviceManagementServiceConfig.Read.All, DeviceManagementServiceConfig.ReadWrite.All, Directory.AccessAsUser.All, Directory.Read.All, Directory.ReadWrite.All, Domain.ReadWrite.All, email, Group.ReadWrite.All, GroupMember.ReadWrite.All, openid, Organization.ReadWrite.All, OrganizationalBranding.ReadWrite.All, Policy.Read.All, Policy.ReadWrite.AuthenticationMethod, Policy.ReadWrite.Authorization, Policy.ReadWrite.ConditionalAccess, Policy.ReadWrite.CrossTenantAccess, Policy.ReadWrite.DeviceConfiguration, Policy.ReadWrite.PermissionGrant, profile, RoleAssignmentSchedule.ReadWrite.Directory, RoleEligibilitySchedule.Read.Directory, RoleEligibilitySchedule.ReadWrite.Directory, RoleManagement.Read.All, RoleManagement.ReadWrite.Directory, SharePointTenantSettings.ReadWrite.All, TeamMember.ReadWrite.All, TeamsApp.ReadWrite.All, TeamsAppInstallation.ReadWriteForTeam, TeamsAppInstallation.ReadWriteSelfForTeam, TeamSettings.ReadWrite.All, TeamsTab.ReadWrite.All, User.Read.All, User.ReadWrite.All, UserAuthenticationMethod.Read.All, UserAuthenticationMethod.ReadWrite.All, WindowsUpdates.ReadWrite.All].

Confirm
Are you sure you want to perform this action?
Performing the operation "New-MgBetaGroupSetting_CreateExpanded" on target "Call remote 'POST /groups/{group-id}/settings' operation".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): A
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
POST

Absolute Uri:
https://graph.microsoft.com/beta/groups/63033ace-e24f-4369-8ff9-aa7fe77c86ce/settings

Headers:
FeatureFlag : 00000003
Cache-Control : no-store, no-cache
User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.26100; de-CH),PowerShell/2025.0.0
SdkVersion : graph-powershell-beta/2.26.1
client-request-id : f834c5f7-96f6-4d8d-bd78-59d628670026
Accept-Encoding : gzip,deflate,br

Body:
{
"displayName": "Group.Unified.Guest",
"templateId": "08d542b9-071f-4e16-94b0-74abb372e3d9",
"values": [
{
"name": "AllowToAddGuests",
"value": true
}
]
}

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

Status Code:
BadRequest

Headers:
Cache-Control : no-cache
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : 07295345-7b07-4666-8d3d-08167b8e6ff7
client-request-id : f834c5f7-96f6-4d8d-bd78-59d628670026
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Switzerland North","Slice":"E","Ring":"3","ScaleUnit":"002","RoleInstance":"ZR2PEPF000000BA"}}
x-ms-resource-unit : 1
Date : Fri, 28 Feb 2025 21:39:24 GMT

Body:
{
"error": {
"code": "Request_BadRequest",
"message": "Cannot convert the literal 'True' to the expected type 'Edm.String'.",
"innerError": {
"date": "2025-02-28T21:39:25",
"request-id": "07295345-7b07-4666-8d3d-08167b8e6ff7",
"client-request-id": "f834c5f7-96f6-4d8d-bd78-59d628670026"
}
}
}

New-MgBetaGroupSetting_CreateExpanded: D:\Repos\PFIBDO-ADM-CloudConfiguration\scripts\teams\Configure-DefaultTeam.ps1:268:5
Line |
268 | $Setting = New-MgBetaGroupSetting -GroupId $Team.GroupId -Display …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Cannot convert the literal 'True' to the expected type 'Edm.String'. Status: 400 (BadRequest) ErrorCode: Request_BadRequest Date: 2025-02-28T21:39:25
| Headers: Cache-Control : no-cache Vary : Accept-Encoding Strict-Transport-Security : max-age=31536000 request-id
| : 07295345-7b07-4666-8d3d-08167b8e6ff7 client-request-id : f834c5f7-96f6-4d8d-bd78-59d628670026 x-ms-ags-diagnostic :
| {"ServerInfo":{"DataCenter":"Switzerland North","Slice":"E","Ring":"3","ScaleUnit":"002","RoleInstance":"ZR2PEPF000000BA"}} x-ms-resource-unit : 1
| Date : Fri, 28 Feb 2025 21:39:24 GMT

Recommendation: See service error codes: https://learn.microsoft.com/graph/errors

</details>


### Configuration

_No response_

### Other information

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

Automatic inferencing issue. Similar to #3187

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

No branches or pull requests

2 participants