Generic SQL Connector step-by step (2024)

  • Article

This topic is a step-by-step guide. It creates a simple sample HR database and use it for importing some users and their group membership.

Note

Microsoft Entra ID now provides a lightweight agent based solution for provisioning users into a SQL database, without needing a MIM sync deployment. We recommend using it for outbound user provisioning. Learn more.

Prepare the sample database

On a server running SQL Server, run the SQL script found in Appendix A. This script creates a sample database with the name GSQLDEMO. The object model for the created database looks like this picture:
Generic SQL Connector step-by step (1)

Also create a user you want to use to connect to the database. In this walkthrough, the user is called FABRIKAM\SQLUser and located in the domain.

Create the ODBC connection file

The Generic SQL Connector is using ODBC to connect to the remote server. First we need to create a file with the ODBC connection information.

  1. Start the ODBC management utility on your server:
    Generic SQL Connector step-by step (2)
  2. Select the tab File DSN. Click Add....
    Generic SQL Connector step-by step (3)
  3. The out-of-box driver works fine, so select it and click Next>.
    Generic SQL Connector step-by step (4)
  4. Give the file a name, such as GenericSQL.
    Generic SQL Connector step-by step (5)
  5. Click Finish.
    Generic SQL Connector step-by step (6)
  6. Time to configure the connection. Give the data source a good description and provide the name of the server running SQL Server.
    Generic SQL Connector step-by step (7)
  7. Select how to authenticate with SQL. In this case, we use Windows Authentication.
    Generic SQL Connector step-by step (8)
  8. Provide the name of the sample database, GSQLDEMO.
    Generic SQL Connector step-by step (9)
  9. Keep everything default on this screen. Click Finish.
    Generic SQL Connector step-by step (10)
  10. To verify everything is working as expected, click Test Data Source.
    Generic SQL Connector step-by step (11)
  11. Make sure the test is successful.
    Generic SQL Connector step-by step (12)
  12. The ODBC configuration file should now be visible in File DSN.
    Generic SQL Connector step-by step (13)

We now have the file we need and can start creating the Connector.

Create the Generic SQL Connector

  1. In the Synchronization Service Manager UI, select Connectors and Create. Select Generic SQL (Microsoft) and give it a descriptive name.
    Generic SQL Connector step-by step (14)
  2. Find the DSN file you created in the previous section and upload it to the server. Provide the credentials to connect to the database.
    Generic SQL Connector step-by step (15)
  3. In this walkthrough, we are making it easy for us and say that there are two object types, User and Group.Generic SQL Connector step-by step (16)
  4. To find the attributes, we want the Connector to detect those attributes by looking at the table itself. Since Users is a reserved word in SQL, we need to provide it in square brackets [ ].
    Generic SQL Connector step-by step (17)
  5. Time to define the anchor attribute and the DN attribute. For Users, we use the combination of the two attributes username and EmployeeID. For group, we use GroupName (not realistic in real-life, but for this walkthrough it works).Generic SQL Connector step-by step (18)
  6. Not all attribute types can be detected in a SQL database. The reference attribute type in particular cannot. For the group object type, we need to change the OwnerID and MemberID to reference.
    Generic SQL Connector step-by step (19)
  7. The attributes we selected as reference attributes in the previous step require the object type these values are a reference to. In our case, the User object type.
    Generic SQL Connector step-by step (20)
  8. On the Global Parameters page, select Watermark as the delta strategy. Also type in the date/time format yyyy-MM-dd HH:mm:ss.Generic SQL Connector step-by step (21)
  9. On the Configure Partitions and Hierarchies page, select both object types.Generic SQL Connector step-by step (22)
  10. On the Select Object Types and Select Attributes, select both object types and all attributes. On the Configure Anchors page, click Finish.

Create Run Profiles

  1. In the Synchronization Service Manager UI, select Connectors, and Configure Run Profiles. Click New Profile. We start with Full Import.
    Generic SQL Connector step-by step (23)
  2. Select the type Full Import (Stage Only).
    Generic SQL Connector step-by step (24)
  3. Select the partition OBJECT=User.
    Generic SQL Connector step-by step (25)
  4. Select Table and type [USERS]. Scroll down to the multi-valued object type section and enter the data as in the following picture. Select Finish to save the step.
    Generic SQL Connector step-by step (26)
    Generic SQL Connector step-by step (27)
  5. Select New Step. This time, select OBJECT=Group. On the last page, use the configuration as in the following picture. Click Finish.
    Generic SQL Connector step-by step (28)
    Generic SQL Connector step-by step (29)
  6. Optional: If you want to, you can configure additional run profiles. For this walkthrough, only the Full Import is used.
  7. Click OK to finish changing run profiles.

Add some test data and test the import

Fill out some test data in your sample database. When you are ready, select Run and Full import.

Here is a user with two phone numbers and a group with some members.
Generic SQL Connector step-by step (30)
Generic SQL Connector step-by step (31)

Appendix A

SQL script to create the sample database

---Creating the Database---------Create Database GSQLDEMOGo-------Using the Database-----------Use [GSQLDEMO]Go-------------------------------------USE [GSQLDEMO]GO/****** Object: Table [dbo].[GroupMembers] ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE TABLE [dbo].[GroupMembers]( [MemberID] [int] NOT NULL, [Group_ID] [int] NOT NULL) ON [PRIMARY]GO/****** Object: Table [dbo].[GROUPS] ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE TABLE [dbo].[GROUPS]( [GroupID] [int] NOT NULL, [GROUPNAME] [nvarchar](200) NOT NULL, [DESCRIPTION] [nvarchar](200) NULL, [WATERMARK] [datetime] NULL, [OwnerID] [int] NULL,PRIMARY KEY CLUSTERED( [GroupID] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY]GO/****** Object: Table [dbo].[USERPHONE] ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOSET ANSI_PADDING ONGOCREATE TABLE [dbo].[USERPHONE]( [USER_ID] [int] NULL, [Phone] [varchar](20) NULL) ON [PRIMARY]GOSET ANSI_PADDING OFFGO/****** Object: Table [dbo].[USERS] ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE TABLE [dbo].[USERS]( [USERID] [int] NOT NULL, [USERNAME] [nvarchar](200) NOT NULL, [FirstName] [nvarchar](100) NULL, [LastName] [nvarchar](100) NULL, [DisplayName] [nvarchar](100) NULL, [ACCOUNTDISABLED] [bit] NULL, [EMPLOYEEID] [int] NOT NULL, [WATERMARK] [datetime] NULL,PRIMARY KEY CLUSTERED( [USERID] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY]GOALTER TABLE [dbo].[GroupMembers] WITH CHECK ADD CONSTRAINT [FK_GroupMembers_GROUPS] FOREIGN KEY([Group_ID])REFERENCES [dbo].[GROUPS] ([GroupID])GOALTER TABLE [dbo].[GroupMembers] CHECK CONSTRAINT [FK_GroupMembers_GROUPS]GOALTER TABLE [dbo].[GroupMembers] WITH CHECK ADD CONSTRAINT [FK_GroupMembers_USERS] FOREIGN KEY([MemberID])REFERENCES [dbo].[USERS] ([USERID])GOALTER TABLE [dbo].[GroupMembers] CHECK CONSTRAINT [FK_GroupMembers_USERS]GOALTER TABLE [dbo].[GROUPS] WITH CHECK ADD CONSTRAINT [FK_GROUPS_USERS] FOREIGN KEY([OwnerID])REFERENCES [dbo].[USERS] ([USERID])GOALTER TABLE [dbo].[GROUPS] CHECK CONSTRAINT [FK_GROUPS_USERS]GOALTER TABLE [dbo].[USERPHONE] WITH CHECK ADD CONSTRAINT [FK_USERPHONE_USER] FOREIGN KEY([USER_ID])REFERENCES [dbo].[USERS] ([USERID])GOALTER TABLE [dbo].[USERPHONE] CHECK CONSTRAINT [FK_USERPHONE_USER]GO
Generic SQL Connector step-by step (2024)
Top Articles
How I'm Creating a Life I Don't Need to Retire From - Mum's Money | The Word On Spending Less and Making More
7 Frugal Living Tips For Single Income Families
Fan Van Ari Alectra
Kreme Delite Menu
Form V/Legends
Mackenzie Rosman Leaked
Boomerang Media Group: Quality Media Solutions
Google Jobs Denver
10 Popular Hair Growth Products Made With Dermatologist-Approved Ingredients to Shop at Amazon
Weapons Storehouse Nyt Crossword
Infinite Campus Parent Portal Hall County
Daniela Antury Telegram
Craigslist/Phx
Capitulo 2B Answers Page 40
Facebook Marketplace Charlottesville
Where does insurance expense go in accounting?
Luna Lola: The Moon Wolf book by Park Kara
Cpt 90677 Reimbursem*nt 2023
Razor Edge Gotti Pitbull Price
Rams vs. Lions highlights: Detroit defeats Los Angeles 26-20 in overtime thriller
Cta Bus Tracker 77
Panic! At The Disco - Spotify Top Songs
Robin D Bullock Family Photos
Project, Time & Expense Tracking Software for Business
Rufus Benton "Bent" Moulds Jr. Obituary 2024 - Webb & Stephens Funeral Homes
How to Grow and Care for Four O'Clock Plants
Ice Dodo Unblocked 76
Gina Wilson Angle Addition Postulate
Mandy Rose - WWE News, Rumors, & Updates
Powerschool Mcvsd
Klsports Complex Belmont Photos
Churchill Downs Racing Entries
10 Best Places to Go and Things to Know for a Trip to the Hickory M...
Nearest Ups Ground Drop Off
Orange Park Dog Racing Results
Issue Monday, September 23, 2024
Aid Office On 59Th Ashland
Smayperu
Bratislava | Location, Map, History, Culture, & Facts
Devotion Showtimes Near Mjr Universal Grand Cinema 16
Go Upstate Mugshots Gaffney Sc
Chatropolis Call Me
10 Rarest and Most Valuable Milk Glass Pieces: Value Guide
Luvsquad-Links
No Boundaries Pants For Men
Pulaski County Ky Mugshots Busted Newspaper
Expendables 4 Showtimes Near Malco Tupelo Commons Cinema Grill
Arcanis Secret Santa
Mauston O'reilly's
All Buttons In Blox Fruits
Craigslist Yard Sales In Murrells Inlet
Latest Posts
Article information

Author: Lidia Grady

Last Updated:

Views: 6271

Rating: 4.4 / 5 (65 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Lidia Grady

Birthday: 1992-01-22

Address: Suite 493 356 Dale Fall, New Wanda, RI 52485

Phone: +29914464387516

Job: Customer Engineer

Hobby: Cryptography, Writing, Dowsing, Stand-up comedy, Calligraphy, Web surfing, Ghost hunting

Introduction: My name is Lidia Grady, I am a thankful, fine, glamorous, lucky, lively, pleasant, shiny person who loves writing and wants to share my knowledge and understanding with you.