Specifies a redirected publisher for an existing publisher/database pair. If the publisher database belongs to an AlwaysOn Availability Group, the redirected publisher is the availability group listener name associated with the availability group.
sp_redirect_publisher is used to allow a replication publisher to be redirected to the current primary of an AlwaysOn availability group by associating the publisher/database pair with an availability group’s listener. Execute sp_redirect_publisher after the AG listener has been configured for the availability group that contains the published database.
If the publication database at the original publisher is removed from an availability group at the primary replica, execute sp_redirect_publisher without specifying a value for the @redirected_publisher parameter to remove the redirection for the publisher/database pair. For more information about redirecting the publisher when, see Maintaining an AlwaysOn Publication Database (SQL Server).
Caller must either be a member of the sysadmin fixed server role, the db_owner fixed database role for the distribution database, or a member of a publication access list for a defined publication associated with the publisher database.