Open edi239 opened 2 years ago
@edi239 thanks for opening this issue here. Could you try changing Account select method
below to From Azure Subscription
and select database sql_db
to see if the managed private endpoint is available?
On my side, it worked fine even though the Account selection method
was set to Enter manually
. But the Fully qualified domain name
and database name should be specified manually instead of the default value *.
In terraform-code I used the same parameters as I used manually (The picture under expected behaviour). Manually it worked. But in terraform it did not. The managed private endpoint in the manual section is deployed also by terraform. There is no problem to use it.
I did not find a way to enter the parameters to "from azure subscription" it switches always to "enter manually"
Hi @edi239,
Thanks for your quick reply.
Here is the Azure API called by terraform resource azurerm_data_factory_managed_private_endpoint
. Since the target_resource_id
property of azurerm_data_factory_managed_private_endpoint
(aka the privateLinkResourceId property of Azure API ) has been correctly set to azurerm_mssql_server.sql_server.id
by terraform. And the managed private endpoint is actually be found in Azure portal(either From Azure subscription
or Enter manually
), so I assume that terraform's job is done.
In additional, there is no corresponding property for Account selection method
related settings in the Azure API, so terraform could not determine its selection value. For Enter Manually
in Azure Portal, it seems to me that it literally means manual enter instead of using the default value *, WDYT?
Hi @sinbai,
Thank you for your answer.
I don't think that the problem is the private endpoint. The problem here is the azurerm_data_factory_linked_service_azure_sql_database resource. If I enter the parameter of the manually I can read them afterwards and the private endpoint is found by azure. If I deploy them via terraform I can't read them, because they are hidden. See pictures above. In my oppinion the value under Fully qualified domain name is not correct. So the service can't find the correct private endpoint. In my oppinion there are two possibilities. The first one is that terraform delivers the wrong parameters (perhaps as secure string which the azure portal can't read correctly) or the azure api doesn't work correctly in this point.
On my side, it worked fine even though the
Account selection method
was set toEnter manually
. But theFully qualified domain name
and database name should be specified manually instead of the default value *.
Hi, for the above result, how did you enter the values using terraform?
This issue clearly still active. The issue, as mentioned by @edi239 above, is around how TF sets the connection settings. Thus, Data Factory cannot determine which server it connects to to map to the private link.
`resource "azurerm_data_factory_linked_service_azure_sql_database" "example" { name = "example" data_factory_id = azurerm_data_factory.example.id integration_runtime_name = azurerm_data_factory_integration_runtime_azure.example.name connection_string = "Data Source=example.database.windows.net;Initial Catalog=example;User ID=test;"
key_vault_password { linked_service_name = azurerm_data_factory_linked_service_key_vault.example.name secret_name = "sql-password" } }`
Here the connection string is set to a secure string - this causes the behaviour above - https://github.com/hashicorp/terraform-provider-azurerm/blob/15921fe5695cbe6bd5fd9ce96c9cca1fc2e77689/internal/services/datafactory/data_factory_linked_service_azure_sql_database_resource.go#L210
However, Azure API allows either of three: "The connection string. Type: string, SecureString or AzureKeyVaultSecretReference" - https://github.com/Azure/azure-rest-api-specs/blob/208c91dc71eec634400fb0c0a7e073e35afd2978/specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/entityTypes/LinkedService.json#L381
Changing the data type of the connection string must fix the issue and allow the setting up of private endpoints for Azure SQL Database connections. Anyone who can change that?
Is there an existing issue for this?
Community Note
Terraform Version
1.2.8
AzureRM Provider Version
3.2.0
Affected Resource(s)/Data Source(s)
azurerm_data_factory_linked_service_azure_sql_database
Terraform Configuration Files
Debug Output/Panic Output
Expected Behaviour
After deployment the linked service should be able to connect to the sqlserver like this:
Actual Behaviour
Test Connection to sql server will produce the above error. Private Endpoint is not found by linked service
Steps to Reproduce
terraform plan terraform apply Approve Private Endpoint in SQL Server - Networking - Private Endpoints
Wait some time to let integration service get healthy
Go to datafactory Open Azure DataFactory Studio Go To linked services Open linked service Look whether interactive authoring is enabled - otherwise enable it
Test Connection
Important Factoids
No response
References
No response