We are getting the following error
Access denied. You do not have permission to perform this action or access this resource.
when executing the following code
AppPrincipalManager ap = AppPrincipalManager.GetManager(web.Context, web); web.Context.ExecuteQuery();
I get it with every account: my account (site collection admin), system account, ... It just doesn't work.
We need it because we want to add apps on a site by CSOM. That works, but the app permissions are not set. So we are trying to set them by the AppPrincipalManager. But then, we get an access denied error.