Open TehFamine opened 2 years ago
When I removed the key_name from the block to force Terraform to use the default "cmk" name instead, I see the changes applied in the plan and deployment.
~ key_name = "kv-encryption-cmk" -> "cmk"
But the actual change is not reflective in the Synapse properties. Some really weird things going on with Synapse Workspace with CMK's and Managed VNET's.
This is actually a MSFT issue. Sometime between 03/18-03/20 any key name with -'s doesnt work for Synapse Workspace. I have a case open and am escalating it to have this behavir fixed. As a work around you can create a key without -'s for the time being, but if you use a specific format where you need -'s I'm not sure of their ETA to address (but you could open a ticket with MSFT).
This is actually a MSFT issue. Sometime between 03/18-03/20 any key name with -'s doesnt work for Synapse Workspace. I have a case open and am escalating it to have this behavir fixed. As a work around you can create a key without -'s for the time being, but if you use a specific format where you need -'s I'm not sure of their ETA to address (but you could open a ticket with MSFT).
Thanks. This did fix my issue. Just to make this more clear. You must remove all hyphens key vault key name, not the URL or the key vault name itself. I was able to activate the workspace after I did those changes.
Community Note
Terraform (and AzureRM Provider) Version
Terraform = 1.1.5 hashicorp/azurerm = 2.94.0 azure-cli = 2.34.1
Affected Resource(s)
azurerm_synapse_workspace
customer_managed_key
Terraform Configuration Files
Debug Output
None to provide. Don't have direct access to Terraform service. Running from CI/CD commits.
Panic Output
None to provide.
Expected Behaviour
When you enable
managed_virtual_network_enabled
to be True and turn off public access, then you need to provide acustomer_managed_key
with both akey_versionless_id
andkey_name
. You can generate this usingazurerm_key_vault_key
and supplying the key to theazurerm_synapse_workspace
. Then you can grant the Synapse resource to that key using theazurerm_key_vault_access_policy
so it can activate the workspace. If all permissions are set, private endpoints are created for both the Key Vault, Synapse Dev, and so forth, then the Synapse resource SHOULD be able to access that key over the managed VNET.Actual Behaviour
Customer key vault base url in 'https://<removed>.vault.azure.net/keys/kv-encryption-dev-cmk' is invalid. Valid key vault endpoint base urls: https://<vault-name>.vault.azure.net, https://<hsm-name>.managedhsm.azure.net or equivalent in national cloouds.
This is the Azure error when trying to activate the workspace manually. The URL is verified as correct. The private endpoints are deployed and targeting the right subnets with the right private DNS zones, and the Synapse resource (MI) is part of the access policy with the right permissions to wrap, unwrap, read, list, purge, and more. We verified the Key Vault Private Endpoints are working as expected via the Firewall/logs.
When using other resources like
azurerm_synapse_workspace_key
. Similar errors occur with Terraform not able to find the key with the valid key vault URL. We also cannot useazurerm_synapse_workspace_aad_admin
because the workspace cannot be activated when the key vault, the key URL cannot be found.It looks like Synapse is not able to see the URL because it's not able to access our Private VNET via the Private Endpoint.
Steps to Reproduce
Run above.
Important Factoids
We deployed same configuration within the Azure Portal fine using the same Private Endpoint configurations, DNS Zones, and similar VNet's that are peered to a Hub and Spoke model. We cannot deploy Synapse with Public Access On and MUST use the
managed_virtual_network_enabled
to be True due to policy.References
None