@mike welborn I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this!
- Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others", I'll repost your solution in case you'd like to accept the answer.
Issue:
I have an Azure Automation Runbook to scrub data in a database. It is a PowerShell script that runs under my security context without issue. When I add that to a Runbook I am using a Managed Identity rather than my personal account. The script runs several SQL commands without issue and comes to a section where I am attempting to drop some database users and it generates an error (see below).
How do I determine the server principal from the guid@guid value?
Solution:
The whole process involves copying a production database to a non-production environment and de-identifying data in the non-production environment. Queries were running fine until I hit the section that resets users in the database. I had removed the Managed Identity and as a result it was no longer able to access the database. One step I ran for debugging purposes was to record the SYSTEM_USER on a script that ran.
- If I missed anything please let me know and I'd be happy to add it to my answer, or feel free to comment below with any additional information.