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)
Syntax
[SfcObjectAttribute(SfcContainerRelationship.ObjectContainer,
SfcContainerCardinality.ZeroToAny, typeof(Credential))]
public CredentialCollection Credentials { get; }
public:
[SfcObjectAttribute(SfcContainerRelationship::ObjectContainer,
SfcContainerCardinality::ZeroToAny, (Credential^::typeid))]
property CredentialCollection^ Credentials {
CredentialCollection^ get();
}
[<SfcObjectAttribute(SfcContainerRelationship.ObjectContainer,
SfcContainerCardinality.ZeroToAny, typeof(Credential))>]
member Credentials : CredentialCollection with get
<SfcObjectAttribute(SfcContainerRelationship.ObjectContainer,
SfcContainerCardinality.ZeroToAny, GetType(Credential))>
Public ReadOnly Property Credentials As CredentialCollection
Property Value
Type: Microsoft.SqlServer.Management.Smo.CredentialCollection
A CredentialCollection object that represents all the credentials defined on the instance of SQL Server.
Remarks
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.
Examples
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)
See Also
Server Class
Microsoft.SqlServer.Management.Smo Namespace
Using Collections
Unable to find linked topic '776ac273-bbe5-45e2-8bc8-a6f2b9cac03a'.
Return to top