|
| 1 | +# Get TDS certificate from Azure SQL using PowerShell |
| 2 | + |
| 3 | +Script that downloads TDS certificate with public key only from Azure SQL |
| 4 | + |
| 5 | +### Contents |
| 6 | + |
| 7 | +[About this sample](#about-this-sample)<br/> |
| 8 | +[Before you begin](#before-you-begin)<br/> |
| 9 | +[Run this sample](#run-this-sample)<br/> |
| 10 | +[Sample details](#sample-details)<br/> |
| 11 | +[Disclaimers](#disclaimers)<br/> |
| 12 | + |
| 13 | +<a name=about-this-sample></a> |
| 14 | + |
| 15 | +## About this sample |
| 16 | + |
| 17 | +- **Applies to:** Azure SQL |
| 18 | +- **Key features:** Database, Managed Instance |
| 19 | +- **Workload:** n/a |
| 20 | +- **Programming Language:** PowerShell |
| 21 | +- **Authors:** Srdan Bozovic |
| 22 | +- **Update history:** n/a |
| 23 | + |
| 24 | +<a name=before-you-begin></a> |
| 25 | + |
| 26 | +## Before you begin |
| 27 | + |
| 28 | +To run this sample, you need the following prerequisites. |
| 29 | + |
| 30 | +**Software prerequisites:** |
| 31 | + |
| 32 | +1. PowerShell 5.0 or higher installed |
| 33 | + |
| 34 | +<a name=run-this-sample></a> |
| 35 | + |
| 36 | +## Run this sample |
| 37 | + |
| 38 | +Run the script below from either Windows or Azure Cloud Shell |
| 39 | + |
| 40 | +```powershell |
| 41 | +
|
| 42 | +$scriptUrlBase = 'https://raw.githubusercontent.com/Microsoft/sql-server-samples/master/samples/manage/get-tds-certificate' |
| 43 | +
|
| 44 | +$parameters = @{ |
| 45 | + hostName = '<hostName>' |
| 46 | + port = '<resourceGroupName>' |
| 47 | + publicCertificateFile = '<publicCertificateFile>' |
| 48 | + } |
| 49 | +
|
| 50 | +Invoke-Command -ScriptBlock ([Scriptblock]::Create((iwr ($scriptUrlBase+'/getTDSCertificate.ps1?t='+ [DateTime]::Now.Ticks)).Content)) -ArgumentList $parameters |
| 51 | +
|
| 52 | +``` |
| 53 | + |
| 54 | +<a name=sample-details></a> |
| 55 | + |
| 56 | +## Sample details |
| 57 | + |
| 58 | +This sample shows how to retreive Azure SQL TDS certificate and save it to DER encoded X509 binary. |
| 59 | + |
| 60 | +<a name=disclaimers></a> |
| 61 | + |
| 62 | +## Disclaimers |
| 63 | +The scripts and this guide are copyright Microsoft Corporations and are provided as samples. They are not part of any Azure service and are not covered by any SLA or other Azure-related agreements. They are provided as-is with no warranties express or implied. Microsoft takes no responsibility for the use of the scripts or the accuracy of this document. Familiarize yourself with the scripts before using them. |
| 64 | + |
0 commit comments