Registry Mirror
Skip to content

New-MgGroup is giving error #2134

Closed
Closed

Description

Describe the bug

When I run New-MgGraph it is giving error as New-MgGroup : One or more errors occurred.

To Reproduce
Steps to reproduce the behavior:

  1. Execute New-MgGroup with -DisplayName 'Test Group' -MailEnabled:$False -MailNickName 'testgroup' -Security

  2. See error at `{
    "Exception": {
    "InnerExceptions": [
    "System.ObjectDisposedException: Cannot access a disposed object.\r\nObject name: \u0027System.Net.Http.StringContent\u0027.\r\n at System.Net.Http.HttpContent.CheckDisposed()\r\n at System.Net.Http.HttpContent.CopyToAsync(Stream stream, TransportContext context)\r\n at Microsoft.Graph.PowerShell.HttpMessageLogFormatter.\u003cCloneAsync\u003ed__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Graph.PowerShell.HttpMessageLogFormatter.\u003cGetHttpRequestLogAsync\u003ed__1.MoveNext()"
    ],
    "Message": "One or more errors occurred.",
    "Data": {

                            },
                   "InnerException":  {
                                          "Message":  "Cannot access a disposed object.\r\nObject name: \u0027System.Net.Http.StringContent\u0027.",
                                          "ObjectName":  "System.Net.Http.StringContent",
                                          "Data":  "System.Collections.ListDictionaryInternal",
                                          "InnerException":  null,
                                          "TargetSite":  "Void CheckDisposed()",
                                          "StackTrace":  "   at System.Net.Http.HttpContent.CheckDisposed()\r\n   at System.Net.Http.HttpContent.CopyToAsync(Stream stream, TransportContext context)\r\n   at Microsoft.Graph.PowerShell.HttpMessageLogFormatter.\u003cCloneAsync\u003ed__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.Graph.PowerShell.HttpMessageLogFormatter.\u003cGetHttpRequestLogAsync\u003ed__1.MoveNext()",
                                          "HelpLink":  null,
                                          "Source":  "System.Net.Http",
                                          "HResult":  -2146232798
                                      },
                   "TargetSite":  {
                                      "Name":  "ThrowIfExceptional",
                                      "DeclaringType":  "System.Threading.Tasks.Task",
                                      "ReflectedType":  "System.Threading.Tasks.Task",
                                      "MemberType":  8,
                                      "MetadataToken":  100679908,
                                      "Module":  "CommonLanguageRuntimeLibrary",
                                      "IsSecurityCritical":  false,
                                      "IsSecuritySafeCritical":  false,
                                      "IsSecurityTransparent":  true,
                                      "MethodHandle":  "System.RuntimeMethodHandle",
                                      "Attributes":  131,
                                      "CallingConvention":  33,
                                      "ReturnType":  "void",
                                      "ReturnTypeCustomAttributes":  "Void ",
                                      "ReturnParameter":  "Void ",
                                      "IsGenericMethod":  false,
                                      "IsGenericMethodDefinition":  false,
                                      "ContainsGenericParameters":  false,
                                      "MethodImplementationFlags":  0,
                                      "IsPublic":  false,
                                      "IsPrivate":  false,
                                      "IsFamily":  false,
                                      "IsAssembly":  true,
                                      "IsFamilyAndAssembly":  false,
                                      "IsFamilyOrAssembly":  false,
                                      "IsStatic":  false,
                                      "IsFinal":  false,
                                      "IsVirtual":  false,
                                      "IsHideBySig":  true,
                                      "IsAbstract":  false,
                                      "IsSpecialName":  false,
                                      "IsConstructor":  false,
                                      "CustomAttributes":  ""
                                  },
                   "StackTrace":  "   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)\r\n   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)\r\n   at System.Threading.Tasks.Task`1.get_Result()\r\n   at Microsoft.Graph.PowerShell.EventFactory.CreateLogEvent(Task`1 message)\r\n   at Microsoft.Graph.PowerShell.Module.\u003c\u003ec__DisplayClass3_2.\u003cOnResponseCreated\u003eb__2()\r\n   at Microsoft.Graph.PowerShell.Cmdlets.NewMgGroup_CreateExpanded.\u003c\u003ec__DisplayClass249_0.\u003cMicrosoft.Graph.PowerShell.Runtime.IEventListener.Signal\u003eb__1()\r\n   at Microsoft.Graph.PowerShell.Cmdlets.NewMgGroup_CreateExpanded.\u003cMicrosoft-Graph-PowerShell-Runtime-IEventListener-Signal\u003ed__249.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.Graph.PowerShell.Module.\u003cOnResponseCreated\u003ed__3.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.Graph.PowerShell.Module.\u003cEventHandler\u003ed__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.Graph.PowerShell.Module.\u003cSignal\u003ed__32.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.Graph.PowerShell.Cmdlets.NewMgGroup_CreateExpanded.\u003cMicrosoft-Graph-PowerShell-Runtime-IEventListener-Signal\u003ed__249.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.Graph.PowerShell.Groups.\u003cGroupCreateGroup_Call\u003ed__241.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at Microsoft.Graph.PowerShell.Groups.\u003cGroupCreateGroup_Call\u003ed__241.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.Graph.PowerShell.Groups.\u003cGroupCreateGroup\u003ed__236.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)\r\n   at Microsoft.Graph.PowerShell.Cmdlets.NewMgGroup_CreateExpanded.\u003cProcessRecordAsync\u003ed__252.MoveNext()",
                   "HelpLink":  null,
                   "Source":  "mscorlib",
                   "HResult":  -2146233088
               },
    

    "TargetObject": null,
    "CategoryInfo": {
    "Category": 0,
    "Activity": "New-MgGroup_CreateExpanded",
    "Reason": "AggregateException",
    "TargetName": "",
    "TargetType": ""
    },
    "FullyQualifiedErrorId": "Microsoft.Graph.PowerShell.Cmdlets.NewMgGroup_CreateExpanded",
    "ErrorDetails": null,
    "InvocationInfo": {
    "MyCommand": {
    "Verb": "New",
    "Noun": "MgGroup_CreateExpanded",
    "HelpFile": "Microsoft.Graph.Groups.private.dll-Help.xml",
    "PSSnapIn": null,
    "Version": "2.0.0.0",
    "ImplementingType": "Microsoft.Graph.PowerShell.Cmdlets.NewMgGroup_CreateExpanded",
    "Definition": "\r\nNew-MgGroup_CreateExpanded [-AcceptedSenders \u003cIMicrosoftGraphDirectoryObject[]\u003e] [-AdditionalProperties \u003chashtable\u003e] [-AllowExternalSenders] [-AppRoleAssignments \u003cIMicrosoftGraphAppRoleAssignment[]\u003e] [-AssignedLabels \u003cIMicrosoftGraphAssignedLabel[]\u003e] [-AssignedLicenses \u003cIMicrosoftGraphAssignedLicense[]\u003e] [-AutoSubscribeNewMembers] [-Break] [-Calendar \u003cIMicrosoftGraphCalendar\u003e] [-CalendarView \u003cIMicrosoftGraphEvent[]\u003e] [-Classification \u003cstring\u003e] [-Conversations \u003cIMicrosoftGraphConversation[]\u003e] [-CreatedDateTime \u003cdatetime\u003e] [-CreatedOnBehalfOf \u003cIMicrosoftGraphDirectoryObject\u003e] [-DeletedDateTime \u003cdatetime\u003e] [-Description \u003cstring\u003e] [-DisplayName \u003cstring\u003e] [-Drive \u003cIMicrosoftGraphDrive\u003e] [-Drives \u003cIMicrosoftGraphDrive[]\u003e] [-Events \u003cIMicrosoftGraphEvent[]\u003e] [-ExpirationDateTime \u003cdatetime\u003e] [-Extensions \u003cIMicrosoftGraphExtension[]\u003e] [-GroupLifecyclePolicies \u003cIMicrosoftGraphGroupLifecyclePolicy[]\u003e] [-GroupTypes \u003cstring[]\u003e] [-HasMembersWithLicenseErrors] [-HideFromAddressLists] [-HideFromOutlookClients] [-HttpPipelineAppend \u003cSendAsyncStep[]\u003e] [-HttpPipelinePrepend \u003cSendAsyncStep[]\u003e] [-Id \u003cstring\u003e] [-IsArchived] [-IsAssignableToRole] [-IsSubscribedByMail] [-LicenseProcessingState \u003cIMicrosoftGraphLicenseProcessingState\u003e] [-Mail \u003cstring\u003e] [-MailEnabled] [-MailNickname \u003cstring\u003e] [-MemberOf \u003cIMicrosoftGraphDirectoryObject[]\u003e] [-Members \u003cIMicrosoftGraphDirectoryObject[]\u003e] [-MembersWithLicenseErrors \u003cIMicrosoftGraphDirectoryObject[]\u003e] [-MembershipRule \u003cstring\u003e] [-MembershipRuleProcessingState \u003cstring\u003e] [-OnPremisesDomainName \u003cstring\u003e] [-OnPremisesLastSyncDateTime \u003cdatetime\u003e] [-OnPremisesNetBiosName \u003cstring\u003e] [-OnPremisesProvisioningErrors \u003cIMicrosoftGraphOnPremisesProvisioningError[]\u003e] [-OnPremisesSamAccountName \u003cstring\u003e] [-OnPremisesSecurityIdentifier \u003cstring\u003e] [-OnPremisesSyncEnabled] [-Onenote \u003cIMicrosoftGraphOnenote\u003e] [-Owners \u003cIMicrosoftGraphDirectoryObject[]\u003e] [-PermissionGrants \u003cIMicrosoftGraphResourceSpecificPermissionGrant[]\u003e] [-Photo \u003cIMicrosoftGraphProfilePhoto\u003e] [-Photos \u003cIMicrosoftGraphProfilePhoto[]\u003e] [-Planner \u003cIMicrosoftGraphPlannerGroup\u003e] [-PreferredDataLocation \u003cstring\u003e] [-PreferredLanguage \u003cstring\u003e] [-Proxy \u003curi\u003e] [-ProxyAddresses \u003cstring[]\u003e] [-ProxyCredential \u003cpscredential\u003e] [-ProxyUseDefaultCredentials] [-RejectedSenders \u003cIMicrosoftGraphDirectoryObject[]\u003e] [-RenewedDateTime \u003cdatetime\u003e] [-SecurityEnabled] [-SecurityIdentifier \u003cstring\u003e] [-Settings \u003cIMicrosoftGraphGroupSetting[]\u003e] [-Sites \u003cIMicrosoftGraphSite[]\u003e] [-Team \u003cIMicrosoftGraphTeam\u003e] [-Theme \u003cstring\u003e] [-Threads \u003cIMicrosoftGraphConversationThread[]\u003e] [-TransitiveMemberOf \u003cIMicrosoftGraphDirectoryObject[]\u003e] [-TransitiveMembers \u003cIMicrosoftGraphDirectoryObject[]\u003e] [-UnseenCount \u003cint\u003e] [-Visibility \u003cstring\u003e] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\r\n",
    "DefaultParameterSet": null,
    "OutputType": "Microsoft.Graph.PowerShell.Models.IMicrosoftGraphGroup",
    "Options": 1,
    "Name": "New-MgGroup_CreateExpanded",
    "CommandType": 8,
    "Source": "Microsoft.Graph.Groups.private",
    "Visibility": 0,
    "ModuleName": "Microsoft.Graph.Groups.private",
    "Module": "Microsoft.Graph.Groups.private",
    "RemotingCapability": 1,
    "Parameters": "System.Collections.Generic.Dictionary`2[System.String,System.Management.Automation.ParameterMetadata]",
    "ParameterSets": "[-AcceptedSenders \u003cIMicrosoftGraphDirectoryObject[]\u003e] [-AdditionalProperties \u003chashtable\u003e] [-AllowExternalSenders] [-AppRoleAssignments \u003cIMicrosoftGraphAppRoleAssignment[]\u003e] [-AssignedLabels \u003cIMicrosoftGraphAssignedLabel[]\u003e] [-AssignedLicenses \u003cIMicrosoftGraphAssignedLicense[]\u003e] [-AutoSubscribeNewMembers] [-Break] [-Calendar \u003cIMicrosoftGraphCalendar\u003e] [-CalendarView \u003cIMicrosoftGraphEvent[]\u003e] [-Classification \u003cstring\u003e] [-Conversations \u003cIMicrosoftGraphConversation[]\u003e] [-CreatedDateTime \u003cdatetime\u003e] [-CreatedOnBehalfOf \u003cIMicrosoftGraphDirectoryObject\u003e] [-DeletedDateTime \u003cdatetime\u003e] [-Description \u003cstring\u003e] [-DisplayName \u003cstring\u003e] [-Drive \u003cIMicrosoftGraphDrive\u003e] [-Drives \u003cIMicrosoftGraphDrive[]\u003e] [-Events \u003cIMicrosoftGraphEvent[]\u003e] [-ExpirationDateTime \u003cdatetime\u003e] [-Extensions \u003cIMicrosoftGraphExtension[]\u003e] [-GroupLifecyclePolicies \u003cIMicrosoftGraphGroupLifecyclePolicy[]\u003e] [-GroupTypes \u003cstring[]\u003e] [-HasMembersWithLicenseErrors] [-HideFromAddressLists] [-HideFromOutlookClients] [-HttpPipelineAppend \u003cSendAsyncStep[]\u003e] [-HttpPipelinePrepend \u003cSendAsyncStep[]\u003e] [-Id \u003cstring\u003e] [-IsArchived] [-IsAssignableToRole] [-IsSubscribedByMail] [-LicenseProcessingState \u003cIMicrosoftGraphLicenseProcessingState\u003e] [-Mail \u003cstring\u003e] [-MailEnabled] [-MailNickname \u003cstring\u003e] [-MemberOf \u003cIMicrosoftGraphDirectoryObject[]\u003e] [-Members \u003cIMicrosoftGraphDirectoryObject[]\u003e] [-MembersWithLicenseErrors \u003cIMicrosoftGraphDirectoryObject[]\u003e] [-MembershipRule \u003cstring\u003e] [-MembershipRuleProcessingState \u003cstring\u003e] [-OnPremisesDomainName \u003cstring\u003e] [-OnPremisesLastSyncDateTime \u003cdatetime\u003e] [-OnPremisesNetBiosName \u003cstring\u003e] [-OnPremisesProvisioningErrors \u003cIMicrosoftGraphOnPremisesProvisioningError[]\u003e] [-OnPremisesSamAccountName \u003cstring\u003e] [-OnPremisesSecurityIdentifier \u003cstring\u003e] [-OnPremisesSyncEnabled] [-Onenote \u003cIMicrosoftGraphOnenote\u003e] [-Owners \u003cIMicrosoftGraphDirectoryObject[]\u003e] [-PermissionGrants \u003cIMicrosoftGraphResourceSpecificPermissionGrant[]\u003e] [-Photo \u003cIMicrosoftGraphProfilePhoto\u003e] [-Photos \u003cIMicrosoftGraphProfilePhoto[]\u003e] [-Planner \u003cIMicrosoftGraphPlannerGroup\u003e] [-PreferredDataLocation \u003cstring\u003e] [-PreferredLanguage \u003cstring\u003e] [-Proxy \u003curi\u003e] [-ProxyAddresses \u003cstring[]\u003e] [-ProxyCredential \u003cpscredential\u003e] [-ProxyUseDefaultCredentials] [-RejectedSenders \u003cIMicrosoftGraphDirectoryObject[]\u003e] [-RenewedDateTime \u003cdatetime\u003e] [-SecurityEnabled] [-SecurityIdentifier \u003cstring\u003e] [-Settings \u003cIMicrosoftGraphGroupSetting[]\u003e] [-Sites \u003cIMicrosoftGraphSite[]\u003e] [-Team \u003cIMicrosoftGraphTeam\u003e] [-Theme \u003cstring\u003e] [-Threads \u003cIMicrosoftGraphConversationThread[]\u003e] [-TransitiveMemberOf \u003cIMicrosoftGraphDirectoryObject[]\u003e] [-TransitiveMembers \u003cIMicrosoftGraphDirectoryObject[]\u003e] [-UnseenCount \u003cint\u003e] [-Visibility \u003cstring\u003e] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]"
    },
    "BoundParameters": {

                                            },
                        "UnboundArguments":  [
    
                                             ],
                        "ScriptLineNumber":  1,
                        "OffsetInLine":  1,
                        "HistoryId":  10,
                        "ScriptName":  "",
                        "Line":  "New-MgGroup -DisplayName \u0027Test Group\u0027 -MailEnabled:$False  -MailNickName \u0027testgroup\u0027 -SecurityEnabled",
                        "PositionMessage":  "At line:1 char:1\r\n+ New-MgGroup -DisplayName \u0027Test Group\u0027 -MailEnabled:$False  -MailNickN ...\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~",
                        "PSScriptRoot":  "",
                        "PSCommandPath":  null,
                        "InvocationName":  "New-MgGroup",
                        "PipelineLength":  0,
                        "PipelinePosition":  0,
                        "ExpectingInput":  false,
                        "CommandOrigin":  1,
                        "DisplayScriptPosition":  null
                    },
    

    "ScriptStackTrace": "at New-MgGroup\u003cProcess\u003e, C:\Program Files\WindowsPowerShell\Modules\Microsoft.Graph.Groups\2.0.0\exports\ProxyCmdletDefinitions.ps1: line 75567\r\nat \u003cScriptBlock\u003e, \u003cNo file\u003e: line 1",
    "PipelineIterationInfo": [
    0,
    1
    ],
    "writeErrorStream": true,
    "PSMessageDetails": null
    }
    `

Expected behavior

A clear and concise description of what you expected to happen.

Debug Output
New-MgGroup -DisplayName 'Test Group' -MailEnabled:$False -MailNickName 'testgroup' -SecurityEnabled -Debug
DEBUG: [CmdletBeginProcessing]: - New-MgGroup begin processing with parameterSet 'CreateExpanded'.

Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): Y
DEBUG: [Authentication]: - AuthType: 'Delegated', TokenCredentialType: 'InteractiveBrowser', ContextScope: 'CurrentUser', AppName: 'Microsoft
Graph Command Line Tools'.

Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): Y
DEBUG: [Authentication]: - Scopes: [AdministrativeUnit.ReadWrite.All, Application.Read.All, Application.ReadWrite.All,
AppRoleAssignment.ReadWrite.All, AuditLog.Read.All, CrossTenantInformation.ReadBasic.All, CustomSecAttributeDefinition.Read.All,
CustomSecAttributeDefinition.ReadWrite.All, Directory.AccessAsUser.All, Directory.Read.All, Directory.ReadWrite.All,
DirectoryRecommendations.Read.All, EntitlementManagement.Read.All, openid, Organization.Read.All, Policy.Read.All, profile,
RoleAssignmentSchedule.Read.Directory, RoleEligibilitySchedule.Read.Directory, RoleManagement.Read.All, RoleManagement.ReadWrite.Directory,
Synchronization.Read.All, Synchronization.ReadWrite.All, User.Read, User.Read.All, User.ReadWrite.All, UserAuthenticationMethod.Read.All, email].

Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): Y

Confirm
Are you sure you want to perform this action?
Performing the operation "New-MgGroup_CreateExpanded" on target "Call remote 'POST /groups' operation".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Y
DEBUG: [CmdletException]: Received exception with message 'AggregateException - One or more errors occurred. : at
System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at System.Threading.Tasks.Task1.get_Result()
at Microsoft.Graph.PowerShell.EventFactory.CreateLogEvent(Task`1 message)
at Microsoft.Graph.PowerShell.Module.<>c__DisplayClass3_2.b__2()
at
Microsoft.Graph.PowerShell.Cmdlets.NewMgGroup_CreateExpanded.<>c__DisplayClass249_0.<Microsoft.Graph.PowerShell.Runtime.IEventListener.Signal>b__
1()
at Microsoft.Graph.PowerShell.Cmdlets.NewMgGroup_CreateExpanded.d__249.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Graph.PowerShell.Module.d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Graph.PowerShell.Module.d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Graph.PowerShell.Module.d__32.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Graph.PowerShell.Cmdlets.NewMgGroup_CreateExpanded.d__249.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Graph.PowerShell.Groups.<GroupCreateGroup_Call>d__241.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Graph.PowerShell.Groups.<GroupCreateGroup_Call>d__241.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Graph.PowerShell.Groups.d__236.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at Microsoft.Graph.PowerShell.Cmdlets.NewMgGroup_CreateExpanded.d__252.MoveNext()'

Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): y

Confirm
One or more errors occurred.
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): y
New-MgGroup : One or more errors occurred.
At line:1 char:1

  • New-MgGroup -DisplayName 'Test Group' -MailEnabled:$False -MailNickN ...
  •   + CategoryInfo          : NotSpecified: (:) [New-MgGroup_CreateExpanded], AggregateException
      + FullyQualifiedErrorId : Microsoft.Graph.PowerShell.Cmdlets.NewMgGroup_CreateExpanded
    
    

DEBUG: [CmdletEndProcessing]: - New-MgGroup end processing.

Module Version

Please run Get-Module Microsoft.Graph* after cmdlet execution and paste the output below.
If a module cannot be installed or imported, please run Get-Module -ListAvailable and paste the output.

Environment Data

Name Value


PSVersion 5.1.22000.2003
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.22000.2003
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Activity

  1. peombwa commented on Jul 7, 2023

    @peombwa
    Member

    Thanks for bringing this to our attention.

    Is this an intermittent issue? The command works as expected in PowerShell 5.1 using the latest version of the SDK (v2.0.0):
    image

    Which version of the SDK are you using? Are you running the prerelease versions? Please share the output of the following Get-InstalledModule Microsoft.Graph.Groups -AllVersions.

  2. ghost closed this as completedon Jul 15, 2023
  3. tophattwaffle commented on Jul 31, 2023

    @tophattwaffle

    Experiencing the same issue. Microsoft.Graph.Groups version 2.2.0, with PS 5.1

    I should note that the group is actually created when I check in the Entra portal on my browser. However due to the error, I can't do anything with the result unless I explicitly get the group with another command.

    image

    Fully removing Microsoft.Graph version 2.2.0 and then installing 1.28.0 does not have this issue.
    image

    Edit: Powershell version 7 works fine with Microsoft.Graph version 2.2.0. Seems to be a problem when you are using PS 5.1 + MS.Graph 2.2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions