-
Notifications
You must be signed in to change notification settings - Fork 173
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
Random failures for Set-MgUserPhotoContent #2360
Comments
Thanks for bringing this to our attention. Could you please share the output of |
@peombwa , we are not using Powershell 7 yet |
Same here as @tkudya But on every upload try. Same in pwsh7. |
Here are the log outputs for Powershell 5:
I'll post an update once I test with Powershell 7. |
I am having the same issue. On PowerShell 7 with Microsoft.Graph.Users module version 2.2. Below is the error `writeErrorStream : True |
As of now, I have not been able to reproduce the issue with Powershell 7. I installed it via the x64 MSI file and did not add it to the path nor ticked any other checkbox during the installation. Seems to be working for now. |
Thanks for confirming and providing the stack trace. We will use this issue to investigate why the error is occurring in PowerShell 5.1. @tschwa21, you may want to first update your SDK to version 2.8.0. Several improvements and bug fixes have been made to the SDK since v2.2.0. See release notes at https://github.com/microsoftgraph/msgraph-sdk-powershell/releases for more details. |
Same issue here on 2.8.0 version. On my Windows 10 system it works fine, but on Server 2016 it fails almost for every user with error "An error occurred while sending the request." What seems to solve the issue on the Server OS is to resize the images to the height of 188 pixels and add some wait time between Set-MgUserPhotoContent calls. |
In my case there is no chance to get a photo uploaded. Regardless of the operating system. What is the correct way to handle this? The retirement of the old powershell commands is soon and error handling or error information of the new Graph APIs is horrible. We can't just sit around try to change sizes and hope that the request will go through. Please provide accurate error messages, we can work with. |
Still having the issue on 2.8.0. |
I am also having this issue on PS5.1 with SDK 2.8.0. Every single photo I try to upload causes the error. |
Also having this issue with PS5.1. Tried upgrading to 2.9.1 and still seeing it. |
DEBUG: ============================ HTTP REQUEST ============================ HTTP Method: Absolute Uri: Headers: In PowerShell 7 with graph 2.8.0 it worked now. |
I am still having issues on Powershell 5.1 with graph 2.11.1 |
Similar issue with Set-MgDriveItemContent which I believe uses the same dependencies. Most common if trying to upload files sequentially. Workaround seems to be add delay between uploads. |
This is still happening with module version 2.19.0 in PS5.1 Desktop. |
Same error using Azure Automation account runbook with powershell 5.1. All MgGraph updated to latest. |
Hello, is there no solution to this issue? Still not working with 2.20.0... I was forced to use this command since Set-UserPhoto was deprecated but Set-MgUserPhotoContent does not work... I can't find any solution on the Internet. Getting the same errors: Thanks! |
@PSBoon825 - I have converted my script to use powershell graph api instead, its more reliable than this command |
@PSBoon825 I will repeat myself, but what "solved" this issue for me was to resize the images to the height of 188 pixels and add some wait time between Set-MgUserPhotoContent calls. |
@tkudya Thanks for the hint, this looks much more complicated though since I'm not experienced with API calls. Do you happen to have some example code? |
@ztrhgf Thanks for your reply. This happens to me even when running the command only once sometimes. Sometimes it works, sometimes it doesn't. Very unreliable. I read somewhere that the images should be converted to 648x648 for the MS cloud uploads, so isn't 188 against the "best practice"? |
Describe the bug
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Either a clear error on what the problem was or the picture to be changed successfully.
Debug Output
DEBUG: [CmdletException]: Received exception with message 'HttpRequestException - An error occurred while sending the request. : at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Kiota.Http.HttpClientLibrary.Middleware.RedirectHandler.d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Kiota.Http.HttpClientLibrary.Middleware.RetryHandler.d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Kiota.Http.HttpClientLibrary.Middleware.CompressionHandler.d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Graph.PowerShell.Authentication.Handlers.AuthenticationHandler.d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Graph.PowerShell.Users.<UserSetPhotoContent_Call>d__441.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Graph.PowerShell.Users.<UserSetPhotoContent_Call>d__441.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Graph.PowerShell.Users.d__439.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Graph.PowerShell.Cmdlets.SetMgUserPhotoContent_Set.d__57.MoveNext()'
DEBUG: [CmdletException]: Received exception with message 'PipelineStoppedException - The pipeline has been stopped. : at System.Management.Automation.MshCommandRuntime._WriteErrorSkipAllowCheck(ErrorRecord errorRecord, Nullable`1 actionPreference)
at System.Management.Automation.MshCommandRuntime.DoWriteError(Object obj)
at System.Security.SecurityContext.Run(SecurityContext securityContext, ContextCallback callback, Object state)
at System.Management.Automation.MshCommandRuntime.WriteError(ErrorRecord errorRecord, Boolean overrideInquire)
at System.Management.Automation.Cmdlet.WriteError(ErrorRecord errorRecord)
at Microsoft.Graph.PowerShell.Cmdlets.SetMgUserPhotoContent_Set.d__57.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Graph.PowerShell.Cmdlets.SetMgUserPhotoContent_Set.d__57.MoveNext()'
Module Version
Get-Module Microsoft.Graph*
ModuleType Version Name ExportedCommands
Script 2.6.1 Microsoft.Graph.Authentication {Add-MgEnvironment, Connect-MgGraph, Disconnect-MgGraph, G...
Environment Data
$PSVersionTable
Name Value
PSVersion 5.1.20348.1850
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.20348.1850
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Screenshots
N/A
Additional context
We are authenticating with a client secret to an application which has the necessary permissions to change the pictures. Again, this seems to work for most users, but in some odd cases it fails for some for no valid reason. Usually it tends to succeed for 80-90% of the users, and on rare occasions it won't fail at all. Is there some throttling mechanism at hand here?
The text was updated successfully, but these errors were encountered: