凭据(数据库引擎)Credentials (Database Engine)

适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions) 是Azure SQL 数据库Azure SQL DatabaseYesAzure SQL 数据库Azure SQL Database 是Azure SQL 托管实例Azure SQL Managed InstanceYesAzure SQL 托管实例Azure SQL Managed Instance 是Azure Synapse AnalyticsAzure Synapse AnalyticsyesAzure Synapse AnalyticsAzure Synapse Analytics 是并行数据仓库Parallel Data Warehouseyes并行数据仓库Parallel Data Warehouse适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions) 是Azure SQL 数据库Azure SQL DatabaseYesAzure SQL 数据库Azure SQL Database 是Azure SQL 托管实例Azure SQL Managed InstanceYesAzure SQL 托管实例Azure SQL Managed Instance 是Azure Synapse AnalyticsAzure Synapse AnalyticsyesAzure Synapse AnalyticsAzure Synapse Analytics 是并行数据仓库Parallel Data Warehouseyes并行数据仓库Parallel Data Warehouse

凭据是包含连接到 SQL ServerSQL Server外部资源所需的身份验证信息(凭据)的记录。A credential is a record that contains the authentication information (credentials) required to connect to a resource outside SQL ServerSQL Server. 此信息由 SQL ServerSQL Server在内部使用。This information is used internally by SQL ServerSQL Server. 大多凭据都包含一个 Windows 用户名和密码。Most credentials contain a Windows user name and password.

利用凭据中存储的信息,通过 SQL ServerSQL Server 身份验证方式连接到 SQL ServerSQL Server 的用户可以访问服务器实例外部的资源。The information stored in a credential enables a user who has connected to SQL ServerSQL Server by way of SQL ServerSQL Server Authentication to access resources outside the server instance. 如果外部资源为 Windows,则此用户将作为在凭据中指定的 Windows 用户通过身份验证。When the external resource is Windows, the user is authenticated as the Windows user specified in the credential. 一个凭据只能映射到一个 SQL ServerSQL Server 登录名。A single credential can only be mapped to a single SQL ServerSQL Server login. 一个 SQL ServerSQL Server 登录名只能映射到一个凭据。And a SQL ServerSQL Server login can be mapped to only one credential.

有关存储在 master 数据库中且可在整个 SQL ServerSQL Server 实例中使用的凭据,请参阅 CREATE CREDENTIAL (Transact-SQL)For credentials that are stored in the master database and can be used throughout the instance of SQL ServerSQL Server, see CREATE CREDENTIAL (Transact-SQL). 有关特定数据库使用的且可提供该数据库移植的凭据,请参阅 CREATE DATABASE SCOPED CREDENTIAL (Transact-SQL)For credentials used by a specific database, and portable with that database, see CREATE DATABASE SCOPED CREDENTIAL (Transact-SQL).

系统凭据是自动创建的,并与特定端点关联,System credentials are created automatically and are associated with specific endpoints. 系统凭据名以两个哈希符号 (##) 开头。Names for system credentials start with two hash signs (##).

有关凭据的详细信息,请参阅 sys.credentialssys.database_scoped_credentials 目录视图。For more information about credentials, see the sys.credentials and sys.database_scoped_credentials catalog views.

创建凭据 Create a Credential
CREATE CREDENTIAL (Transact-SQL) CREATE CREDENTIAL (Transact-SQL)
CREATE DATABASE SCOPED CREDENTIAL (Transact-SQL)CREATE DATABASE SCOPED CREDENTIAL (Transact-SQL)
保护 SQL ServerSecuring SQL Server