mirror of
https://github.com/Microsoft/sql-server-samples.git
synced 2025-12-08 14:58:54 +00:00
11 lines
463 B
Transact-SQL
11 lines
463 B
Transact-SQL
-- Create PS Proxy with valid credentials on SQL Server instances
|
|
CREATE CREDENTIAL [cred_PSProxy] WITH IDENTITY = N'User', SECRET = N'Pwd'
|
|
GO
|
|
USE [msdb]
|
|
GO
|
|
EXEC msdb.dbo.sp_add_proxy @proxy_name=N'Proxy_Powershell',@credential_name=N'cred_PSProxy', @enabled=1
|
|
GO
|
|
EXEC msdb.dbo.sp_grant_proxy_to_subsystem @proxy_name=N'Proxy_Powershell', @subsystem_id=12
|
|
GO
|
|
EXEC msdb.dbo.sp_grant_login_to_proxy @proxy_name=N'Proxy_Powershell', @msdb_role=N'SQLAgentUserRole'
|
|
GO |