setup AppPool on IIs 10, keySet does not exist

  appcmd, iis, iis-10, powershell, windows

I am running a windows 2016 server, we are running IIs 10 on it and i need to be able to assert if there is an AppPool setup before i deploy a website. If it doesn’t exist i need setup the AppPool with a specific user and password.

All of this is done using a release agent through Azure Devops.

The agent is running as a NON-ADMIN, and i all accounts involved are running as NON-ADMIN. I have no intention at all to run any admin accounts, for security reasons i want to give least privildges to all accounts involved.

when i try to set up a AppPool using appcmd.exe i get the error msg:

KeySet does not exist.

When running everything as admin it works (and i have absolutely no intention in running any of this as admin).

What i have tried:
i have added the non-admin account to the IIS_IUSRS group.

Made sure that the user has read permissions to the file: 76944fb33636aeddb9590521c2e8815a_GUID in the %ALLUSERSPROFILE%MicrosoftCryptoRSAMachineKeys folder.

i have tried everything here: Error when you change the identity of an application pool by using IIS Manager from a remote computer

Source: Windows Questions