Partilhar via


How to Create a Profile Definition with Two Data Sources

Every profile definition must have exactly one unique key property marked as a primary key. You should mark the profile property most frequently used to operate on profile object instances as the primary key.

A red "P" or a green "D" (for a dual primary and join key) that comes before the property as shown in the Profile Schema Editor, or the profile definition of the Profiles resource in Commerce Server Manager identifies a primary key.

The steps in this topic describe a scenario for creating a user profile definition that stores data in both a SQL Server database and an Active Directory directory service database.

Dd452233.alert_caution(en-US,CS.90).gifImportant Note:

This scenario is meant only to describe the process; do not use the actual profile described here. You should design your profile definitions based on your business requirements.

You must have Commerce Server 2009 Active Directory domain controllers installed and configured before you can follow these steps.

Step 1: Create the ProfileService_ADSource Data Source

Follow these steps to create the ProfileService_ADSource data source.

To create the ProfileService_ADSource data source

  1. On the SQL Server/Commerce Server computer, expand Commerce Server Manager, expand Global Resources, expand Profiles, expand Profile Catalog, right-click Data Sources, and then click New Data Source.

  2. In the New Data Source dialog box, do the following:

    Use this

    To do this

    Name

    Type UPM_ADSource_test.

    Display Name

    Type ProfileService_ADSource_test.

    Description

    Type Active Directory data source.

  3. Click Next.

  4. In the Data Source dialog box, in the Source Type drop-down list, select LDAPv3-Compliant Source, and then click Next.

  5. In the Partitions dialog box, make sure that the Partitioned Data Source check box is not selected, and then click Add.

  6. In the Partition dialog box, click Edit.

  7. In the LDAP Connection String dialog box, do the following:

    Use this

    To do this

    Server

    Type the name of the Active Directory domain controller. In this example, the name is MSCS01.

    Port

    Leave blank (unless you are using a value other than 389).

  8. Click OK.

  9. In the Partition dialog box, make sure that the Default Partition check box is not selected.

  10. In the Partition dialog box, do the following:

    Use this

    To do this

    User Name

    Type the Microsoft Windows domain and user name for the Active Directory domain. Use the form domain\username.

    Password

    Type the Windows domain password.

  11. Click Next.

  12. In the System Attributes dialog box, do the following:

    Use this

    To do this

    Parent URL

    Type the location on the Active Directory server where you want your Active Directory data to be stored in relation to the root.

    Domain Name

    Type the domain name of the Active Directory server.

  13. Do not change the default settings for the other options in the dialog box. The one exception is you that might want to select the Use the same credentials for all users option. This option forces the Profiles Schema Manager to use the credentials you entered in step 7 whenever it communicates with the Active Directory server. If you do not select this option, the Profiles Schema Manager uses the credentials of the process in which it is currently running.

  14. Click Next.

  15. In the Custom Attributes dialog box, click Finish.

  16. In the Partitions dialog box, click Finish.

The ProfileService_ADStore partition appears as a new node under Data Sources in Commerce Server Manager.

Step 2: Add the Active Directory User Object

You create a profile data object to map a profile property to the Active Directory user class.

To add the Active Directory user object

  1. Expand Commerce Server Manager, expand Global Resources, expand Profiles, expand Profile Catalog, expand Data Sources, expand the ProfileService_ADSource_Test data source you created in the previous procedure, right-click Data Objects, and then click New Data Object.

  2. In the New Data Object dialog box, do the following:

    Use this

    To do this

    Object Name

    Select user. This is the Active Directory user class.

    Display Name

    Type AD User Object.

  3. Click OK.

The AD User Object data object is added to the ProfileService_ADSource_test data source.

Step 3: Add Data Members to the AD User Object

Create a profile data member to map a profile property attribute to a column in a table in the database that you mapped the data source to. In this example, you will add nine data members to the AD User Object data object that you created in the previous step. These members are for the user name, user password, and common name.

To add data members to the AD User Object

  1. Expand Commerce Server Manager, expand Global Resources, expand Profiles, expand Profile Catalog, expand Data Sources, expand ProfileService_ADSource_test, right-click AD User Object, and then click New Data Member.

  2. In the New Data Member dialog box, do the following:

    Use this

    To do this

    Member Name

    Select cn.

    Display Name

    Type Common Name.

  3. Click Add.

    By default, the cn data member is marked as Required, Indexed, and Primary key.

    The SAMAccountname data member is required for every instance of user class or any other class derived from the user class for the Active Directory data source. The SAMAccountname data member is a string property, and it must be unique.

  4. Repeat this step to add the following data members:

    Member name

    Display name

    Type

    SAMAccountname

    Security Account Manager Account name

    String

    givenName

    First Name

    String

    Initials

    Initial

    String

    sn

    Last Name

    String

    streetAddress

    Street Address

    String

    city

    City

    String

    St

    State/Province

    String

    postalCode

    Postal Code

    String

    co

    Country/Region

    String

  5. Click Finished.

Step 4: Create the Active Directory-SQL User Profile Definition

Use the AD User Object data object to create your custom profile definition. This profile definition will collect user profile information. Most of the properties will be mapped to a SQL Server database. The user name and password will be mapped to Active Directory.

Create this multiple-source profile by selecting the properties you want and mapping them to data members from different data sources.

To create the Active Directory-SQL user profile definition

  1. Expand Commerce Server Manager, expand Global Resources, expand Profiles, expand Profile Catalog, expand Data Sources, expand ProfileService_ADSource_Test, expand Data Objects, right-click AD User Object, point to New, and then click New Profile Definition.

  2. In the New Profile Definition dialog box, do the following:

    Use this

    To do this

    Name

    Type AD_SQL_User.

    Display Name

    Type AD-SQL User.

    Description

    Type User profile definition using AD and SQL sources.

  3. Click Next.

  4. In the Custom Attributes dialog box, click Finish. No custom attributes are created for this example.

The new profile definition appears in the list of available profile definitions in Commerce Server Manager.

Step 5: Add Property Groups to AD-SQL User

To make your profile definition easier to read, you can create separate groups for your Active Directory and SQL Server properties. Before you add the SQL Server properties to your AD-SQL User profile definition, create the data groups.

To add property groups to the AD-SQL User profile definition

  1. Expand Commerce Server Manager, expand Global Resources, expand Profiles, expand Profile Catalog, expand Profile Definitions, and then click AD-SQL User. The Properties list appears in the right pane.

  2. Click Add.

  3. In the Add -- Web Page dialog box, select Add a new group, and then click OK.

  4. In the Attributes section, do the following:

    Use this

    To do this

    Name

    Type ADGroup.

    Display Name

    Type Active Directory.

  5. Click Apply.

  6. In the Properties list, select Active Directory, the group you just created, and then click the Up Arrow at the bottom of the dialog box. Keep clicking it until Active Directory is moved to the top of the Properties list.

  7. Click the directional arrow to the left of Active Directory so that it points down. This expands the node, and prepares the group to accept properties.

  8. Click the first property underneath Active Directory. If you followed the previous steps exactly, this property will be the Common Name property.

  9. Click the Up Arrow at the bottom of the dialog box. The property name appears indented under Active Directory. This puts the property in the Active Directory group.

  10. For each remaining property, select the property name and then click the Up Arrow.

  11. To add the SQL Server group to the property definition, click Add.

  12. In the Attributes section, do the following:

    Use this

    To do this

    Name

    Type SQLGroup.

    Display Name

    Type SQL Server.

  13. Click Apply.

  14. To move the SQL Server group name to the left, click the Down Arrow.

The properties you added are organized in the new property groups.

Step 6: Add SQL Server Properties to AD-SQL User

You have created a profile definition named AD-SQL User that has two property groups: Active Directory and SQL Server. You have already included the Active Directory properties. Next, you have to add the SQL Server properties.

To add SQL Server properties to the AD-SQL User profile definition

  1. Expand Commerce Server Manager, expand Global Resources, expand Profiles, expand Profile Catalog, expand Profile Definitions, and then click AD-SQL User.

  2. In the profile definition screen, in the right pane, in the Properties list, click Common Name. The property attributes appear to the right side.

  3. In the Advanced Attributes section, do the following:

    Use this

    To do this

    Key Type

    Select Dual (Primary and Join). When you use multiple data sources in a profile definition, you have to create a join key that maps to both sources.

    After you save a join key, you cannot change it.

    Map to Data

    Click the ellipsis button [...]. In the Data Source Picker dialog box, expand ProfileService_ADSource_test, and then expand AD User Object. Select ProfileService_ADSource, and then select User Object. Expand ProfileService_ADSource_test, and then select User.

  4. Hold down the CTRL key and select both u_logon_name (located under User Object), and cn (located under AD-SQL User), and then click OK to close the Data Source Picker dialog box.

    Both properties appear in the Map to Data box.

  5. In the Advanced Attributes section, select the RDN box, and then click Apply.

    The join key properties are designated as the relative distinguished name (rdn) for the profile. The rdn must exist to create a valid profile that is mapped to an LDAPv3 source, such as Active Directory. This is not required for OLE DB sources, such as SQL Server.

  6. In the Properties list, click the directional arrow to the left of SQL Server, and then click Add.

  7. In the Add -- Web Page dialog box, select Add a new property, and then click OK.

  8. In the Properties list, select New Property 1.

  9. Add the properties in the following New Properties table to the AD-SQL User profile definition:

    Name

    Display name

    Type

    Map to data

    u_user_security_password

    Password

    String

    Password

    i_account_status

    Account Status

    Number

    Account Status

    u_user_catalog_set

    Catalog Set

    String

    User Catalog Set

    d_data_registered

    Date Registered

    Date/ Time

    Date Created

    i_partner_desk_role

    Partner Service Role

    Number

    Partner Service Role

    d_date_last_changed

    Date Last Changed

    Date/ Time

    Date last changed

  10. In the Attributes section, do the following:

    Use this

    To do this

    Name

    Type the programmatic name for the property from the Name column in the previous table.

    Display Name

    Type the display name for the property from the Display name column in the previous table.

    Type

    Select from the drop-down list the property type for the property from the Type column in the previous table.

  11. In the Advanced Attributes section, click the Map to Data ellipsisbutton [...]. Move to SQL Server User Object, and then select the data member for the property from the Map to data column in the previous table.

  12. To apply the changes that you made to the property, click Apply.

  13. Repeat Steps 7 through 11 until you have added all the properties in the New Propertiestable.

  14. To save the profile definition, click the Save icon on the toolbar.

If you used the AD-SQL User profile definition on your Web site, this definition will store data in both a SQL Server database and an Active Directory database.

See Also

Other Resources

Managing Profile Definitions

How to Use the Profiles Schema Manager

About the Profiles Schema Manager