> AI agents: this is one page from PostHog's docs. Full index of Markdown docs for LLMs: https://posthog.com/llms.txt # Linking Azure SQL Server as a source Canonical URL: https://posthog.com/docs/data-pipelines/sources/microsoft-sql-server > **Cloud region:** This page uses US Cloud hosts. For an EU Cloud project, use `https://eu.posthog.com` instead of `https://app.posthog.com` (app host for links). ## On this page - [Configuration](#configuration) - [Selecting columns](#selecting-columns) - [Troubleshooting](#troubleshooting) ![](https://res.cloudinary.com/dmukukwp6/image/upload/texture_tan_9608fcca70) ![](https://res.cloudinary.com/dmukukwp6/image/upload/texture_tan_dark_a92b0e022d) Let AI connect your sources for you Skip the manual setup — run this in your project and the wizard auto-detects your databases and APIs and connects them to PostHog. `npx @posthog/wizard warehouse` ![PostHog Wizard hedgehog](https://res.cloudinary.com/dmukukwp6/image/upload/wizard_3f8bb7a240.png) ![](https://res.cloudinary.com/dmukukwp6/image/upload/wizard_3f8bb7a240.png)Let AI connect your sources for you The Azure SQL Server connector can link your database tables to PostHog. > This applies to any MS SQL Server, not just Azure hosted databases. We use Microsoft ODBC 18 to connect to your SQL server. For Azure databases, we only use SQL authentication (and not Entra ID). You can find your connection details by [following the steps listed here](https://learn.microsoft.com/en-us/azure/azure-sql/database/connect-query-content-reference-guide?view=azuresql#get-adonet-connection-information-optional---sql-database-only). The Azure database also needs to be publicly accessible (or use a SSH tunnel). You can follow [step 1 of this Microsoft guide](https://learn.microsoft.com/en-us/azure/azure-sql/database/azure-sql-python-quickstart?view=azuresql&tabs=windows%2Csql-auth#configure-the-database) to enable public access and allow our inbound IP addresses found at the bottom of this page. To link Azure SQL Server: 1. Go to the [Data pipeline page](https://app.posthog.com/data-management/sources) and the sources tab in PostHog 2. Click **New source** and select Azure SQL Server 3. Enter your database connection details: - **Host:** The hostname or IP your database server like `db.example.com` or `123.132.1.100`. - **Port:** The port your database server is listening to. The default is `1433`. - **Database:** The name of the database you want like `analytics_db`. - **User:** The username with the necessary permissions to access the database. - **Password:** The password for the user. - **Schema:** (Optional) The schema for your database. Leave blank to browse and sync tables from all schemas, or specify one to limit the selection. The default is `dbo`. 4. Click **Link** The data warehouse then starts syncing your Azure SQL Server data. You can see details and progress in the [sources tab](https://app.posthog.com/data-management/sources). ## Configuration | Option | Description | | --- | --- | | `Connection string (optional)` **Type:** text **Required:** False | | | `Host` **Type:** text **Required:** True | Must be reachable from the public internet. Add PostHog's egress IP addresses to your firewall allowlist (see the docs above) and use a public host. `localhost` and private IPs (10.x, 172.16-31.x, 192.168.x) can't be reached. For a database that can't be exposed publicly, enable the SSH tunnel below. | | `Port` **Type:** number **Required:** True | | | `Database` **Type:** text **Required:** True | | | `User` **Type:** text **Required:** True | | | `Password` **Type:** password **Required:** True | | | `Schema` **Type:** text **Required:** False | | | `Use SSH tunnel?` **Type:** ssh-tunnel **Required:** False | | ## Selecting columns By default, PostHog syncs all columns from each table. To sync only specific columns: 1. During source setup, click **Columns** next to any table in the table picker. 2. Uncheck columns you don't want to sync. 3. Primary key columns and the incremental sync field (if configured) are always synced and cannot be disabled. You can also change column selection after setup: 1. Go to the [sources tab](https://app.posthog.com/data-management/sources) and click your Azure SQL Server source. 2. Click **Configure** next to any schema. 3. Under **Columns**, select which columns to sync. **Adding columns to existing syncs** When you add columns to a schema using incremental or append sync, PostHog prompts you to choose: - **Sync forward only** - New columns are populated only for future data. Existing rows show `NULL` for the new columns. - **Full resync** - Triggers a complete resync to backfill the new columns for all rows. **Decimal precision limits** Numeric, decimal, and money columns with values exceeding a precision of 76 or scale of 32 can't be synced. If a sync fails with this error, you have three options: - Constrain the column with a lower precision/scale - Cast it to text in a view - Round the values at the source **Invalid object name errors** If your sync fails with "Invalid object name," the database couldn't find a table or view you're syncing. Common causes include dropped or renamed objects, views referencing missing tables, or cross-database permission issues. Check that all synced objects exist and that the connection user has SELECT permissions on them and their dependencies. ## Troubleshooting ### Firewall blocking PostHog This error occurs when your SQL Server's firewall blocks connections from PostHog's IP addresses. Azure SQL error 40615 shows a message containing "is not allowed to access the server." To fix this: 1. Add PostHog's IP addresses to your server's firewall rules. On Azure SQL, do this through the Azure portal under **Networking** > **Firewall rules**, or by running `sp_set_firewall_rule`. 2. Wait a few minutes for the new rules to take effect. 3. Re-enable the sync in PostHog. See the [Inbound IP addresses](#inbound-ip-addresses) section below for the IP addresses to allowlist. #### Inbound IP addresses We use a set of IP addresses to access your instance. To ensure this connector works, add these IPs to your inbound security rules: | US | EU | | --- | --- | | 44.205.89.55 | 3.75.65.221 | | 52.4.194.122 | 18.197.246.42 | | 44.208.188.173 | 3.120.223.253 |