Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot create Keyvault key and enable customer-key encryption for PostgreSQL at the same time. #85

Open
dingjianrui opened this issue Mar 8, 2021 · 0 comments

Comments

@dingjianrui
Copy link

I found if we need to enable the customer key encryption for the PostgreSQL database, the "serverKeyName" must be in this format: "KeyvaultName_keyName_keyVersion".

"variables": {
"serverKeyName": "[concat(parameters('keyVaultName'), '_', parameters('keyName'), '_', parameters('keyVersion'))]"
},

which makes it impossible to create the keyvault key and enable the customer-key encryption at the same within one ARM template, cause we cannot use the ARM function "reference" to reference the key we created and extract the dynamically generated version number. The "reference" function cannot be used in variables definition, resource name and types.

{
"name": "[concat(parameters('serverName'), '/', variables('serverKeyName'))]",
"type": "Microsoft.DBforPostgreSQL/servers/keys",
"apiVersion": "2020-01-01-preview",
"dependsOn": [
"addAccessPolicy",
"[resourceId('Microsoft.DBforPostgreSQL/servers', parameters('serverName'))]"
],
"properties": {
"serverKeyType": "AzureKeyVault",
"uri": "[concat(reference(resourceId(parameters('keyVaultResourceGroupName'), 'Microsoft.KeyVault/vaults/', parameters('keyVaultName')), '2018-02-14-preview', 'Full').properties.vaultUri, 'keys/', parameters('keyName'), '/', parameters('keyVersion'))]"
}
}

Questions:
How to create the keyvault key and enable the customer-key encryption at the same time within one ARM template?

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant