Checking SQL AlwaysOn backup target with fn_hadr_backup_is_preferred_replica, different answers with different permissions I've implemented AlwaysON backup with Ola's script, those are running fine on designated server configured for backup. I would like to automatically check backups using sql-scripts fired from a monitoring system using a dedicated account just for this. This account has no permissions except public und view server state. If this account selects the following:

select sys.fn_hadr_backup_is_preferred_replica ('TestDB) AS IsPreferredBackupReplicaNow


It gets 0 as an incorrect answer. Firing the same query using sysadmin permissions give 1 as correct answer.

Anyone knows why this is like that and what permissions are needed to get a correct result? MSDN has no word about permissions.

Thanks in advance

Build: Microsoft SQL Server 2014 - 12.0.4100.1 (X64) Apr 20 2015 17:29:27 Copyright (c) Microsoft Corporation Enterprise Edition (64-bit) on Windows NT 6.3  (Build 9600: ) (Hypervisor)
You have to GRANT the user view server state and  view definition on availability group.