Export (0) Print
Expand All

Server.Credentials Property

 

Applies To: SQL Server 2016 Preview

Represents a collection of Credential objects. Each Credential object represents a credential defined on the instance of SQL Server.

Namespace:   Microsoft.SqlServer.Management.Smo
Assembly:  Microsoft.SqlServer.Smo (in Microsoft.SqlServer.Smo.dll)

[SfcObjectAttribute(SfcContainerRelationship.ObjectContainer, 
	SfcContainerCardinality.ZeroToAny, typeof(Credential))]
public CredentialCollection Credentials { get; }

Property Value

Type: Microsoft.SqlServer.Management.Smo.CredentialCollection

A CredentialCollection object that represents all the credentials defined on the instance of SQL Server.

A credential is used to store an account name and a password to gain permission to external resources. For example, SQL Server Agent proxy accounts use credentials to store the account and password information that is required to gain access to different subsystems that might be used as part of a SQL Server Agent job.

Legacy Code Example

Visual Basic

Code snippet is not found. Confirm that the code snippet name 'SMO How to' is correct.

PowerShell

$srv = new-object Microsoft.SqlServer.Management.Smo.Server("(local)")
$js = $srv.JobServer
$c = new-object Microsoft.SqlServer.Management.Smo.Credential($srv, "Proxy Accnt")
$c.Identity = vIdentity
$c.Create()
$pa = new-object Microsoft.SqlServer.Management.Smo.Agent.ProxyAccount($js, "Test proxy", "Proxy Accnt", $TRUE, "Proxy account for users to run job steps in command shell.")
$pa.Create()
$pa.AddLogin(vLogin)
$pa.AddSubSystem([Microsoft.SqlServer.Management.Smo.Agent.AgentSubSystem]::CmdExec)
Return to top
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft