Skip to content

Commit 3db52f8

Browse files
Revise Azure root CA import instructions for SQL Server (#35573)
* Revise Azure root CA import instructions for SQL Server Updated the instructions for importing Azure-trusted root CA keys to SQL Server, including changes to certificate names and paths. Added a note about the certification path for SQL Managed Instance public key certificates. --------- Co-authored-by: Masha Thomas (MSFT) <32783170+MashaMSFT@users.noreply.github.com>
1 parent 6991f9f commit 3db52f8

1 file changed

Lines changed: 13 additions & 138 deletions

File tree

azure-sql/managed-instance/managed-instance-link-configure-how-to-scripts.md

Lines changed: 13 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -319,158 +319,33 @@ FROM BINARY = <PublicKey>
319319

320320
### Import Azure-trusted root certificate authority keys to SQL Server
321321

322-
Importing Azure-trusted root certificate authority (CA) keys to SQL Server is required for your SQL Server to trust the SQL managed instance certificates issued by Azure.
322+
Importing Azure-trusted root certificate authority (CA) keys to SQL Server is required for your SQL Server to trust the SQL Managed Instance public key certificates issued by Azure.
323323

324-
You can download the necessary root CA certificates from [Root Certificate Authorities](/azure/security/fundamentals/azure-ca-details?tabs=root-and-subordinate-cas-list). Save it locally, such as to the sample `C:\Path\To\<name of certificate>.crt` path, and then import the certificate from that path.
325-
326-
327-
First, import the *DigiCert Global Root CA* root-authority certificate to SQL Server:
328-
329-
```sql
330-
-- Run on SQL Server
331-
-- Import DigiCertGlobalRootCA root-authority certificate (trusted by Azure), if not already present
332-
IF NOT EXISTS (SELECT name FROM sys.certificates WHERE name = N'DigiCertGlobalRootCA')
333-
BEGIN
334-
PRINT 'Creating DigiCertGlobalRootCA certificate.'
335-
CREATE CERTIFICATE [DigiCertGlobalRootCA] FROM FILE = 'C:\Path\To\DigiCertGlobalRootCA.crt'
336-
337-
--Trust certificates issued by DigiCertGlobalRootCA root authority for Azure database.windows.net domains
338-
DECLARE @CERTID int
339-
SELECT @CERTID = CERT_ID('DigiCertGlobalRootCA')
340-
--For government cloud, use the corresponding SQL Database DNS suffix, e.g. '*.database.usgovcloudapi.net', '*.database.chinacloudapi.cn' etc.
341-
EXEC sp_certificate_add_issuer @CERTID, N'*.database.windows.net'
342-
END
343-
ELSE
344-
PRINT 'Certificate DigiCertGlobalRootCA already exists.'
345-
GO
346-
```
347-
348-
Then, import the *DigiCert Global Root G2* root-authority certificate to SQL Server:
349-
350-
```sql
351-
-- Run on SQL Server
352-
-- Import DigiCertGlobalRootG2 root-authority certificate (trusted by Azure), if not already present
353-
IF NOT EXISTS (SELECT name FROM sys.certificates WHERE name = N'DigiCertGlobalRootG2')
354-
BEGIN
355-
PRINT 'Creating DigiCertGlobalRootG2 certificate.'
356-
CREATE CERTIFICATE [DigiCertGlobalRootG2] FROM FILE = 'C:\Path\To\DigiCertGlobalRootG2.crt'
357-
358-
--Trust certificates issued by DigiCertGlobalRootG2 root authority for Azure database.windows.net domains
359-
DECLARE @CERTID int
360-
SELECT @CERTID = CERT_ID('DigiCertGlobalRootG2')
361-
--For government cloud, use the corresponding SQL Database DNS suffix, e.g. '*.database.usgovcloudapi.net', '*.database.chinacloudapi.cn' etc.
362-
EXEC sp_certificate_add_issuer @CERTID, N'*.database.windows.net'
363-
END
364-
ELSE
365-
PRINT 'Certificate DigiCertGlobalRootG2 already exists.'
366-
GO
367-
```
368-
369-
Then, import the *DigiCert Global Root G3* root-authority certificate to SQL Server:
370-
371-
```sql
372-
-- Run on SQL Server
373-
-- Import DigiCertGlobalRootG3 root-authority certificate (trusted by Azure), if not already present
374-
IF NOT EXISTS (SELECT name FROM sys.certificates WHERE name = N'DigiCertGlobalRootG3')
375-
BEGIN
376-
PRINT 'Creating DigiCertGlobalRootG3 certificate.'
377-
CREATE CERTIFICATE [DigiCertGlobalRootG3] FROM FILE = 'C:\Path\To\DigiCertGlobalRootG3.crt'
378-
379-
--Trust certificates issued by DigiCertGlobalRootG3 root authority for Azure database.windows.net domains
380-
DECLARE @CERTID int
381-
SELECT @CERTID = CERT_ID('DigiCertGlobalRootG3')
382-
--For government cloud, use the corresponding SQL Database DNS suffix, e.g. '*.database.usgovcloudapi.net', '*.database.chinacloudapi.cn' etc.
383-
EXEC sp_certificate_add_issuer @CERTID, N'*.database.windows.net'
384-
END
385-
ELSE
386-
PRINT 'Certificate DigiCertGlobalRootG3 already exists.'
387-
GO
388-
```
389-
390-
Then, import the *DigiCert TLS ECC P384 Root G5* root-authority certificate to SQL Server:
324+
You can download the necessary root CA keys from [Root Certificate Authorities](/azure/security/fundamentals/azure-ca-details?tabs=root-and-subordinate-cas-list). Save them locally, such as to the sample `C:\Path\To\<name of certificate>.crt` path, and then import the certificates from that path:
391325

392326
```sql
393327
-- Run on SQL Server
394-
-- Import DigiCertTLSECCP384RootG5 root-authority certificate (trusted by Azure), if not already present
395-
IF NOT EXISTS (SELECT name FROM sys.certificates WHERE name = N'DigiCertTLSECCP384RootG5')
328+
-- Import <name of certificate> root-authority certificate (trusted by Azure), if not already present
329+
IF NOT EXISTS (SELECT name FROM sys.certificates WHERE name = N'<name of certificate>')
396330
BEGIN
397-
PRINT 'Creating DigiCertTLSECCP384RootG5 certificate.'
398-
CREATE CERTIFICATE [DigiCertTLSECCP384RootG5] FROM FILE = 'C:\Path\To\DigiCertTLSECCP384RootG5.crt'
331+
PRINT 'Creating <name of certificate> certificate.'
332+
CREATE CERTIFICATE [<name of certificate>] FROM FILE = 'C:\Path\To\<name of certificate>.crt'
399333

400-
--Trust certificates issued by DigiCertTLSECCP384RootG5 root authority for Azure database.windows.net domains
334+
--Trust certificates issued by <name of certificate> root authority for Azure database.windows.net domains
401335
DECLARE @CERTID int
402-
SELECT @CERTID = CERT_ID('DigiCertTLSECCP384RootG5')
336+
SELECT @CERTID = CERT_ID('<name of certificate>')
403337
--For government cloud, use the corresponding SQL Database DNS suffix, e.g. '*.database.usgovcloudapi.net', '*.database.chinacloudapi.cn' etc.
404338
EXEC sp_certificate_add_issuer @CERTID, N'*.database.windows.net'
405339
END
406340
ELSE
407-
PRINT 'Certificate DigiCertTLSECCP384RootG5 already exists.'
408-
GO
409-
```
410-
411-
Then, import the *DigiCert TLS RSA 4096 Root G5* root-authority certificate to SQL Server:
412-
413-
```sql
414-
-- Run on SQL Server
415-
-- Import DigiCertTLSRSA4096RootG5 root-authority certificate (trusted by Azure), if not already present
416-
IF NOT EXISTS (SELECT name FROM sys.certificates WHERE name = N'DigiCertTLSRSA4096RootG5')
417-
BEGIN
418-
PRINT 'Creating DigiCertTLSRSA4096RootG5 certificate.'
419-
CREATE CERTIFICATE [DigiCertTLSRSA4096RootG5] FROM FILE = 'C:\Path\To\DigiCertTLSRSA4096RootG5.crt'
420-
421-
--Trust certificates issued by DigiCertTLSRSA4096RootG5 root authority for Azure database.windows.net domains
422-
DECLARE @CERTID int
423-
SELECT @CERTID = CERT_ID('DigiCertTLSRSA4096RootG5')
424-
--For government cloud, use the corresponding SQL Database DNS suffix, e.g. '*.database.usgovcloudapi.net', '*.database.chinacloudapi.cn' etc.
425-
EXEC sp_certificate_add_issuer @CERTID, N'*.database.windows.net'
426-
END
427-
ELSE
428-
PRINT 'Certificate DigiCertTLSRSA4096RootG5 already exists.'
429-
GO
430-
```
431-
432-
Then, import the *Microsoft ECC Root Certificate Authority 2017* root-authority certificate to SQL Server:
433-
434-
```sql
435-
-- Run on SQL Server
436-
-- Import Microsoft ECC Root Certificate Authority 2017 root-authority certificate (trusted by Azure), if not already present
437-
IF NOT EXISTS (SELECT name FROM sys.certificates WHERE name = N'Microsoft ECC Root Certificate Authority 2017')
438-
BEGIN
439-
PRINT 'Creating Microsoft ECC Root Certificate Authority 2017 certificate.'
440-
CREATE CERTIFICATE [Microsoft ECC Root Certificate Authority 2017] FROM FILE = 'C:\Path\To\Microsoft ECC Root Certificate Authority 2017.crt'
441-
442-
--Trust certificates issued by Microsoft ECC Root Certificate Authority 2017 root authority for Azure database.windows.net domains
443-
DECLARE @CERTID int
444-
SELECT @CERTID = CERT_ID('Microsoft ECC Root Certificate Authority 2017')
445-
--For government cloud, use the corresponding SQL Database DNS suffix, e.g. '*.database.usgovcloudapi.net', '*.database.chinacloudapi.cn' etc.
446-
EXEC sp_certificate_add_issuer @CERTID, N'*.database.windows.net'
447-
END
448-
ELSE
449-
PRINT 'Certificate Microsoft ECC Root Certificate Authority 2017 already exists.'
450-
GO
451-
```
452-
453-
Then, import the *Microsoft RSA Root Certificate Authority 2017* root-authority certificate to SQL Server:
454-
455-
```sql
456-
-- Run on SQL Server
457-
-- Import Microsoft RSA Root Certificate Authority 2017 root-authority certificate (trusted by Azure), if not already present
458-
IF NOT EXISTS (SELECT name FROM sys.certificates WHERE name = N'Microsoft RSA Root Certificate Authority 2017')
459-
BEGIN
460-
PRINT 'Creating Microsoft RSA Root Certificate Authority 2017 certificate.'
461-
CREATE CERTIFICATE [Microsoft RSA Root Certificate Authority 2017] FROM FILE = 'C:\Path\To\Microsoft RSA Root Certificate Authority 2017.crt'
462-
463-
--Trust certificates issued by Microsoft RSA Root Certificate Authority 2017 root authority for Azure database.windows.net domains
464-
DECLARE @CERTID int
465-
SELECT @CERTID = CERT_ID('Microsoft RSA Root Certificate Authority 2017')
466-
--For government cloud, use the corresponding SQL Database DNS suffix, e.g. '*.database.usgovcloudapi.net', '*.database.chinacloudapi.cn' etc.
467-
EXEC sp_certificate_add_issuer @CERTID, N'*.database.windows.net'
468-
END
469-
ELSE
470-
PRINT 'Certificate Microsoft RSA Root Certificate Authority 2017 already exists.'
341+
PRINT 'Certificate <name of certificate> already exists.'
471342
GO
472343
```
473344

345+
> [!NOTE]
346+
> The root certificate in the certification path for a SQL Managed Instance public key certificate is issued by an Azure trusted root Certificate Authority (CA). The specific root CA can change over time as Azure updates its trusted CA list.
347+
> For a simplified setup, install all root CA certificates listed in [Azure Root Certificate Authorities](/azure/security/fundamentals/azure-ca-details?tabs=root-and-subordinate-cas-list). You can install just the required CA key by identifying the issuer of a previously-imported SQL Managed Instance public key.
348+
474349
Finally, verify all the created certificates by using the following dynamic management view (DMV):
475350

476351
```sql

0 commit comments

Comments
 (0)