hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.61k stars 4.65k forks source link

Linked service azurerm_data_factory_linked_service_azure_file_storage connection fails #15220

Open sumit49033 opened 2 years ago

sumit49033 commented 2 years ago

Linked service azurerm_data_factory_linked_service_azure_file_storage created from terraform in the datafactory fails to connect. Following is the error when I test the connection - Error code: 21206 Details: The file name '' does not conform to the naming rules by the data store 'FileServer'. The path is not of a legal form. Activity ID: 83734148-7e8f-4f1b-a0ed-0dbc855e1a2a.

I suspect the JSON created through the terraform is not valid, below the sample JSON, ( removed the accountkey and name)

{ "name": "AzureFileStorage1", "type": "Microsoft.DataFactory/factories/linkedservices", "properties": { "type": "AzureFileStorage", "typeProperties": { "host": "", "userId": "DefaultEndpointsProtocol=https;AccountName=removingtheaccountnamehere;AccountKey=removingthekeyhere;EndpointSuffix=core.windows.net", "connectionString": { "type": "SecureString", "value": "**" }, "fileShare": "fileshare-test" }, "annotations": [] } }

Above JSON should have encryptedCredential parameter as well.

srinipradhu commented 2 years ago

Hi Team, Any fix on the above issue

ljluestc commented 1 month ago

resource "azurerm_data_factory_linked_service_azure_file_storage" "example" {
  name                = "AzureFileStorage1"
  data_factory_name   = azurerm_data_factory.example.name
  resource_group_name = azurerm_resource_group.example.name

  properties {
    type = "AzureFileStorage"

    type_properties {
      host                 = "https://<your-storage-account-name>.file.core.windows.net"
      file_share           = "fileshare-test"

      user_id              = "DefaultEndpointsProtocol=https;AccountName=<your-storage-account-name>;AccountKey=<your-storage-account-key>;EndpointSuffix=core.windows.net"

      connection_string {
        type  = "SecureString"
        value = "<your-connection-string>"
      }

      encrypted_credential = "<your-encrypted-credential>"  # Add your encrypted credential here
    }
  }
}