The following bicep script should create a SQL Server. However, due to Azure policy violation it fails, and requires that I use customer-managed keys to encrypt data. See Error:
Here's the code block to encrypt protection for SQL Server. Still getting the error above (not sure why it won't work):
resource sqlServer 'Microsoft.Sql/servers@2021-11-01' = {
location: location
name: name
properties: {
administratorLogin: adminUsername
administratorLoginPassword: adminPassword
publicNetworkAccess: publicNetworkAccess
}
}
resource encryptProtectSQLServer 'Microsoft.Sql/servers/encryptionProtector@2021-11-01' = {
name: 'current'
parent: sqlServer
properties: {
autoRotationEnabled: true
serverKeyName: 'key-adf-cdis-devtest-va'
serverKeyType: 'AzureKeyVault'
}
}
When I add keyId:
resource sqlServer 'Microsoft.Sql/servers@2021-11-01' = {
location: location
name: name
properties: {
administratorLogin: adminUsername
administratorLoginPassword: adminPassword
publicNetworkAccess: publicNetworkAccess
keyId: 'https://kvinfratestva.vault.usgovcloudapi.net/keys/key-pcr-sqlserver/654aa7c96d51450cassaassa15fce3ff26'
}
}
I get the following error: