Author | Chrissy LeMaire (@cl), netnerds.net |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out New-DbaAgentProxy on GitHub.
Want to see the Bill Of Health for this command? Check out New-DbaAgentProxy.
Adds one or more proxies to SQL Server Agent
Adds one or more proxies to SQL Server Agent
Note: ActiveScripting (ActiveX scripting) was discontinued in SQL Server 2016: https://docs.microsoft.com/en-us/sql/database-engine/discontinued-database-engine-functionality-in-sql-server
New-DbaAgentProxy
[-SqlInstance] <DbaInstanceParameter[]>
[[-SqlCredential] <PSCredential>]
[-Name] <String[]>
[-ProxyCredential] <String[]>
[[-SubSystem] <String[]>]
[[-Description] <String>]
[[-Login] <String[]>]
[[-ServerRole] <String[]>]
[[-MsdbRole] <String[]>]
[-Disabled]
[-Force]
[-EnableException]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
PS C:\> New-DbaAgentProxy -SqlInstance sql2016 -Name STIG -ProxyCredential 'PowerShell Proxy'
Creates an Agent Proxy on sql2016 with the name STIG with the 'PowerShell Proxy' credential.
The proxy is automatically added to the CmdExec subsystem.
PS C:\> New-DbaAgentProxy -SqlInstance localhost\sql2016 -Name STIG -ProxyCredential 'PowerShell Proxy' -Description "Used for auditing purposes" -Login ad\sqlstig -SubSystem CmdExec, PowerShell
-ServerRole securityadmin -MsdbRole ServerGroupAdministratorRole
Creates an Agent Proxy on sql2016 with the name STIG with the 'PowerShell Proxy' credential and the following principals:
Login: ad\sqlstig
ServerRole: securityadmin
MsdbRole: ServerGroupAdministratorRole
By default, only sysadmins have access to create job steps with proxies. This will allow 3 additional principals access:
The proxy is then added to the CmdExec and PowerShell subsystems
The target SQL Server instance or instances.You must have sysadmin access and server version must be SQL Server version 2000 or higher.
Alias | |
Required | True |
Pipeline | true (ByValue) |
Default Value |
The name of the proxy or proxies you want to create
Alias | |
Required | True |
Pipeline | false |
Default Value |
The associated SQL Server Credential. The credential must be created prior to creating the Proxy.
Alias | |
Required | True |
Pipeline | false |
Default Value |
Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).
Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.
For MFA support, please use Connect-DbaInstance.
Alias | |
Required | False |
Pipeline | false |
Default Value |
The associated subsystem or subsystems. Defaults to CmdExec.
Valid options include:
ActiveScripting
AnalysisCommand
AnalysisQuery
CmdExec
Distribution
LogReader
Merge
PowerShell
QueueReader
Snapshot
Ssis
Alias | |
Required | False |
Pipeline | false |
Default Value | CmdExec |
Accepted Values | ActiveScripting,AnalysisCommand,AnalysisQuery,CmdExec,Distribution,LogReader,Merge,PowerShell,QueueReader,Snapshot,Ssis |
A description of the proxy
Alias | |
Required | False |
Pipeline | false |
Default Value |
The SQL Server login or logins (known as proxy principals) to assign to the proxy
Alias | |
Required | False |
Pipeline | false |
Default Value |
The SQL Server role or roles (known as proxy principals) to assign to the proxy
Alias | |
Required | False |
Pipeline | false |
Default Value |
The msdb role or roles (known as proxy principals) to assign to the proxy
Alias | |
Required | False |
Pipeline | false |
Default Value |
Create the proxy as disabled
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Drop and recreate the proxy if it already exists
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.
Alias | wi |
Required | False |
Pipeline | false |
Default Value |
If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.
Alias | cf |
Required | False |
Pipeline | false |
Default Value |