Load Salesforce data to Azure Blob Storage
Build a Salesforce to Azure Blob Storage pipeline with your coding agent. One prompt scaffolds it with the dltHub AI harness, plus the Salesforce API base URL, auth, endpoints, and incremental loading.
Salesforce REST API is a RESTful interface to access and manipulate Salesforce platform data and metadata. Everything needed to build a working Salesforce → Azure Blob Storage pipeline is on this page: the API's base URL, authentication, endpoints, pagination and incremental field — plus a prompt that hands the whole job to your coding agent.
Build your Salesforce to Azure Blob Storage pipeline
Paste this prompt into Claude, Codex, or Cursor. The agent does the rest.
uvx dlthub-init@latest to build a pipeline from Salesforce to Azure Blob Storage and run it on dltHubThat scaffolds a dltHub workspace and installs the dltHub AI harness — the project rules, the secrets-management skill, and the dlt MCP server your agent needs to work safely. From there it reads the Salesforce API, proposes the endpoints to load, then writes, runs and validates the pipeline while you review rather than type. Credentials are inspected through MCP tools, so your agent never reads secrets.toml itself. How the LLM-native workflow works →
Prefer to write it yourself? Every fact the agent uses is below.
Salesforce API at a glance
| Base URL | https://{instance}.my.salesforce.com/services/data/v{version}/ |
| Example endpoint | GET services/data/vXX.X/query |
| Records found at | records |
| Authentication | all requests require a Bearer token — sent in the Authorization header, prefixed Bearer |
| Pagination | Cursor-based next cursor at nextRecordsUrl, page size via batchSize (via Sforce-Query-Options header). The API uses cursor-based pagination via nextRecordsUrl. The page size can be set using the Sforce-Query-Options header with the batchSize parameter (default 2,000; min 200; max 2,000). Cursor retrieval requests using the nextRecordsUrl do not accept additional parameters. |
| Incremental field | SystemModstamp |
| API reference | https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_curl.htm |
These values come from the Salesforce API reference — the authoritative source if anything here looks out of date.
How do I authenticate with the Salesforce API?
All requests require an OAuth 2.0 Bearer access token included in the Authorization header using the format 'Authorization: Bearer <access_token>'.
1. Get your credentials
Salesforce does not use a traditional static API key. Instead, you must authenticate using OAuth 2.0 via a Connected App. 1. In your Salesforce org, navigate to Setup > App Manager. 2. Click 'New Connected App' and provide basic information. 3. Under 'API (Enable OAuth Settings)', check 'Enable OAuth Settings'. 4. For server-to-server integrations, also check 'Enable Client Credentials Flow' and specify the desired OAuth scopes (e.g., 'api' or 'full'). 5. Save the app and wait a few minutes for it to provision. 6. Once provisioned, click 'Manage Consumer Details' to retrieve your Consumer Key (Client ID) and Consumer Secret (Client Secret). 7. Use these credentials to authenticate against your org's token endpoint (e.g., https://login.salesforce.com/services/oauth2/token) to exchange them for an OAuth access token, which is then used in the 'Authorization: Bearer <access_token>' header for all REST API requests.
2. Add them to .dlt/secrets.toml
[sources.salesforce_source] access_token = "your_oauth_access_token_here" instance_url = "https://yourInstance.my.salesforce.com"
dlt reads this file automatically at runtime. With the harness, the setup-secrets skill prompts you for the values and never handles the raw credential in chat. For production, see setting up credentials with dlt.
What Salesforce data can I load into Azure Blob Storage?
These are the Salesforce endpoints dlt can load into Azure Blob Storage:
| Resource | Endpoint | Method | Data selector | Description |
|---|---|---|---|---|
| describe_global | /services/data/vXX.X/sobjects/ | GET | sobjects | Lists all available sObjects. |
| query | /services/data/vXX.X/query?q={soql} | GET | records | Executes a SOQL query. |
| query_more | /services/data/vXX.X/query/{locator} | GET | records | Retrieves the next batch of query results. |
| get_updated | /services/data/vXX.X/sobjects/{sObject}/updated/?start={start}&end={end} | GET | ids | Retrieves a list of IDs of records updated in a timespan. |
| sobject_rows | /services/data/vXX.X/sobjects/{sObject}/{id} | GET | Retrieves specific record data. |
How do I load only new Salesforce records?
Salesforce exposes SystemModstamp on services/data/vXX.X/query, so dlt can request only the records that changed since the last run. Set it as the cursor_path and dlt tracks the high-water mark for you between runs.
{"name": "query", "endpoint": { "path": "services/data/vXX.X/query", "data_selector": "records", "incremental": {"cursor_path": "SystemModstamp", "initial_value": "2024-01-01T00:00:00Z"}, }}
On the first run dlt loads everything from initial_value; on every run after that it requests only what changed and appends with write_disposition="merge" if you set a primary key. See incremental loading.
What does the generated Salesforce pipeline look like?
A standard dlt REST API pipeline — the same code you would write by hand, loading /sobjects and /query from the Salesforce API into Azure Blob Storage:
import dlt from dlt.sources.rest_api import RESTAPIConfig, rest_api_resources @dlt.source def salesforce_source(access_token=dlt.secrets.value): config: RESTAPIConfig = { "client": { "base_url": "https://{instance}.my.salesforce.com/services/data/v{version}/", "auth": {"type": "bearer", "token": access_token}, }, "resources": [ {"name": "query", "endpoint": {"path": "services/data/vXX.X/query", "data_selector": "records"}}, {"name": "get_updated", "endpoint": {"path": "services/data/vXX.X/sobjects/{sObject}/updated/", "data_selector": "ids"}} ], } yield from rest_api_resources(config) def load_salesforce_to_azure_blob_storage_filesystem() -> None: pipeline = dlt.pipeline( pipeline_name="salesforce_pipeline", destination="filesystem", dataset_name="salesforce_data", ) load_info = pipeline.run(salesforce_source()) print(load_info) if __name__ == "__main__": load_salesforce_to_azure_blob_storage_filesystem()
Run it with uv run python salesforce_pipeline.py. The agent iterates on this until it loads cleanly — you review and approve, rather than write it from scratch.
How do I configure Azure Blob Storage as the destination?
dlt writes to Azure Blob Storage through its filesystem destination; the az:// scheme in bucket_url selects it. Install the extra with uv add "dlt[az]", then add to .dlt/config.toml and .dlt/secrets.toml:
# .dlt/config.toml [destination.filesystem] bucket_url = "az://<container>/<path>" # .dlt/secrets.toml [destination.filesystem.credentials] azure_storage_account_name = "<storage account name>" azure_storage_account_key = "<storage account key>"
dlt writes JSONL by default; pass loader_file_format="parquet" to pipeline.run() for Parquet. Delta and Iceberg table formats are supported too. See the dlt filesystem destination docs.
Changing bucket_url is all it takes to write the same data to Amazon S3, Google Cloud Storage or local files instead; see dlt's filesystem destination for all four.
How do I query Salesforce data in Azure Blob Storage?
After a run, pipeline.dataset() holds the loaded tables, one per resource. A Relation is a query on that dataset, either a whole table or a SQL string, and reading it gives you the data as a Pandas DataFrame, a PyArrow table or Python tuples. Nothing is read until you ask for it. A filesystem destination holds files rather than tables, so dlt reads them through DuckDB views and the interface is the same as for a SQL destination; for frequent reads load Delta or Iceberg tables, which DuckDB reads only as far as the query needs (see reading data from filesystem).
import dlt pipeline = dlt.pipeline("salesforce_pipeline") # Step 1: Get the dataset from the pipeline dataset = pipeline.dataset() # Step 2: Get a Relation, either a whole table... query = dataset.table("query") # ...or any SQL query against Azure Blob Storage sample = dataset("SELECT * FROM query LIMIT 100") # Step 3: Read the data df = query.df() # or .df(chunk_size=50) for a large table arrow_table = sample.arrow() # a PyArrow Table rows = sample.fetchall() # a list of Python tuples # Which tables were loaded, and how big are they? print(dataset.row_counts().df()) """ table_name row_count 0 query 13 1 get_updated 3 """
The columns are the fields the Salesforce API returns. Your agent can run the same queries through the MCP server's execute_sql_query tool, and uv run dlthub show opens the Pipeline Dashboard with the schema, load metrics and a query box. See access loaded data in Python and exploring it in marimo notebooks.
How do I deploy the Salesforce to Azure Blob Storage pipeline in production?
The pipeline runs locally, which is ideal for prototyping and one-off analysis. When you need it on a schedule, monitored on every load, and shared with your team, deploy the same dlt code on the dltHub platform — no infrastructure to maintain. The prompt above already ends with "run it on dltHub", so your agent can take it there directly.
- Deploy & schedule — run the pipeline as a managed job with automatic retries.
- Monitor — observable job queues, alerting, and load metrics for every run.
- Transform — promote raw Salesforce loads into governed, documented models.
- Visualize & share — explore data in notebooks and publish live dashboards instead of static screenshots.
What other destinations can I load Salesforce data to?
dlt loads into any of these — only the destination argument changes:
| Destination | Example value |
|---|---|
| PostgreSQL | "postgres" |
| BigQuery | "bigquery" |
| Snowflake | "snowflake" |
| Redshift | "redshift" |
| Databricks | "databricks" |
| Filesystem (S3, GCS, Azure) | "filesystem" |
Set dlt.pipeline(destination="snowflake") and add credentials in .dlt/secrets.toml. On the dltHub platform the same pipeline runs against a managed Iceberg lakehouse. See the full destinations list.
Next steps
Was this page helpful?
Community Hub
Need more dlt context for Salesforce to Azure Blob Storage?
Request dlt skills, commands, AGENT.md files, and AI-native context.