An app that installs without issues manually via UI needs to be installed automatically. It's a provider-hosted app with Azure website.
The solution here: Office 365: Publish and deploy .app through PowerShell gives me ALMOST what I need - the app is installed on the site, but throws an error about permissions to the remote site:
The remote event receiver callout failed. Details: Access denied. You do not have permission to perform this action or access this resource.
On the failed sites, the app principal for MyApp is missing.
How can I add it in SharePoint Online site using Powershell ?