How-to restore across different SQL Managed instances when using TDE with Customer Managed Keys

Published Mar 29 2022 07:44 AM 2,545 Views
Microsoft

This how-to post focuses on how-to restore across different SQL Managed instances when using TDE with Customer Managed Keys.

You can find and reference the whole series with the following link 
http://aka.ms/sqlmi-howto.

 

Transparent Data Encryption (TDE) is an encryption at rest technology that has been in use with SQL Server for many releases. It performs real-time encryption and decryption of the database, associated backups, and transaction log files at rest without requiring changes to the application. 

 

TDE encrypts the storage of an entire database by using a symmetric key called the Database Encryption Key (DEK). DEK is protected by the TDE protector. This DEK is protected by the TDE protector which is either a service managed key or the customer managed key in Azure Key Vault

 

For Azure SQL Managed Instance, TDE is on by default for the instance, which means all databases created for the instance are enabled by TDE.

 

By default, Azure SQL Managed Instance uses a service managed key, which means Azure SQL manages a certificate for the key (rotates the key and protects it with a root key within Azure).

 

Another option is to use TDE with Customer managed Keys. TDE with Customer managed Keys uses Azure Key Vault, which provides highly available and scalable secure storage for RSA cryptographic keys backed by FIPS 140-2 Level 2 validated hardware security modules (HSMs), while Managed HSM offering provides the Level 3. Azure Key Vault streamlines the key management process and enables customers to maintain full control of encryption keys, including managing and auditing key access.

 

Customer-managed TDE provides the following benefits to the customer:

  • Full and granular control over usage and management of the TDE protector.    (TDE Protector is the key used for encryption of the Database Encryption Key (DEK) and stored in the Key vault.)
  • Transparency of the TDE protector usage.
  • Ability to implement separation of duties in the management of keys and data within the organization.
  • Key Vault administrator can revoke key access permissions to make encrypted database inaccessible.
  • Central management of keys in AKV.
  • Greater trust from your end customers, since AKV is designed such that Microsoft can't see nor extract encryption keys’
  • Ability to backup and restore databases using COPY_ONLY backups for Managed Instance.

 

Despite the management overhead, because of the above advantages, most customers prefer to use Customer Managed Keys.

Now that we understand the advantages of using TDE with customer managed keys, let us look at the process of doing a manual backup and restore across managed instances when using TDE with customer managed keys.  There are a couple of scenarios where customer might need to do this:

  • When needing a backup that needs to be held > 35 days
  • When needing a database refresh from one environment to another (Example: Production to Development or vice versa)



How-to setup restore across different SQL Managed instances when using TDE with Customer Managed Keys

In the example below, we are restoring a database from the source SQL Managed Instance [vyelsqlmi1] to the target SQL Managed Instance [vyelsqlmi2].  

 

We have used our Azure subscription to create a new Azure Key Vault and added a key to it. Then we have navigated to the SQL Managed Instance [vyelsqlmi1], selected Transparent Data Encryption blade from the Resource Menu, and selected Customer-managed key as shown below:

NikoNeugebauer_0-1648556192291.png

We then selected Change key option and picked our Azure Key Vault (vyelazurekeyvault) and the respective key (vyelsqlmikey) as shown on the image below:

NikoNeugebauer_0-1648560717242.png

After choosing Select and then Save options on the next screen, within a few seconds our key is now enabled as the TDE protector for our SQL Managed Instance.

NikoNeugebauer_1-1648560790043.png

Since we have enabled the option “Make this key the default TDE protector”, all the databases on the Managed Instance [vyelsqlmi1] have been encrypted with the TDE protector - vyelsqlmikey. So, all the backups taken on this instance will be encrypted with this TDE protector. 

 

Though enabling this feature is very easy, there are considerations and recommendations that one needs to follow when using customer managed Keys with Azure SQL Managed Instance. The detailed documentation on this topic is to be found at Customer-managed transparent data encryption (TDE) - Azure SQL Database & SQL Managed Instance & Azu....

 

To restore a backup encrypted with a TDE Protector from Key Vault, we need to make sure that the key material is still in the original vault under the original key name. Also, the target instance needs to have access to the TDE protector from the source instance.  

 

In this example, we intend to restore a database protected with a particular key, but we do not wish to encrypt the databases on the server with that key. So, you need to add that key on the target instance, but don't need to check the checkbox at the bottom of the blade – ‘Make this key the default TDE protector’. That way, key can be used for restoring on the target instance, without being used as a default protector. 

 

 

Navigate to the SQL Managed Instance [vyelsqlmi2] in the Azure Portal, select Transparent data encryption blade from the Resource Menu, and selected Customer-managed key  as shown below.

Make sure that the setting - 'Make this key the default TDE protector' is disabled. That way the key can be used only for restore on the target instance, without being used as a TDE protector after the restore. 

NikoNeugebauer_2-1648561008367.png


After selecting Change key option & our Azure key Vault (vyelazurekeyvault) and respective key (vyelsqlmikey) used by the source SQL Managed Instance [vyelsqlmi1]:

NikoNeugebauer_3-1648561064934.png

We chose Select and then Save options on the next screen.

NikoNeugebauer_4-1648561183316.png


With this action we have configured the necessary processes for decrypting the backups for restoring on the secondary SQL Managed Instance [vyelsqlmi2].

 

Key Vault Access Policies

Checking the access policies for the Azure Key Vault, you can see that both the SQL Managed Instances have permissions to access the key vault.  They have the necessary 3 key permissions – Get, Wrap Key and Unwrap Key, which serve for the key access, encryption and decryption respectively.

NikoNeugebauer_5-1648561353557.png

 

List of available keys on the Managed Instance


Executing Powershell comandlet Get-AzSqlInstanceKeyVaultKey  on the SQL Managed Instance will list of available keys associated with that managed instance and identify the missing ones.  If one needs to restore a database to a SQL Managed Instance, then the key which was used as part of the backup must be added to the managed instance.

Running the command on [vyelsqlmi1] listed three keys associated with it.

NikoNeugebauer_6-1648561852719.png

Note:  Azure Portal only shows only the last key assigned. To get the complete list, PowerShell is the way to go.

 

Backup and Restore

Now, we are ready to do a backup and restore as we have ensured that both the source and target SQL Manages Instances have access to the key in our Azure Key Vault.  SQL Managed instance supports only full database COPY_ONLY Backups and backing up to an Azure Blob Storage account. 

Considerations and Limitations of Manual backups on a managed instance can be found in our official documentation - T-SQL differences between SQL Server & Azure SQL Managed Instance - Azure SQL Managed Instance

 

At a high level, the steps to do a backup and restore are the following

  1. Create a container on Azure Blob Storage to store the backups.
  2. On the source Managed Instance, create a SAS credential to access the container and then back up a database to it
  3. On the target Managed Instance (MI), create a SAS credential to access the container, and then restore the backup from it

The following article explains the process to create manual backups on Azure SQL Managed instance - Database user-initiated backups. Azure SQL Managed Instance

 

Following the above described process we have created a backup of a database on [vyelsqlmi1] to the Azure Blob Storage container- mibackups as shown below:

NikoNeugebauer_0-1648563292826.png


For the restore on to the target managed instance -[vyelsqlmi2], please ensure that you follow the process stated in our quickstart in our documentation Restore a backup (SSMS) - Azure SQL Managed Instance.

NikoNeugebauer_1-1648563396618.png

As you can see on the image above, we were able to successfully restore the database to [vyelsqlmi2].

 

For the information on best practices, please use the following documentation articles that describe in depth the usage of customer managed keys together with SQL Managed instance Customer-managed transparent data encryption (TDE) - Azure SQL Database & SQL Managed Instance & Azu...

 

1 Comment
%3CLINGO-SUB%20id%3D%22lingo-sub-3270090%22%20slang%3D%22en-US%22%3EHow-to%20restore%20across%20different%20SQL%20Managed%20instances%20when%20using%20TDE%20with%20Customer%20Managed%20Keys%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3270090%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%3EThis%20how-to%20post%20focuses%20on%20how-to%20restore%20across%20different%20SQL%20Managed%20instances%20when%20using%20TDE%20with%20Customer%20Managed%20Keys.%3CBR%20%2F%3E%3CBR%20%2F%3EYou%20can%20find%20and%20reference%20the%20whole%20series%20with%20the%20following%20link%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22http%3A%2F%2Faka.ms%2Fsqlmi-howto%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttp%3A%2F%2Faka.ms%2Fsqlmi-howto%3C%2FA%3E%3CSPAN%3E.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Frelational-databases%2Fsecurity%2Fencryption%2Ftransparent-data-encryption%3Fview%3Dsql-server-ver15%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3ETransparent%20Data%20Encryption%20(TDE)%3C%2FA%3E%20is%20an%20encryption%20at%20rest%20technology%20that%20has%20been%20in%20use%20with%20SQL%20Server%20for%20many%20releases.%20It%20performs%20real-time%20encryption%20and%20decryption%20of%20the%20database%2C%20associated%20backups%2C%20and%20transaction%20log%20files%20at%20rest%20without%20requiring%20changes%20to%20the%20application.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETDE%20encrypts%20the%20storage%20of%20an%20entire%20database%20by%20using%20a%20symmetric%20key%20called%20the%20Database%20Encryption%20Key%20(DEK).%20DEK%20is%20protected%20by%20the%20TDE%20protector.%20This%20DEK%20is%20protected%20by%20the%20TDE%20protector%20which%20is%20either%20a%20service%20managed%20key%20or%20the%20customer%20managed%20key%20in%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fkey-vault%2Fgeneral%2Fbasic-concepts%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Key%20Vault%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFor%20Azure%20SQL%20Managed%20Instance%2C%20TDE%20is%20on%20by%20default%20for%20the%20instance%2C%20which%20means%20all%20databases%20created%20for%20the%20instance%20are%20enabled%20by%20TDE.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBy%20default%2C%20Azure%20SQL%20Managed%20Instance%20uses%20a%20service%20managed%20key%2C%20which%20means%20Azure%20SQL%20manages%20a%20certificate%20for%20the%20key%20(rotates%20the%20key%20and%20protects%20it%20with%20a%20root%20key%20within%20Azure).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAnother%20option%20is%20to%20use%20TDE%20with%20Customer%20managed%20Keys.%20TDE%20with%20Customer%20managed%20Keys%20uses%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-us%2Fservices%2Fkey-vault%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Key%20Vault%3C%2FA%3E%2C%20which%20provides%20highly%20available%20and%20scalable%20secure%20storage%20for%20RSA%20cryptographic%20keys%20backed%20by%20FIPS%20140-2%20Level%202%20validated%20hardware%20security%20modules%20(HSMs)%2C%20while%20Managed%20HSM%20offering%20provides%20the%20Level%203.%20Azure%20Key%20Vault%20streamlines%20the%20key%20management%20process%20and%20enables%20customers%20to%20maintain%20full%20control%20of%20encryption%20keys%2C%20including%20managing%20and%20auditing%20key%20access.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ECustomer-managed%20TDE%20provides%20the%20following%20benefits%20to%20the%20customer%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EFull%20and%20granular%20control%20over%20usage%20and%20management%20of%20the%20TDE%20protector.%26nbsp%3B%26nbsp%3B%26nbsp%3B%20(TDE%20Protector%20is%20the%20key%20used%20for%20encryption%20of%20the%20Database%20Encryption%20Key%20(DEK)%20and%20stored%20in%20the%20Key%20vault.)%3C%2FLI%3E%0A%3CLI%3ETransparency%20of%20the%20TDE%20protector%20usage.%3C%2FLI%3E%0A%3CLI%3EAbility%20to%20implement%20separation%20of%20duties%20in%20the%20management%20of%20keys%20and%20data%20within%20the%20organization.%3C%2FLI%3E%0A%3CLI%3EKey%20Vault%20administrator%20can%20revoke%20key%20access%20permissions%20to%20make%20encrypted%20database%20inaccessible.%3C%2FLI%3E%0A%3CLI%3ECentral%20management%20of%20keys%20in%20AKV.%3C%2FLI%3E%0A%3CLI%3EGreater%20trust%20from%20your%20end%20customers%2C%20since%20AKV%20is%20designed%20such%20that%20Microsoft%20can't%20see%20nor%20extract%20encryption%20keys%E2%80%99%3C%2FLI%3E%0A%3CLI%3EAbility%20to%20backup%20and%20restore%20databases%20using%20COPY_ONLY%20backups%20for%20Managed%20Instance.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EDespite%20the%20management%20overhead%2C%20because%20of%20the%20above%20advantages%2C%20most%20customers%20prefer%20to%20use%20Customer%20Managed%20Keys.%3C%2FP%3E%0A%3CP%3ENow%20that%20we%20understand%20the%20advantages%20of%20using%20TDE%20with%20customer%20managed%20keys%2C%20let%20us%20look%20at%20the%20process%20of%20doing%20a%20manual%20backup%20and%20restore%20across%20managed%20instances%20when%20using%20TDE%20with%20customer%20managed%20keys.%26nbsp%3B%20There%20are%20a%20couple%20of%20scenarios%20where%20customer%20might%20need%20to%20do%20this%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EWhen%20needing%20a%20backup%20that%20needs%20to%20be%20held%20%26gt%3B%2035%20days%3C%2FLI%3E%0A%3CLI%3EWhen%20needing%20a%20database%20refresh%20from%20one%20environment%20to%20another%20(Example%3A%20Production%20to%20Development%20or%20vice%20versa)%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CH4%20id%3D%22toc-hId-1094699633%22%20id%3D%22toc-hId-1117911448%22%3E%3CBR%20%2F%3E%3CBR%20%2F%3EHow-to%20setup%20restore%20across%20different%20SQL%20Managed%20instances%20when%20using%20TDE%20with%20Customer%20Managed%20Keys%3C%2FH4%3E%0A%3CP%3EIn%20the%20example%20below%2C%20we%20are%20restoring%20a%20database%20from%20the%20source%20SQL%20Managed%20Instance%20%5B%3CSTRONG%3Evyelsqlmi1%3C%2FSTRONG%3E%5D%20to%20the%20target%20SQL%20Managed%20Instance%20%5B%3CSTRONG%3Evyelsqlmi2%3C%2FSTRONG%3E%5D.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWe%20have%20used%20our%20Azure%20subscription%20to%20create%20a%20new%20Azure%20Key%20Vault%20and%20added%20a%20key%20to%20it.%20Then%20we%20have%20navigated%20to%20the%20SQL%20Managed%20Instance%20%5B%3CSTRONG%3Evyelsqlmi1%3C%2FSTRONG%3E%5D%2C%20selected%20%3CEM%3ETransparent%20Data%20Encryption%3C%2FEM%3E%20blade%20from%20the%20Resource%20Menu%2C%20and%20selected%20Customer-managed%20key%20as%20shown%20below%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22NikoNeugebauer_0-1648556192291.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F359515i040DC21E81BEEA3A%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22NikoNeugebauer_0-1648556192291.png%22%20alt%3D%22NikoNeugebauer_0-1648556192291.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EWe%20then%20selected%20%3CSTRONG%3EChange%20key%3C%2FSTRONG%3E%20option%20and%20picked%20our%20Azure%20Key%20Vault%20(%3CSTRONG%3Evyelazurekeyvault%3C%2FSTRONG%3E)%20and%20the%20respective%20key%20(%3CSTRONG%3Evyelsqlmikey%3C%2FSTRONG%3E)%20as%20shown%20on%20the%20image%20below%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22NikoNeugebauer_0-1648560717242.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F359562i062FD193E11F4B8D%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22NikoNeugebauer_0-1648560717242.png%22%20alt%3D%22NikoNeugebauer_0-1648560717242.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EAfter%20choosing%20%3CSTRONG%3ESelect%3C%2FSTRONG%3E%20and%20then%20%3CSTRONG%3ESave%3C%2FSTRONG%3E%26nbsp%3Boptions%20on%20the%20next%20screen%2C%20within%20a%20few%20seconds%20our%20key%20is%20now%20enabled%20as%20the%20TDE%20protector%20for%20our%20SQL%20Managed%20Instance.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22NikoNeugebauer_1-1648560790043.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F359563iC55FB9B5BD79F3C2%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22NikoNeugebauer_1-1648560790043.png%22%20alt%3D%22NikoNeugebauer_1-1648560790043.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3ESince%20we%20have%20enabled%20the%20option%20%E2%80%9C%3CSTRONG%3EMake%20this%20key%20the%20default%20TDE%20protector%3C%2FSTRONG%3E%E2%80%9D%2C%20all%20the%20databases%20on%20the%20Managed%20Instance%26nbsp%3B%5B%3CSTRONG%3Evyelsqlmi1%3C%2FSTRONG%3E%5D%20have%20been%20encrypted%20with%20the%20TDE%20protector%20-%20%3CSTRONG%3Evyelsqlmikey%3C%2FSTRONG%3E.%20So%2C%20all%20the%20backups%20taken%20on%20this%20instance%20will%20be%20encrypted%20with%20this%20TDE%20protector.%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EThough%20enabling%20this%20feature%20is%20very%20easy%2C%20there%20are%20considerations%20and%20recommendations%20that%20one%20needs%20to%20follow%20when%20using%20customer%20managed%20Keys%20with%20Azure%20SQL%20Managed%20Instance.%20The%20detailed%20documentation%20on%20this%20topic%20is%20to%20be%20found%20at%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-sql%2Fdatabase%2Ftransparent-data-encryption-byok-overview%3Fview%3Dsql-server-ver15%23recommendations-when-configuring-customer-managed-tde%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ECustomer-managed%20transparent%20data%20encryption%20(TDE)%20-%20Azure%20SQL%20Database%20%26amp%3B%20SQL%20Managed%20Instance%20%26amp%3B%20Azure%20Synapse%20Analytics%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3ETo%20restore%20a%20backup%20encrypted%20with%20a%20TDE%20Protector%20from%20Key%20Vault%2C%20we%20need%20to%20make%20sure%20that%20the%20key%20material%20is%20still%20in%20the%20original%20vault%20under%20the%20original%20key%20name.%20Also%2C%20the%20target%20instance%20needs%20to%20have%20access%20to%20the%20TDE%20protector%20from%20the%20source%20instance.%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EIn%20this%20example%2C%20we%20intend%20to%20restore%20a%20database%20protected%20with%20a%20particular%20key%2C%20but%20we%20do%20not%20wish%20to%20encrypt%20the%20databases%20on%20the%20server%20with%20that%20key.%20So%2C%20you%20need%20to%20add%20that%20key%20on%20the%20target%20instance%2C%20but%20don't%20need%20to%20check%20the%20checkbox%20at%20the%20bottom%20of%20the%20blade%20%E2%80%93%20%E2%80%98%3CSTRONG%3EMake%20this%20key%20the%20default%20TDE%20protector%3C%2FSTRONG%3E%E2%80%99.%20That%20way%2C%20key%20can%20be%20used%20for%20restoring%20on%20the%20target%20instance%2C%20without%20being%20used%20as%20a%20default%20protector.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3ENavigate%20to%20the%20SQL%20Managed%20Instance%20%5B%3CSTRONG%3Evyelsqlmi2%3C%2FSTRONG%3E%5D%20in%20the%20Azure%20Portal%2C%20select%20%3CSTRONG%3ETransparent%20data%20encryption%3C%2FSTRONG%3E%26nbsp%3Bblade%20from%20the%20Resource%20Menu%2C%20and%20selected%20Customer-managed%20key%26nbsp%3B%20as%20shown%20below.%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CU%3E%3CSTRONG%3EMake%20sure%20that%20the%20setting%20-%20'Make%20this%20key%20the%20default%20TDE%20protector'%20is%20disabled%3C%2FSTRONG%3E%3C%2FU%3E.%20%3C%2FSPAN%3E%3CSPAN%3EThat%20way%20the%20key%20can%20be%20used%20only%20for%20restore%20on%20the%20target%20instance%2C%20without%20being%20used%20as%20a%20TDE%20protector%20after%20the%20restore.%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22NikoNeugebauer_2-1648561008367.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F359566i4947F8CD68070D4C%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22NikoNeugebauer_2-1648561008367.png%22%20alt%3D%22NikoNeugebauer_2-1648561008367.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EAfter%20selecting%20%3CSTRONG%3EChange%20key%3C%2FSTRONG%3E%26nbsp%3Boption%20%26amp%3B%20our%20Azure%20key%20Vault%20(%3CSTRONG%3Evyelazurekeyvault%3C%2FSTRONG%3E)%20and%20respective%20key%20(%3CSTRONG%3Evyelsqlmikey%3C%2FSTRONG%3E)%20used%20by%20the%20source%20SQL%20Managed%20Instance%20%5B%3CSTRONG%3Evyelsqlmi1%3C%2FSTRONG%3E%5D%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22NikoNeugebauer_3-1648561064934.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F359567i53571127CD381CF0%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22NikoNeugebauer_3-1648561064934.png%22%20alt%3D%22NikoNeugebauer_3-1648561064934.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EWe%20chose%20%3CSTRONG%3ESelect%3C%2FSTRONG%3E%20and%20then%20%3CSTRONG%3ESave%3C%2FSTRONG%3E%26nbsp%3Boptions%20on%20the%20next%20screen.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22NikoNeugebauer_4-1648561183316.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F359571iC4386469D793B5A4%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22NikoNeugebauer_4-1648561183316.png%22%20alt%3D%22NikoNeugebauer_4-1648561183316.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EWith%20this%20action%20we%20have%20configured%20the%20necessary%20processes%20for%20decrypting%20the%20backups%20for%20restoring%20on%20the%20secondary%20SQL%20Managed%20Instance%26nbsp%3B%5B%3CSTRONG%3Evyelsqlmi2%3C%2FSTRONG%3E%5D.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH4%20id%3D%22toc-hId--712754830%22%20id%3D%22toc-hId--689543015%22%3E%3CSPAN%3E%3CSTRONG%3EKey%20Vault%20Access%20Policies%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FH4%3E%0A%3CP%3E%3CSPAN%3EChecking%20the%20access%20policies%20for%20the%20Azure%20Key%20Vault%2C%20you%20can%20see%20that%20both%20the%20SQL%20Managed%20Instances%20have%20permissions%20to%20access%20the%20key%20vault.%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%20They%20have%20the%20necessary%203%20key%20permissions%20%E2%80%93%20%3CSTRONG%3EGet%2C%20Wrap%20Key%20and%20Unwrap%20Key%3C%2FSTRONG%3E%2C%20which%20serve%20for%20the%20key%20access%2C%20encryption%20and%20decryption%20respectively.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22NikoNeugebauer_5-1648561353557.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F359573i8D4476FD0F3C622D%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22NikoNeugebauer_5-1648561353557.png%22%20alt%3D%22NikoNeugebauer_5-1648561353557.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSTRONG%3EList%20of%20available%20keys%20on%20the%20Managed%20Instance%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EExecuting%20Powershell%20comandlet%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Faz.sql%2Fget-azsqlinstancekeyvaultkey%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EGet-AzSqlInstanceKeyVaultKey%3C%2FA%3E%E2%80%AF%20on%20the%20SQL%20Managed%20Instance%20will%20list%20of%20available%20keys%20associated%20with%20that%20managed%20instance%20and%20identify%20the%20missing%20ones.%E2%80%AF%26nbsp%3BIf%20one%20needs%20to%20restore%20a%20database%20to%20a%20SQL%20Managed%20Instance%2C%20then%20the%20key%20which%20was%20used%20as%20part%20of%20the%20backup%20must%20be%20added%20to%20the%20managed%20instance.%3C%2FP%3E%0A%3CP%3E%3CSPAN%3ERunning%20the%20command%20on%20%5B%3CSTRONG%3Evyelsqlmi1%3C%2FSTRONG%3E%5D%20listed%20three%20keys%20associated%20with%20it.%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22NikoNeugebauer_6-1648561852719.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F359577iCD2DD776A9AD84E9%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22NikoNeugebauer_6-1648561852719.png%22%20alt%3D%22NikoNeugebauer_6-1648561852719.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CU%3ENote%3A%20%26nbsp%3BAzure%20Portal%20only%20shows%20only%20the%20last%20key%20assigned.%20To%20get%20the%20complete%20list%2C%20PowerShell%20is%20the%20way%20to%20go.%3C%2FU%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH4%20id%3D%22toc-hId-1774758003%22%20id%3D%22toc-hId-1797969818%22%3E%3CSTRONG%3EBackup%20and%20Restore%3C%2FSTRONG%3E%3C%2FH4%3E%0A%3CP%3ENow%2C%20we%20are%20ready%20to%20do%20a%20backup%20and%20restore%20as%20we%20have%20ensured%20that%20both%20the%20source%20and%20target%20SQL%20Manages%20Instances%20have%20access%20to%20the%20key%20in%20our%20Azure%20Key%20Vault.%26nbsp%3B%20SQL%20Managed%20instance%20supports%20only%20full%20database%20COPY_ONLY%20Backups%20and%20backing%20up%20to%20an%20Azure%20Blob%20Storage%20account.%26nbsp%3B%3C%2FP%3E%0A%3CP%3EConsiderations%20and%20Limitations%20of%20Manual%20backups%20on%20a%20managed%20instance%20can%20be%20found%20in%20our%20official%20documentation%20-%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-sql%2Fmanaged-instance%2Ftransact-sql-tsql-differences-sql-server%23backup%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ET-SQL%20differences%20between%20SQL%20Server%20%26amp%3B%20Azure%20SQL%20Managed%20Instance%20-%20Azure%20SQL%20Managed%20Instance%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAt%20a%20high%20level%2C%20the%20steps%20to%20do%20a%20backup%20and%20restore%20are%20the%20following%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3ECreate%20a%20container%20on%20Azure%20Blob%20Storage%20to%20store%20the%20backups.%3C%2FLI%3E%0A%3CLI%3EOn%20the%20%3CSTRONG%3Esource%3C%2FSTRONG%3E%20Managed%20Instance%2C%20create%20a%20SAS%20credential%20to%20access%20the%20container%20and%20then%20back%20up%20a%20database%20to%20it%3C%2FLI%3E%0A%3CLI%3EOn%20the%20%3CSTRONG%3Etarget%3C%2FSTRONG%3E%20Managed%20Instance%20(MI)%2C%20create%20a%20SAS%20credential%20to%20access%20the%20container%2C%20and%20then%20restore%20the%20backup%20from%20it%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EThe%20following%20article%20explains%20the%20process%20to%20create%20manual%20backups%20on%20Azure%20SQL%20Managed%20instance%20-%20%3CA%20href%3D%22https%3A%2F%2Fmedium.com%2Fazure-sqldb-managed-instance%2Fdatabase-user-initiated-backups-2d604fcdc848%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EDatabase%20user-initiated%20backups.%20Azure%20SQL%20Managed%20Instance%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFollowing%20the%20above%20described%20process%20we%20have%20created%20a%20backup%20of%20a%20database%20on%20%5B%3CSTRONG%3Evyelsqlmi1%3C%2FSTRONG%3E%5D%20to%20the%20Azure%20Blob%20Storage%20container-%20%3CSTRONG%3Emibackups%3C%2FSTRONG%3E%20as%20shown%20below%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22NikoNeugebauer_0-1648563292826.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F359585iD3BF5B2124ECA7EC%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22NikoNeugebauer_0-1648563292826.png%22%20alt%3D%22NikoNeugebauer_0-1648563292826.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EFor%20the%20restore%20on%20to%20the%20target%20managed%20instance%20-%5B%3CSTRONG%3Evyelsqlmi2%3C%2FSTRONG%3E%5D%2C%20please%20ensure%20that%20you%20follow%20the%20process%20stated%20in%20our%20quickstart%20in%20our%20documentation%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-sql%2Fmanaged-instance%2Frestore-sample-database-quickstart%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ERestore%20a%20backup%20(SSMS)%20-%20Azure%20SQL%20Managed%20Instance%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22NikoNeugebauer_1-1648563396618.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F359587iD632343D747AA032%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22NikoNeugebauer_1-1648563396618.png%22%20alt%3D%22NikoNeugebauer_1-1648563396618.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EAs%20you%20can%20see%20on%20the%20image%20above%2C%20we%20were%20able%20to%20successfully%20restore%20the%20database%20to%20%5B%3CSTRONG%3Evyelsqlmi2%3C%2FSTRONG%3E%5D.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFor%20the%20information%20on%20best%20practices%2C%20please%20use%20the%20following%20documentation%20articles%20that%20describe%20in%20depth%20the%20usage%20of%20customer%20managed%20keys%20together%20with%20SQL%20Managed%20instance%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-sql%2Fdatabase%2Ftransparent-data-encryption-byok-overview%23requirements-for-configuring-customer-managed-tde%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ECustomer-managed%20transparent%20data%20encryption%20(TDE)%20-%20Azure%20SQL%20Database%20%26amp%3B%20SQL%20Managed%20Instance%20%26amp%3B%20Azure%20Synapse%20Analytics%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-3270090%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-left%22%20image-alt%3D%22NikoNeugebauer_2-1648561008367.png%22%20style%3D%22width%3A%20200px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F359566i4947F8CD68070D4C%2Fimage-size%2Fsmall%3Fv%3Dv2%26amp%3Bpx%3D200%22%20role%3D%22button%22%20title%3D%22NikoNeugebauer_2-1648561008367.png%22%20alt%3D%22NikoNeugebauer_2-1648561008367.png%22%20%2F%3E%3C%2FSPAN%3E%3CSPAN%3EThis%20how-to%20post%20focuses%20on%20how-to%20restore%20across%20different%20SQL%20Managed%20instances%20when%20using%20TDE%20with%20Customer%20Managed%20Keys.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3ETransparent%20Data%20Encryption%20(TDE)%26nbsp%3Bwith%20Customer%20Managed%20Keys%20uses%26nbsp%3BAzure%20Key%20Vault%2C%20which%20provides%20highly%20available%20and%20scalable%20secure%20storage%20for%20RSA%20cryptographic%20keys%20backed%20by%20FIPS%20140-2%20Level%202%20validated%20hardware%20security%20modules%20(HSMs).%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3270090%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20SQL%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%20SQL%20Managed%20Instance%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3270882%22%20slang%3D%22en-US%22%3ERe%3A%20How-to%20restore%20across%20different%20SQL%20Managed%20instances%20when%20using%20TDE%20with%20Customer%20Managed%20Keys%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3270882%22%20slang%3D%22en-US%22%3E%3CP%3Ereally%20helpful%3C%2FP%3E%3C%2FLINGO-BODY%3E
Version history
Last update:
‎Mar 29 2022 07:44 AM
Updated by: