microsoftgraph / msgraph-sdk-powershell

Powershell SDK for Microsoft Graph
https://www.powershellgallery.com/packages/Microsoft.Graph
Other
712 stars 172 forks source link

Invoke-MgInstantiateApplicationTemplate is running it is successfully creating the application, however throws an error #2135

Closed SuryenduB closed 1 year ago

SuryenduB commented 1 year ago

Describe the bug

When Invoke-MgInstantiateApplicationTemplate is running it is successfully creating the application, however throws an error

To Reproduce Steps to reproduce the behavior:

  1. Execute $params = @{ displayName = $displayName } Invoke-MgInstantiateApplicationTemplate -ApplicationTemplateId $applicationTemplateId -BodyParameter $params with ...
  2. See error at `Invoke-MgInstantiateApplicationTemplate : One or more errors occurred. At C:\Users\14784425548699500622\Documents\Scripts\AzureADScripts\AutomatedProvisioningEnterpriseA pp.ps1:57 char:2
    • Invoke-MgInstantiateApplicationTemplate -ApplicationTemplateId $a ...
    • CategoryInfo : NotSpecified: (:) [Invoke-MgInstan...ate_Instantiate], AggregateExc
      eption
    • FullyQualifiedErrorId : Microsoft.Graph.PowerShell.Cmdlets.InvokeMgInstantiateApplicationTe
      mplate_Instantiate`

Expected behavior

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

Debug Output

Run the problematic command with -Debug and paste the resulting debug stream below. ⚠ ATTENTION: Be sure to remove any sensitive information that may be in the logs. DEBUG: [CmdletBeginProcessing]: - Invoke-MgInstantiateApplicationTemplate begin processing with
parameterSet 'Instantiate'.

Confirm Continue with this operation? [Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): A DEBUG: [Authentication]: - AuthType: 'Delegated', TokenCredentialType: 'InteractiveBrowser', ContextScope: 'CurrentUser', AppName: 'Microsoft Graph Command Line Tools'. 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 Are you sure you want to perform this action? Performing the operation "Invoke-MgInstantiateApplicationTemplate_Instantiate" on target "Call
remote 'POST /applicationTemplates/{applicationTemplate-id}/microsoft.graph.instantiate' operation". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): A 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.<>cDisplayClass3_2.b__2() at Microsoft.Graph.PowerShell.Cmdlets.InvokeMgInstantiateApplicationTemplate_Instantiate.<>cDisplay Class52_0.b1() at Microsoft.Graph.PowerShell.Cmdlets.InvokeMgInstantiateApplicationTemplate_Instantiate.<Microsoft-G raph-PowerShell-Runtime-IEventListener-Signal>d52.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.d0.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.InvokeMgInstantiateApplicationTemplate_Instantiate.<Microsoft-G raph-PowerShell-Runtime-IEventListener-Signal>d
52.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.Applications.d463.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.Graph.PowerShell.Applications.d463.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.Applications.d
461.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.InvokeMgInstantiateApplicationTemplate_Instantiate.<ProcessReco rdAsync>d
54.MoveNext()'

Confirm One or more errors occurred. [Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): A Invoke-MgInstantiateApplicationTemplate : One or more errors occurred. At C:\Users\14784425548699500622\Documents\Scripts\AzureADScripts\AutomatedProvisioningEnterpriseA pp.ps1:57 char:2

DEBUG: [CmdletEndProcessing]: - Invoke-MgInstantiateApplicationTemplate end processing.

Module Version

Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version Name ExportedCommands


Manifest 2.0.0 Microsoft.Graph
Script 2.0.0 Microsoft.Graph.Applications {Add-MgApplicationKey, Add-MgApplicat... Script 2.0.0 Microsoft.Graph.Authentication {Connect-MgGraph, Disconnect-MgGraph,... Script 2.0.0 Microsoft.Graph.Beta.Applications {Add-MgBetaApplicationKey, Add-MgBeta... Script 2.0.0 Microsoft.Graph.Bookings {Get-MgBookingBusiness, Get-MgBooking... Script 2.0.0 Microsoft.Graph.Calendar {Get-MgGroupCalendar, Get-MgGroupCale... Script 2.0.0 Microsoft.Graph.ChangeNotifications {Get-MgSubscription, Invoke-MgReautho... Script 2.0.0 Microsoft.Graph.CloudCommunications {Add-MgCommunicationCallLargeGalleryV... Script 2.0.0 Microsoft.Graph.Compliance {Get-MgCompliance, Update-MgCompliance} Script 2.0.0 Microsoft.Graph.CrossDeviceExper... {Get-MgUserActivity, Get-MgUserActivi... Script 2.0.0 Microsoft.Graph.DeviceManagement {Get-MgDeviceManagement, Get-MgDevice... Script 2.0.0 Microsoft.Graph.DeviceManagement... {Clear-MgDeviceManagementManagedDevic... Script 2.0.0 Microsoft.Graph.DeviceManagement... {Get-MgDeviceManagementApplePushNotif... Script 2.0.0 Microsoft.Graph.DeviceManagement... {Get-MgDeviceManagementConditionalAcc... Script 2.0.0 Microsoft.Graph.DeviceManagement... {Confirm-MgDeviceManagementWindowsEnr... Script 2.0.0 Microsoft.Graph.Devices.CloudPrint {Get-MgPrint, Get-MgPrintConnector, G... Script 2.0.0 Microsoft.Graph.Devices.Corporat... {Get-MgDeviceAppManagement, Get-MgDev... Script 2.0.0 Microsoft.Graph.Devices.ServiceA... {Get-MgServiceAnnouncementHealthOverv... Script 2.0.0 Microsoft.Graph.DirectoryObjects {Confirm-MgDirectoryObjectMemberGroup... Script 2.0.0 Microsoft.Graph.Education {Get-MgEducationClass, Get-MgEducatio... Script 2.0.0 Microsoft.Graph.Files {Add-MgDriveListContentTypeCopy, Add-... Script 2.0.0 Microsoft.Graph.Groups {Add-MgGroupDriveListContentTypeCopy,... Script 2.0.0 Microsoft.Graph.Identity.Directo... {Confirm-MgContactMemberGroup, Confir... Script 2.0.0 Microsoft.Graph.Identity.Governance {Add-MgIdentityGovernanceAccessReview... Script 2.0.0 Microsoft.Graph.Identity.SignIns {Confirm-MgRiskyServicePrincipalCompr... Script 2.0.0 Microsoft.Graph.Mail {Get-MgUserInferenceClassification, G... Script 2.0.0 Microsoft.Graph.Notes {Get-MgGroupOnenoteNotebook, Get-MgGr... Script 2.0.0 Microsoft.Graph.People {Get-MgUserLastSharedMethodInsight, G... Script 2.0.0 Microsoft.Graph.PersonalContacts {Get-MgUserContact, Get-MgUserContact... Script 2.0.0 Microsoft.Graph.Planner {Get-MgGroupPlanner, Get-MgGroupPlann... Script 2.0.0 Microsoft.Graph.Reports {Get-MgAuditLogDirectoryAudit, Get-Mg... Script 2.0.0 Microsoft.Graph.SchemaExtensions {Get-MgSchemaExtension, Get-MgSchemaE... Script 2.0.0 Microsoft.Graph.Search {Add-MgExternalConnectionItemActivity... Script 2.0.0 Microsoft.Graph.Security {Add-MgSecurityCaseEdiscoveryCaseCust... Script 2.0.0 Microsoft.Graph.Sites {Add-MgSite, Add-MgSiteContentTypeCop... Script 2.0.0 Microsoft.Graph.Teams {Add-MgChatMember, Add-MgTeamChannelM... Script 2.0.0 Microsoft.Graph.Users {Get-MgUser, Get-MgUserCount, Get-MgU... Script 2.0.0 Microsoft.Graph.Users.Actions {Add-MgUserChatMember, Add-MgUserDriv... Script 2.0.0 Microsoft.Graph.Users.Functions {Export-MgUserDeviceAndAppManagementD...

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

peombwa commented 1 year ago

Same as https://github.com/microsoftgraph/msgraph-sdk-powershell/issues/2134#issuecomment-1626342916, the command works as expected in the latest version of the SDK: image

Try running Install-Module Microsoft.Graph -AllowClobber -Force to ensure the latest version of the SDK is installed on your machine, and that the prerequisites stated in the installation guide are met.

ghost commented 1 year ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.