|
| 1 | +--- |
| 2 | +title: Azure Reverse ETL Setup |
| 3 | +--- |
| 4 | + |
| 5 | +> info "Public beta" |
| 6 | +> The Azure source for Reverse ETL is in public beta and is governed by Segment's [First Access and Beta Preview Terms](https://www.twilio.com/en-us/legal/tos){:target="_blank"}. |
| 7 | +
|
| 8 | +Set up Azure as your Reverse ETL source. |
| 9 | + |
| 10 | +At a high level, when you set up Azure dedicated SQL pools for Reverse ETL, the configured user needs read permissions for any resources (databases, schemas, tables) the query needs to access. Segment keeps track of changes to your query results with a managed schema (`__SEGMENT_REVERSE_ETL`), which requires the configured user to allow write permissions for that schema. |
| 11 | + |
| 12 | +## Required permissions |
| 13 | +Make sure the user you use to connect to Segment has permissions to use that warehouse. You can follow the process below to set up a new user with sufficient permissions for Segment’s use. |
| 14 | + |
| 15 | +* To create a login in your master database, run: |
| 16 | + |
| 17 | + ``` |
| 18 | + CREATE LOGIN <login name of your choice> WITH PASSWORD = 'Str0ng_password'; -- password of your choice |
| 19 | + ``` |
| 20 | + |
| 21 | +> info "" |
| 22 | +> Execute the commands below in the database where your data resides. |
| 23 | +
|
| 24 | +* To create a user for Segment, run: |
| 25 | +
|
| 26 | + ``` |
| 27 | + CREATE USER <user name of your choice> FOR LOGIN <login name of your choice>; |
| 28 | + ``` |
| 29 | +
|
| 30 | +* To grant access to the user to read data from all schemas in the database, run: |
| 31 | +
|
| 32 | + ``` |
| 33 | + EXEC sp_addrolemember 'db_datareader', '<user name of your choice>'; |
| 34 | + ``` |
| 35 | +
|
| 36 | +* To grant Segment access to read from certain schemas, run: |
| 37 | +
|
| 38 | + ``` |
| 39 | + CREATE ROLE <role name of your choice>; |
| 40 | + GRANT SELECT ON SCHEMA::[schema_name] TO <role name of your choice>; |
| 41 | + EXEC sp_addrolemember '<role name of your choice>', '<user name of your choice>'; |
| 42 | + ``` |
| 43 | +
|
| 44 | +* To grant Segment access to create a schema to keep track of the running syncs, run: |
| 45 | +
|
| 46 | + ``` |
| 47 | + GRANT CREATE SCHEMA TO <user name of your choice>; |
| 48 | + ``` |
| 49 | +
|
| 50 | +* If you want to create the schema yourself and then give Segment access to it, run: |
| 51 | +
|
| 52 | + ``` |
| 53 | + CREATE SCHEMA __segment_reverse_etl; |
| 54 | + GRANT CONTROL ON SCHEMA::__segment_reverse_etl TO <user name of your choice>; |
| 55 | + GRANT CREATE TABLE ON DATABASE::[database_name] TO <user name of your choice>; |
| 56 | + ``` |
| 57 | +
|
| 58 | +## Set up guide |
| 59 | +To set up Azure as your Reverse ETL source: |
| 60 | +1. Log in to your Azure account. |
| 61 | +2. Navigate to your **dedicated SQL pool**. Segment supports both dedicated SQL pool (formerly SQL DW) and dedicated SQL pool in Synapse workspace. |
| 62 | +3. Navigate to **Settings > Connection strings** and select the **JDBC** tab to find the server, port, and database name. |
| 63 | +4. Open [your Segment workspace](https://app.segment.com/workspaces){:target="_blank"}. |
| 64 | +5. Navigate to **Connections > Sources** and select the **Reverse ETL** tab. |
| 65 | +6. Click **+ Add Reverse ETL source**. |
| 66 | +7. Select **Azure** and click **Add Source**. |
| 67 | +8. Enter the configuration settings for you Azure source based on the information from Step 3. |
| 68 | + * Hostname: |
| 69 | + * Use `xxxxxxx.sql.azuresynapse.net` if you’re connecting to a dedicated SQL pool in Synapse workspace. |
| 70 | + * Use `xxxxxxx.database.windows.net` if you’re connecting to a dedicated SQL pool (formerly SQL DW) |
| 71 | + * Port: `1433` (default) |
| 72 | + * Database name: The name of your dedicated SQL pool. |
| 73 | + * Username: The login name you created with `CREATE LOGIN` in the [required permissions](#required-permissions) section. |
| 74 | + * Password: The password that's associated with the login name. |
| 75 | +9. Click **Test Connection** to see if the connection works. If the connection fails, make sure you have the right permissions and credentials, then try again. |
| 76 | +10. Click **Add source** if the test connection is successful. |
| 77 | +
|
| 78 | +After you've successfully added your Azure source, [add a model](/docs/connections/reverse-etl/#step-2-add-a-model) and follow the rest of the steps in the Reverse ETL setup guide. |
| 79 | +
|
0 commit comments