|
| 1 | +--- |
| 2 | +description: "sp_get_endpoint_certificate (Transact-SQL)" |
| 3 | +title: "sp_get_endpoint_certificate (Transact-SQL) | Microsoft Docs" |
| 4 | +ms.custom: "" |
| 5 | +ms.date: "03/09/2022" |
| 6 | +ms.prod: sql |
| 7 | +ms.prod_service: "database-engine" |
| 8 | +ms.reviewer: "" |
| 9 | +ms.technology: replication |
| 10 | +ms.topic: "reference" |
| 11 | +dev_langs: |
| 12 | + - "TSQL" |
| 13 | +f1_keywords: |
| 14 | + - "sp_get_endpoint_certificate" |
| 15 | + - "sp_get_endpoint_certificate_TSQL" |
| 16 | +helpviewer_keywords: |
| 17 | + - "sp_get_endpoint_certificate" |
| 18 | +ms.assetid: 680aabbc-6983-4fda-9b37-efcc5f083821 |
| 19 | +author: MladjoA |
| 20 | +ms.author: mlandzic |
| 21 | +--- |
| 22 | +# sp_get_endpoint_certificate (Transact-SQL) |
| 23 | +[!INCLUDE [SQL Server SQL MI](../../includes/applies-to-version/sql-asdbmi.md)] |
| 24 | + |
| 25 | + Returns a public key of the certificate used for authentication on endpoint of specified type with certificate-based trust configured. Supported types of endpoints are Database Mirroring endpoint (also used for Link feature of Azure SQL Managed Instance) and Service Broker endpoint. |
| 26 | + |
| 27 | +  [Transact-SQL Syntax Conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md) |
| 28 | + |
| 29 | +## Syntax |
| 30 | + |
| 31 | +``` |
| 32 | + |
| 33 | +sp_get_endpoint_certificate [ @endpoint_type = ] endpoint_type |
| 34 | +``` |
| 35 | + |
| 36 | +## Arguments |
| 37 | +`[ @endpoint_type = ] endpoint_type` |
| 38 | + Type of endpoint for which certificate's public key is required. *endpoint_type* is **int**, and can be one of these values: |
| 39 | + |
| 40 | +|Value|Endpoint| |
| 41 | +|-----------|-----------| |
| 42 | +|**3**|Service Broker| |
| 43 | +|**4**|Database Mirroring| |
| 44 | + |
| 45 | +Values correspond to the endpoint payload types in [sys.endpoints](../system-catalog-views/sys-endpoints-transact-sql.md) system catalog view. |
| 46 | +If any other integer value is provided, stored procedure returns NULL. |
| 47 | + |
| 48 | +## Return Code Values |
| 49 | + **0** (success) or **1** (failure) |
| 50 | + |
| 51 | +## Result Sets |
| 52 | + |
| 53 | +|Column name|Data type|Description| |
| 54 | +|-----------------|---------------|-----------------| |
| 55 | +|EndpointCertificatePublicKey|**varbinary**|Public key of the certificate, in binary format| |
| 56 | + |
| 57 | +## Remarks |
| 58 | +If authentication type configured on the endpoint isn't certificate-based, stored procedure returns error. |
| 59 | + |
| 60 | +## Permissions |
| 61 | + User must have VIEW permission on the endpoint to execute **sp_get_endpoint_certificate**. |
| 62 | + |
| 63 | + |
| 64 | + |
0 commit comments