on the picture below, you can see, I have a sql server job called "Backup SSAS DBS_" that Run as: PowerShell_Proxy
How can I find out the AD (active directory) account associated with that Proxy via T-SQL?
SO far I have this script below, but something is missing. Also, the AD account might not be a login or user in the current server.
USE [msdb]
GO
select
s.job_id
,s.name as [job_name]
,js.step_id
,js.step_name
,js.subsystem
,js.proxy_id
,js.command
from sysjobs S
INNER JOIN sysjobsteps JS ON S.job_id = js.job_id
LEFT OUTER JOIN sysproxylogin p ON js.proxy_id = p.proxy_id
WHERE S.NAME LIKE '%' + 'SSAS' + '%'
Using the query below I can get the SID used by the proxy.
select * from sysproxylogin