Welcome to the Alteryx Knowledge Base

How to create and use Service Principal in Azure SQL Database?
user

Created/Edited - 5/25/2026 by Clara Boo | Alteryx

How To

Please follow the steps outlined in this article to use a service principal to connect to Azure SQL Database.

 

Environment
  • Alteryx Designer/Server
    • Version >= 2024.1

 

Prerequisites
  • Microsoft Azure SQL Database
  • ODBC Driver 17 for SQL Server/ODBC Driver 18 for SQL Server

 

Procedure

IMPORTANT: Sections A and B require the administrator for both services to perform the steps. 

 

A. Create an Entra (formerly known as Azure AD) Application

 

  1. Go to Azure Portal.
  2. Go to Microsoft Entra ID > App Registrations.
  3. Create a new application and set the account type accordingly. Redirect URI is not needed here for the service principal.
  4. Note down the application name and the client ID after registering the application.

 

 

  1. Go to Certificates & secrets and create a new client secret,
  2. Note down the secret value immediately once created.

 

 

B. Add the Service Principal to the Database

 

  1. Using SQL Server Management Studio, log in to the Azure SQL Database using the Entra Admin account.
  2. Run the following script to add the service principal to the database and assign the appropriate roles.

 

CREATE USER [<AZURE_APP_NAME>] FROM EXTERNAL PROVIDER;
ALTER ROLE db_datareader ADD MEMBER [<AZURE_APP_NAME>];
ALTER ROLE db_datawriter ADD MEMBER [<AZURE_APP_NAME>];
ALTER ROLE db_ddladmin ADD MEMBER [<AZURE_APP_NAME>];

 

NOTE: Replace "<AZURE_APP_NAME>" with the name of the Entra application created in step 4 of section A. The roles to add to the service principal are just suggestions. If your organisation uses a different set of roles or permissions, please use them instead. Please refer to this site for details of the mentioned roles.

 

Example

Azure app name: Azure SQL

 

CREATE USER [Azure SQL] FROM EXTERNAL PROVIDER;
ALTER ROLE db_datareader ADD MEMBER [Azure SQL];
ALTER ROLE db_datawriter ADD MEMBER [Azure SQL];
ALTER ROLE db_ddladmin ADD MEMBER [Azure SQL];

 

C. Use the Service Principal in Alteryx

  1. In Designer, add an Input Data tool to the workflow canvas.
  2. Configure the tool to use the Data Connection Manager (DCM), if optional.

 

 

  1. In the Data Connections window, click the Data Sources on the left pane.
  2. Click the Quick Connect link under the Microsoft SQL Server section.

 

 

  1. Create a new connection, datasource and credentials.
  2. For the authentication method, please select Azure Active Directory Service Principal.

 

Example from Designer version 2025.2

 

 

NOTE: The connection manager user interface may differ across different versions.

 

  1. Enter the Client ID and Client Secret that were noted down in Section A.

 

 

 

  1. Click the Connect button after creation.

 

 

D. Test the Service Principal in ODBC Data Sources Administrator [OPTIONAL]

  1. In the ODBC Data Sources Administrator (64-bit), add a new data source using the ODBC Driver 17 for SQL Server or ODBC Driver 18 for SQL Server.
  2. Enter a name for the data source and the server to connect to.
  3. At the "How should SQL Server verify the authenticity of the Login ID?" step, select the "With Azure Service Principal authentication" option.
  4. Enter the client ID in the Login ID field and the secret in the Password field.

 

 

 

 

  1. Click the Next button until you see the Finish button and click it.
  2. Click the Test Data Source button to verify if the service principal authentication works.

 

 

You should see the following when the connection is successful.

 

 

NOTE: This ODBC data source is not used in Alteryx Quick Link. These steps are used to verify whether the obtained information regarding the server, client ID and secret works.

 

 

Additional Information
Was this article helpful?