Azure SQL

Source and destination

Connecting Polytomic to Azure SQL

Polytomic connects to Azure SQL Database and Azure SQL Managed Instance using SQL authentication (a username and password). Microsoft Entra ID authentication isn't supported. While not required, we recommend you create a user exclusively for Polytomic so that your database's audit logs distinguish all Polytomic activity.

🚧

SQL authentication must be enabled

If your server uses Microsoft Entra-only authentication, Polytomic can't connect. Enable SQL authentication on your server before you continue.

  1. In the Azure portal, navigate to the database or managed instance you want to connect to. On its Overview page, copy the Server name.

  2. Determine the Database you plan to connect to.

  3. Allow Polytomic to reach your server (see Network access below).

  4. Create a user for Polytomic and save its Username and Password for later use. See Setting up permissions below.

  5. In Polytomic, go to Connections → Add connection → Azure SQL.

  6. Enter your Azure SQL credentials in Polytomic's Server, Username, Password, Database, and Port fields.

1788
  1. Leave Use SSL on (Azure SQL requires encrypted connections) and Trust server certificate off. Azure SQL uses certificates from public certificate authorities, which Polytomic verifies against the server name you entered.

  2. Click Save.

📘

Change data capture

The Azure SQL connection type doesn't support change data capture (CDC). To use CDC, connect with the Microsoft SQL Server connection type. See CDC replication.

Network access

Polytomic connects from fixed IP addresses. See Whitelist IPs for the list.

  • Azure SQL Database: in your logical server's Networking settings, make sure public network access is enabled for selected networks, and add a firewall rule for each Polytomic IP address.
  • Azure SQL Managed Instance: enable the instance's public endpoint and allow inbound traffic from Polytomic's IP addresses on port 3342 in the instance's network security group. Use the public endpoint's hostname (<instance>.public.<dns-zone>.database.windows.net) as the Server and 3342 as the Port.

Connecting via SSH

Polytomic supports connecting to Azure SQL via SSH. See Connecting via an SSH tunnel for more information.

Faster bulk writes

For faster bulk writes into your Azure SQL database, turn on the Use Azure blob storage for faster bulk loading option. Polytomic then writes data to an Azure Blob Storage container and loads it into your database with BULK INSERT, instead of inserting rows over the SQL connection.

With this option on, enter these fields on the Azure SQL connection:

  • Storage account name
  • Storage account access key: one of the storage account's access keys. The storage account must allow storage account key access.
  • Storage container name: the container Polytomic stages files in.

For each load, Polytomic uses the access key to generate a short-lived shared access signature (SAS) with read and list permissions on the container. It stores that SAS in a temporary database scoped credential, creates a temporary external data source, runs BULK INSERT, and then drops the credential and data source.

This option has these prerequisites:

  1. A database master key. SQL Server encrypts database scoped credentials with the database master key. If your database doesn't have one, create it:

    CREATE MASTER KEY ENCRYPTION BY PASSWORD = '<strong password>';

    See Microsoft's CREATE MASTER KEY documentation for more details.

  2. Additional permissions. Creating a database scoped credential requires CONTROL on the database. CONTROL also covers creating external data sources and, on Azure SQL Database, ADMINISTER DATABASE BULK OPERATIONS:

    GRANT CONTROL ON DATABASE::[YourDatabase] TO polytomic_user;

    On Azure SQL Managed Instance, BULK INSERT also requires the server-level ADMINISTER BULK OPERATIONS permission on Polytomic's login.

  3. Network access to the storage account. If your storage account restricts network access, it must allow Polytomic's IP addresses (to upload files) and your Azure SQL server (to read them).

Setting up permissions

We recommend creating a dedicated user for Polytomic to ensure proper access control and audit trail visibility.

Creating a contained database user

In Azure SQL Database, create a contained database user (no server-level login required). Run this while connected to your target database, not master:

CREATE USER polytomic_user WITH PASSWORD = '<strong password>';

Permissions for reading data

For using Azure SQL as a data source, grant these minimum permissions:

-- Grant SELECT on each schema to be synced
GRANT SELECT ON SCHEMA::dbo TO polytomic_user;

-- Or grant SELECT on specific tables:
-- GRANT SELECT ON dbo.TableName TO polytomic_user;

-- Allow Polytomic to read table and column metadata
GRANT VIEW DEFINITION TO polytomic_user;

Permissions for writing data

When writing, Polytomic creates schemas and tables, and adds and renames columns. It loads data through staging tables that it creates, renames, and drops, and merges staged rows into your tables. It truncates tables when you request a full resync. ALTER permission on a schema covers altering, renaming, truncating, and dropping the tables in that schema.

-- All read permissions above, plus:

-- Allow Polytomic to create new schemas. Polytomic owns schemas it creates.
GRANT CREATE SCHEMA TO polytomic_user;

-- Allow Polytomic to create tables (also requires ALTER on the target schema)
GRANT CREATE TABLE TO polytomic_user;

-- For each existing schema Polytomic writes to:
GRANT ALTER, SELECT, INSERT, UPDATE, DELETE ON SCHEMA::dbo TO polytomic_user;

If you use faster bulk writes, also grant the permissions listed in that section.

Limiting permissions to specific schemas

If you want to restrict Polytomic to its own schema, create the schema with Polytomic's user as its owner:

-- Create a schema owned by Polytomic
CREATE SCHEMA polytomic_sync AUTHORIZATION polytomic_user;

-- Creating tables also requires this database-level permission
GRANT CREATE TABLE TO polytomic_user;

-- Grant read access to any other schemas Polytomic syncs from
GRANT SELECT ON SCHEMA::dbo TO polytomic_user;