We are trying to add Always encrypted in one of our application and we would like to make it work with our CI flow.
We are using DACPAC deploy with Azure Devops. Everything worked until now but we are facing a challenge with always encrypted...
Each SQL environment needs to have a different key that is in Azure Key Vault. The way we found to automate this is by using a SSDT Variables (ref)
CREATE COLUMN MASTER KEY [ResponseKey] WITH (
KEY_STORE_PROVIDER_NAME = N'AZURE_KEY_VAULT',
KEY_PATH = N'[$(OurVariableName)]' );
When the compare between our DB and the DACPAC is done, the script always contains the Drop + Create of the key even if the value of the key is the same. We tried outputting the generated script and our key value from Azure Key vault is in the variable section of the script. It is as if, the compare doesn't work with variables.
Has anyone made this work?
Also, when we add a new encrypted column, the generated script always fail, stating that there is data already in the table. This seems the opposite of this link