Back to Blog
2 min read

Azure Data Factory Linked Services: Connect Everything

Linked Services are Data Factory’s connection strings. They define how to connect to data sources—from Azure storage to on-premises databases to SaaS applications.

Common Linked Services

Azure Blob Storage

{
    "name": "AzureBlobStorageLS",
    "type": "Microsoft.DataFactory/factories/linkedservices",
    "properties": {
        "type": "AzureBlobStorage",
        "typeProperties": {
            "connectionString": {
                "type": "AzureKeyVaultSecret",
                "store": {
                    "referenceName": "AzureKeyVaultLS",
                    "type": "LinkedServiceReference"
                },
                "secretName": "StorageConnectionString"
            }
        }
    }
}

Azure SQL Database

{
    "name": "AzureSqlLS",
    "properties": {
        "type": "AzureSqlDatabase",
        "typeProperties": {
            "connectionString": "Server=tcp:myserver.database.windows.net;Database=mydb;",
            "authenticationType": "ManagedIdentity"
        }
    }
}

Azure Data Lake Storage Gen2

{
    "name": "ADLSGen2LS",
    "properties": {
        "type": "AzureBlobFS",
        "typeProperties": {
            "url": "https://mystorageaccount.dfs.core.windows.net",
            "accountKey": {
                "type": "AzureKeyVaultSecret",
                "store": {
                    "referenceName": "AzureKeyVaultLS",
                    "type": "LinkedServiceReference"
                },
                "secretName": "ADLSKey"
            }
        }
    }
}

Azure Synapse Analytics

{
    "name": "SynapseLS",
    "properties": {
        "type": "AzureSqlDW",
        "typeProperties": {
            "connectionString": "Server=tcp:mysynapse.sql.azuresynapse.net;Database=pool1;",
            "authenticationType": "ManagedIdentity"
        }
    }
}

Cosmos DB

{
    "name": "CosmosDbLS",
    "properties": {
        "type": "CosmosDb",
        "typeProperties": {
            "connectionString": {
                "type": "AzureKeyVaultSecret",
                "store": { "referenceName": "AzureKeyVaultLS", "type": "LinkedServiceReference" },
                "secretName": "CosmosConnectionString"
            },
            "database": "mydb"
        }
    }
}

SQL Server (On-Premises)

{
    "name": "OnPremSqlLS",
    "properties": {
        "type": "SqlServer",
        "typeProperties": {
            "connectionString": "Server=myserver;Database=mydb;Integrated Security=True",
            "userName": "myuser",
            "password": {
                "type": "AzureKeyVaultSecret",
                "store": { "referenceName": "AzureKeyVaultLS", "type": "LinkedServiceReference" },
                "secretName": "SqlPassword"
            }
        },
        "connectVia": {
            "referenceName": "SelfHostedIR",
            "type": "IntegrationRuntimeReference"
        }
    }
}

Key Vault Integration

{
    "name": "AzureKeyVaultLS",
    "properties": {
        "type": "AzureKeyVault",
        "typeProperties": {
            "baseUrl": "https://mykeyvault.vault.azure.net/"
        }
    }
}

Managed Identity Authentication

Best practice: use Managed Identity where supported.

{
    "properties": {
        "type": "AzureBlobStorage",
        "typeProperties": {
            "serviceEndpoint": "https://mystorageaccount.blob.core.windows.net",
            "authenticationType": "ManagedIdentity"
        }
    }
}

Parameterized Linked Services

{
    "name": "ParameterizedSqlLS",
    "properties": {
        "type": "AzureSqlDatabase",
        "parameters": {
            "serverName": { "type": "String" },
            "databaseName": { "type": "String" }
        },
        "typeProperties": {
            "connectionString": "Server=tcp:@{linkedService().serverName}.database.windows.net;Database=@{linkedService().databaseName};"
        }
    }
}

Best Practices

  1. Store secrets in Key Vault
  2. Use Managed Identity where possible
  3. Parameterize for multiple environments
  4. Use Self-Hosted IR for on-premises

Linked Services are the foundation of Data Factory connectivity.

Michael John Peña

Michael John Peña

Senior Data Engineer based in Sydney. Writing about data, cloud, and technology.