惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
U
Unit 42
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
The GitHub Blog
The GitHub Blog
Microsoft Azure Blog
Microsoft Azure Blog
有赞技术团队
有赞技术团队
Stack Overflow Blog
Stack Overflow Blog
爱范儿
爱范儿
博客园 - 司徒正美
Vercel News
Vercel News
I
InfoQ
GbyAI
GbyAI
C
Check Point Blog
B
Blog RSS Feed
Martin Fowler
Martin Fowler
B
Blog
MyScale Blog
MyScale Blog
腾讯CDC
博客园 - Franky
Blog — PlanetScale
Blog — PlanetScale
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Hugging Face - Blog
Hugging Face - Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 三生石上(FineUI控件)

博客园 - stswordman

Tutorial: Add a node to SQL cluster on RHEL Tutorial: Create SQL Cluster(FCI) on RHEL Configure multiple-subnet Always On Availability Groups and failover cluster instances by modifying CIB Failed to restart Polybase Data Movement service after running sp_polybase_join_group Realcase: Failed to upgrade SQL Server 2016 SP2 CU11. (Installation success or error status: 1648) Connect SQL Server from Linux Client using Windows Authentication and troubleshoot steps Different AG groups have the exactly same group_id value if the group names are same and the ‘CLUSTER_TYPE = EXTERNAL/NONE’ An example of polybase for Oracle use azure data studio to create external table for oracle Missing MSI and MSP files You may fail to backup log or restore log after TDE certification/key rotation. Password is required when adding a database to AG group if the database has a master key Use KTPASS instead of adden to configure mssql.keytab Failed to run 'create login' or 'sp_addsrvrolemeber' in sql Linux using windows authentcation Sql Server Linux(Redhat) Distributed Availability Group Setup — step by step Example of SQL Linux Windows Authentication configuration using Managed Service Accounts FILESTREAM feature can't be enabled if you use cluster shared volumes SQL Server does not purge row versioning records even the transaction are committed if there are other open transaction running in the databases with read-committed snapshot enabled . “The subscription does not exist” when a distributor primary replica fails over to a replica that does not use the same agent profile
The thumbprint of same asymmetric key is not same in &#39...
stswordman · 2019-01-26 · via 博客园 - stswordman

 https://support.microsoft.com/en-us/help/4470999/db-backup-problems-to-sql-server-connector-for-azure-1-0-5-0

A breaking change has been introduced in Version 1.0.5.0 of 'SQL Server Connector for Microsoft Azure Key Vault' .  The 1.0.5.0 version updated the way it calculates thumbprints to match the logic used in the engine, in order to support the migration scenario of On Prem SQL Server using EKM to Azure SQL DB using TDE BYOK.  Because of this change, customer may hit issues when they are trying to restore database backups from when they were using 1.0.4.0 or old version to a server using 1.0.5.0 version.

Here is an example

===

SQL Server instance sql1 has 'SQL Server Connector for Microsoft Azure Key Vault' 1.0.4.0 deployed. SQL Server instance sql2 has 'SQL Server Connector for Microsoft Azure Key Vault' 1.0.5.0 deployed. Both instance sql1 and sql2 deploy an ASYMMETRIC key from the same ASYMMETRIC key in Azure Key Vault.

CREATE ASYMMETRIC KEY TDE_KEY

FROM PROVIDER AzureKeyVaultProvider

WITH PROVIDER_KEY_NAME = 'key1',

CREATION_DISPOSITION = OPEN_EXISTING

The thumbprints are different. The length of thumbprint of 1.0.5.0 version is little bit greater than the thumbprint of 1.0.4.0 version.

Here is example of thumbprint of 1.0.4.0 version

0x2C5677D76F76D77F80

Here is example of thumbprint of 1.0.5.0 version. Please note, both asymmetric keys are created from same source.

0x373B314B78E8D59A0925494558FEF14B726216C5

This breaking change causes problem in backup/restore scenario.

For example, if you have a backup of a database encrypted by an asymmetric key  in Azure Key vault in instance sql1.

The instance sql2 has same asymmetric key created.

If you try to restore the backup to instance sql2, the restore fails with the error message below

Msg 33111, Level 16, State 4, Line 20

Cannot find server asymmetric key with thumbprint '0x2C5677D76F76D77F80'.

Here is the query to retrieve the thumbprint of each key.

select thumbprint,* from master.sys.asymmetric_keys

Here is the query to retrieve the thumbprint of each TDE database

select db_name(ddek.database_id) as DatabaseName,ak.name as[Asymmetric key Name], ak.thumbprint From sys.dm_database_encryption_keys ddek inner join master.sys.asymmetric_keys ak on ak.thumbprint=ddek.encryptor_thumbprint

Solution

===

Copy the 'SQL Server Connector for Microsoft Azure Key Vault' 1.0.4.0 or related version to the instance sql2 box.

Run the query below in sql2 to change the CRYPTOGRAPHIC PROVIDER to 1.0.4.0 version.

ALTER CRYPTOGRAPHIC PROVIDER AzureKeyVaultProvider

FROM FILE =   

'C:\Program Files\SQL Server Connector for Microsoft Azure Key Vault\1.0.4.0\Microsoft.AzureKeyVaultService.EKM.dll'

Create a new asymmetric key using the 1.0.4.0 provider.

CREATE ASYMMETRIC KEY TDE_KEY_1040

FROM PROVIDER AzureKeyVaultProvider

WITH PROVIDER_KEY_NAME = 'key1',

CREATION_DISPOSITION = OPEN_EXISTING

After that, you are able to restore the backup.

Run the query below in sql2 to revert  the CRYPTOGRAPHIC PROVIDER to 1.0.5.0 version.

ALTER CRYPTOGRAPHIC PROVIDER AzureKeyVaultProvider

FROM FILE =   

'C:\Program Files\SQL Server Connector for Microsoft Azure Key Vault\1.0.5.0\Microsoft.AzureKeyVaultService.EKM.dll'

You can either use the same asymmetric key or change to a new version asymmetric key to use the new thumbprint.

       alter DATABASE ENCRYPTION KEY  

       ENCRYPTION BY SERVER ASYMMETRIC KEY KeyName1050Version