Minimum SQL Server role to check SQL Agent status with PowerShell?

EnterpriseArchitect 5,376 Reputation points
2022-12-08T13:06:01.163+00:00

I need to execute the PowerShell to remotely check the SQL backup job status on each SQL Database instance across multiple SQL servers but as a Read Only user account.
What are the minimum credentials or SQL Server role that I can use to query the SQL Agent backup job status?

The PowerShell script:
https://learn.microsoft.com/en-us/powershell/module/sqlserver/get-sqlagentjob?view=sqlserver-ps
https://learn.microsoft.com/en-us/powershell/module/sqlserver/get-sqlagentjobhistory?view=sqlserver-ps

Executed from my workstations with https://learn.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms?view=sql-server-ver16

Any help with script examples will be greatly appreciated.

SQL Server on Azure Virtual Machines
Azure SQL Database
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,772 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,520 questions
0 comments No comments
{count} vote

Accepted answer
  1. Alberto Morillo 33,861 Reputation points MVP
    2022-12-08T13:35:50.577+00:00

    A member of SQLAgentReaderRole role allow the user to see any SQL Agent job located on the server instance, even the jobs in which that user does not own. The user can see the job, along with any history saved to the job. However, the group is not allowed to execute the jobs

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.