I'm having the same issue as Lephas with the Set-UserPhoto cmdlet. Just like above, it works fine when logged when with a regular admin account that has the Exchange Administrator role.
Here is an example of the command I'm running:
Set-UserPhoto -Identity {mailbox} -PictureData ([System.IO.File]::ReadAllBytes('.\userphoto.jpg')) -Confirm:$false
Tried resizing the photo down to below 10K. Still same error.
It is key for us to get this working to duplicate an on-premise Exchange Server automated process for uploading user photos.
Here is the error:
CH2PR18MB3302.namprd18.prod.outlook.com: Server version 15.20.3305.0000, Proxy method RPS:
Connecting to remote server ch2pr18mb3302.namprd18.prod.outlook.com failed with the following error message : ꗐ빀ƨ For
more information, see the about_Remote_Troubleshooting Help topic.
[Server=BYAPR18MB2438,RequestId=2b0e54e5-6d18-47df-ba64-10877b3ed695,TimeStamp=8/27/2020 8:11:39 PM] .
+ CategoryInfo : NotSpecified: (:) [Set-UserPhoto], CmdletProxyException
+ FullyQualifiedErrorId : [Server=BYAPR18MB2438,RequestId=2b0e54e5-6d18-47df-ba64-10877b3ed695,TimeStamp=8/27/2020
8:11:39 PM] [FailureCategory=Cmdlet-CmdletProxyException] A5EB5563,Microsoft.Exchange.Management.RecipientTasks.S
etUserPhoto
+ PSComputerName : outlook.office365.com