Set up a Commerce Server site

When you set up a Commerce Server site, you perform the following tasks:

The commands in the following tasks require PowerShell 4.0 or later.

Initialize the Commerce Server site and web services

To initialize the Commerce Server site:

  1. Open a PowerShell window.
  2. Set the PowerShell script execution policy to unrestricted:

    Set-ExecutionPolicy Unrestricted and select Y.

  3. Navigate to your Sitecore website directory. For example:

    C:\> cd C:\inetpub\CFRefStorefront\Website

  4. Run the Initialize-CSSite command:

    C:\inetpub\CFRefStorefront\Website> Initialize-CSSite

  5. Create the Commerce Server Web Services. Make sure the app pool identity for each Web Service is set to '.\CSFndRuntimeUser'.
    1. Run the following command to create the Commerce Server Catalog Web Service:

      New-CSWebService -Name "CFSolutionStorefrontsite" -Resource Catalog -IISSite "CSServices" -AppPool "CSServices" -Identity 'CSFndRuntimeUser' -Password 'YourPassword'

    2. Run the following command to create the Commerce Server Profiles Web Service:

      New-CSWebService -Name "CFSolutionStorefrontsite" -Resource Profiles -IISSite "CSServices" -AppPool "CSServices" -Identity 'CSFndRuntimeUser' -Password 'YourPassword'

  6. Configure role-based permissions for each Web Service identity (via the Windows Authorization Store):
    1. Configure administrator permissions for the Catalog Web Service identity:

      Grant-CSCatalogWebServicePermissions –File "C:\inetpub\csservices\CFSolutionStorefrontsite_CatalogWebService\CatalogAuthorizationStore.xml" -Identity "CSFndRuntimeUser" -Role "Administrator"

    2. Configure administrator permissions for the Profile Web Service identity:

      Grant-CSProfilesWebServicePermissions –File "C:\inetpub\csservices\CFSolutionStorefrontsite_ProfilesWebService\ProfilesAuthorizationStore.xml" -Identity "CSFndRuntimeUser" -Role "ProfileAdministrator"

  7. Set the inventory subsystem to display out of stock SKUs by running the following command:

    Set-CSSiteResourceProperty -Name "CFSolutionStorefrontSite" –Resource "Inventory" -PropertyName "f_display_oos_skus" -PropertyValue $true

Update the Commerce Server Profile Schema

You must generate encryption keys for the CFSolutionStorefrontSite and add them to the Windows registry.To generate encryption keys for the Commerce Server Profile system and update the Profile schema:
  1. Open a new command prompt window.
  2. Create encryption keys for the CFSolutionStorefrontSite.
    1. Run the ProfileKeyManager.exe to generate encryption keys:

      ProfileKeyManager.exe /kn /o "c:\profileEncryptionKeys.xml" /f

      Note: By default, the ProfileKeyManager.exe file is installed under C:\Program Files (x86)\Commerce Server 11\Tools.
    2. Add the encryption keys to the Windows registry:

      ProfileKeyManager.exe /ke /kf "c:\profileEncryptionKeys.xml" /reg HKEY_LOCAL_MACHINE\SOFTWARE\CommerceServer\Encryption\Keys\CFSolutionStorefrontSite /f

      Note: You can confirm that the correct registry path is configured in the Website\App_Config\CommerceServer.Core.config file, under the Sitecore folder.
  3. Update the Commerce Server Profile schema by deploying the Commerce Storefront Profile Database DAC package, using the following command:

    "C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin\SqlPackage.exe" /Action:Publish /SourceFile:".\Database\Profiles\Commerce.Storefront.ProfileDatabase.dacpac" /TargetDatabaseName:CFSolutionStorefrontSite_profiles /TargetServerName:"127.0.0.1"

    Note: You must delete any existing data inside the Commerce Server Profile databases before deploying the DAC package. Otherwise, the command fails.
    Note: Adjust the path to the sqlpackage.exe tool (and the target server) if different from the path shown above.
  4. If you received an error message while installing the Sitecore.Reference.Storefront.Powered.by.SitecoreCommerce.10.0.xxx.update package, reinstall the package.