Hi,
I have a console application that runs as a webjob in azure portal. I recently came across the article that we need to move away from WS-Trust where you give account credentials in the connection string of app settings. So, I have restructured my code to utilize the OAuth based connection string where in I setup an Application user account and assign it System Admin role, create a ClientSecret account for it in Azure, app registration and all of that. My console app seems to be connecting to Dataverse fine and code seem to work as well. All my code does is CRUD operations like Create and Updates.
My connection string looks something like this:
string connectionString1 = "AuthType=ClientSecret; url=https://xxxxx; ClientId=xxxxxxxxxx-aac6-4ef5-8eab-xxxxxxxxxxx; ClientSecret=xxxxxxxxxxxxxxxxxxxxx";
The problem I am facing is with Modified By field. When an update happens, it sets the Modified By as the application user for a few seconds and then it changes back to my admin account.
The goal is to show Modified by as the Service account(in this case Application user) that is making the change and not myself.
Also, when I debug the code, the callerId always shows all zero guid and userId as the application user. No where I see my user Id in it yet it makes it through somehow.
Not sure if I have missed anything in setting up this Application User but I am super confused and not sure how to troubleshoot. Any help would be greatly appreciated. Thanks.