Server.Credentials Property

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

命名空间: Microsoft.SqlServer.Management.Smo
程序集: Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)

语法

声明
Public ReadOnly Property Credentials As CredentialCollection
public CredentialCollection Credentials { get; }
public:
property CredentialCollection^ Credentials {
    CredentialCollection^ get ();
}
/** @property */
public CredentialCollection get_Credentials ()
public function get Credentials () : 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.

仅 Microsoft .NET Framework 的 2.0 版本支持此命名空间、类或成员。

示例

'Connect to the local, default instance of SQL Server.
Dim srv As Server
srv = New Server
'Declare a JobServer object variable and reference the SQL Agent.
Dim js As JobServer
js = srv.JobServer
'Define a Credential object variable by supplying the parent server and name arguments in the constructor.
Dim c As Credential
c = New Credential(srv, "Proxy_accnt")
'Set the identity to a valid login represented by the vIdentity string variable. 
'The sub system will run under this login.
c.Identity = vIdentity
'Create the credential on the instance of SQL Server.
c.Create()
'Define a ProxyAccount object variable by supplying the SQL Agent, the name, the credential, the description arguments in the constructor.
Dim pa As ProxyAccount
pa = New ProxyAccount(js, "Test_proxy", "Proxy_accnt", True, "Proxy account for users to run job steps in command shell.")
'Create the proxy account on the SQL Agent.
pa.Create()
'Add the login, represented by the vLogin string variable, to the proxy account. 
pa.AddLogin(vLogin)
'Add the CmdExec subsytem to the proxy account. 
pa.AddSubSystem(AgentSubSystem.CmdExec)
'Now users logged on as vLogin can run CmdExec job steps with the specified credentials.

线程安全

Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

平台

开发平台

有关支持的平台列表,请参阅安装 SQL Server 2005 的硬件和软件要求。

目标平台

有关支持的平台列表,请参阅安装 SQL Server 2005 的硬件和软件要求。

请参阅

参考

Server Class
Server Members
Microsoft.SqlServer.Management.Smo Namespace

其他资源

How to: Allow User Access to Subsystem by Using a Proxy Account in Visual Basic .NET
Using Collections
管理服务器