Skip to content

azurermDataFactoryLinkedServiceSqlServer

Manages a Linked Service (connection) between a SQL Server and Azure Data Factory.

\~> Note: All arguments including the client secret will be stored in the raw state as plain-text. Read more about sensitive data in state.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "West Europe",
    name: "example-resources",
  }
);
const azurermDataFactoryExample = new azurerm.dataFactory.DataFactory(
  this,
  "example_1",
  {
    location: azurermResourceGroupExample.location,
    name: "example",
    resource_group_name: azurermResourceGroupExample.name,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermDataFactoryExample.overrideLogicalId("example");
const azurermDataFactoryLinkedServiceSqlServerExample =
  new azurerm.dataFactoryLinkedServiceSqlServer.DataFactoryLinkedServiceSqlServer(
    this,
    "example_2",
    {
      connection_string:
        "Integrated Security=False;Data Source=test;Initial Catalog=test;User ID=test;Password=test",
      data_factory_id: azurermDataFactoryExample.id,
      name: "example",
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermDataFactoryLinkedServiceSqlServerExample.overrideLogicalId("example");

Example Usage with Password in Key Vault

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "West Europe",
    name: "example-resources",
  }
);
const dataAzurermClientConfigCurrent =
  new azurerm.dataAzurermClientConfig.DataAzurermClientConfig(
    this,
    "current",
    {}
  );
const azurermDataFactoryExample = new azurerm.dataFactory.DataFactory(
  this,
  "example_2",
  {
    location: azurermResourceGroupExample.location,
    name: "example",
    resource_group_name: azurermResourceGroupExample.name,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermDataFactoryExample.overrideLogicalId("example");
const azurermKeyVaultExample = new azurerm.keyVault.KeyVault(
  this,
  "example_3",
  {
    location: azurermResourceGroupExample.location,
    name: "example",
    resource_group_name: azurermResourceGroupExample.name,
    sku_name: "standard",
    tenant_id: dataAzurermClientConfigCurrent.tenantId,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermKeyVaultExample.overrideLogicalId("example");
const azurermDataFactoryLinkedServiceKeyVaultExample =
  new azurerm.dataFactoryLinkedServiceKeyVault.DataFactoryLinkedServiceKeyVault(
    this,
    "example_4",
    {
      data_factory_id: azurermDataFactoryExample.id,
      key_vault_id: azurermKeyVaultExample.id,
      name: "kvlink",
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermDataFactoryLinkedServiceKeyVaultExample.overrideLogicalId("example");
const azurermDataFactoryLinkedServiceSqlServerExample =
  new azurerm.dataFactoryLinkedServiceSqlServer.DataFactoryLinkedServiceSqlServer(
    this,
    "example_5",
    {
      connection_string:
        "Integrated Security=False;Data Source=test;Initial Catalog=test;User ID=test;",
      data_factory_id: azurermDataFactoryExample.id,
      key_vault_password: [
        {
          linked_service_name:
            azurermDataFactoryLinkedServiceKeyVaultExample.name,
          secret_name: "secret",
        },
      ],
      name: "example",
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermDataFactoryLinkedServiceSqlServerExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • name - (Required) Specifies the name of the Data Factory Linked Service SQL Server. Changing this forces a new resource to be created. Must be unique within a data factory. See the Microsoft documentation for all restrictions.

  • dataFactoryId - (Required) The Data Factory ID in which to associate the Linked Service with. Changing this forces a new resource.

  • connectionString - (Optional) The connection string in which to authenticate with the SQL Server. Exactly one of either connectionString or keyVaultConnectionString is required.

  • description - (Optional) The description for the Data Factory Linked Service SQL Server.

  • integrationRuntimeName - (Optional) The integration runtime reference to associate with the Data Factory Linked Service SQL Server.

  • annotations - (Optional) List of tags that can be used for describing the Data Factory Linked Service SQL Server.

  • parameters - (Optional) A map of parameters to associate with the Data Factory Linked Service SQL Server.

  • additionalProperties - (Optional) A map of additional properties to associate with the Data Factory Linked Service SQL Server.

  • keyVaultConnectionString - (Optional) A keyVaultConnectionString block as defined below. Use this argument to store SQL Server connection string in an existing Key Vault. It needs an existing Key Vault Data Factory Linked Service. Exactly one of either connectionString or keyVaultConnectionString is required.

  • keyVaultPassword - (Optional) A keyVaultPassword block as defined below. Use this argument to store SQL Server password in an existing Key Vault. It needs an existing Key Vault Data Factory Linked Service.

  • userName - (Optional) The on-premises Windows authentication user name.


A keyVaultConnectionString block supports the following:

  • linkedServiceName - (Required) Specifies the name of an existing Key Vault Data Factory Linked Service.

  • secretName - (Required) Specifies the secret name in Azure Key Vault that stores SQL Server connection string.


A keyVaultPassword block supports the following:

  • linkedServiceName - (Required) Specifies the name of an existing Key Vault Data Factory Linked Service.

  • secretName - (Required) Specifies the secret name in Azure Key Vault that stores SQL Server password.


Attributes Reference

The following attributes are exported:

  • id - The ID of the Data Factory SQL Server Linked Service.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 30 minutes) Used when creating the Data Factory SQL Server Linked Service.
  • update - (Defaults to 30 minutes) Used when updating the Data Factory SQL Server Linked Service.
  • read - (Defaults to 5 minutes) Used when retrieving the Data Factory SQL Server Linked Service.
  • delete - (Defaults to 30 minutes) Used when deleting the Data Factory SQL Server Linked Service.

Import

Data Factory SQL Server Linked Service's can be imported using the resourceId, e.g.

terraform import azurerm_data_factory_linked_service_sql_server.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example/providers/Microsoft.DataFactory/factories/example/linkedservices/example