The following snippet can be used to set user avatars with PowerShell for Office 365/Azure AD users.
Make sure the Exchange Online cmdlet is installed:
Install-Module -Force -Name "ExchangeOnlineManagement"
Connect/authenticate to Exchange Online:
Connect-ExchangeOnline -Device
Use the Set-UserPhoto cmdlet to read the avatar and set it for the relevant user:
Set-UserPhoto "user@company.com" -Confirm:$false -PictureData ([System.IO.File]::ReadAllBytes("/path/to/avatar.jpg"))