Question

We have a provider hosted app that is generally working.
The environment is set up and prepared (client id, secret, registered). The remote site is set up as well. When I add an app package (.app) to the AppCatalog, then navigate to a site collection>Site Contents>add an app>My App, the event receiver on the remote site fires, the app installs correctly and is fully functional.

The issue begins when I try to deploy the app not manually, but by using the following Powershell cmdlets:

$spapp=Import-SPAppPackage -Path C:\Users\Administrator\Downloads\app\Package.app -Site http://MyServer/sites/site1 -Source CorporateCatalog
$ii=Install-SPApp -Web http://MyServer/sites/site1 -Identity $spapp

The deployment fails and the error says:
The remote event receiver callout failed. Details: Access denied. You do not have permission to perform this action or access this resource.

From the ULS: enter image description here

When I install manually - ULS (successful despite all the exceptions :/ ) enter image description here

In both cases I am using the same .app package. Issue occurs on 2013 and 2016. Obviously I have permissions to the remote event receiver because it is the same one I am using when deploying the app manually.

I run Powershell as Administrator. I have no option of changing anything in the app code since the installation is... well... working the usual user way via AppCatalog.

Any advice is very welcome.

Was it helpful?

Solution

A semi-solution is to use Update-SPApp instead of Install.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top