Skip to content

Commit

Permalink
Create Get-AgentCredentialList.tsql
Browse files Browse the repository at this point in the history
  • Loading branch information
nullbind authored Aug 20, 2024
1 parent a83cad2 commit 99bace0
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions templates/tsql/Get-AgentCredentialList.tsql
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Get list of credentials used by agent jobs.

USE msdb;
GO

SELECT
j.name AS JobName,
s.step_id AS StepID,
s.step_name AS StepName,
c.name AS CredentialName
FROM sysjobs j
JOIN sysjobsteps s ON j.job_id = s.job_id
LEFT JOIN sys.credentials c ON s.proxy_id = c.credential_id
WHERE c.name IS NOT NULLORDER BY j.name, s.step_id;

0 comments on commit 99bace0

Please sign in to comment.