November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
When you run manually, the job uses your principal - which usually is the admin. When you run it automatically it will use either the anonymous principal, or the principal you assign to it. so the solution could be either
For the second option mentioned by Quan, you could add a dependency of IPrincipalAccessor in the constructor and then assign as below.
_principalAccessor.Principal = new GenericPrincipal(new GenericIdentity("RoleNameGoeshere"), null);
Can you try this :
Based on the MS documentation, it looks like you also need to assign the principal to current thread https://learn.microsoft.com/en-us/dotnet/standard/security/how-to-create-genericprincipal-and-genericidentity-objects
var myPrincipal = new GenericPrincipal(new GenericIdentity("RoleNameGoeshere"), null);
_principalAccessor.Principal = myPrincipal
Thread.CurrentPrincipal = myPrincipal;
I get this error when a job I created runs automatically. It works fine when I run it manually. The job creates and updates blocks. Do I need to do anything to set the permissions for whatever service account the job runs under?