Enable the DAM connector in an environment deployed to SitecoreAI
To use Sitecore DAM in an environment deployed to SitecoreAI, you must configure and enable the DAM connector.
This walkthrough describes how to:
- Configure and enable the DAM connector
- Configure a DAM connection
- Configure CORS for DAM
Prerequisites
Before you enable the DAM connector in an environment deployed to SitecoreAI, you must have:
- Access to the Deploy app.
- A user in Sitecore Content Hub that has the relevant user rights.
- An OAuth client for the connector.
Configure and enable the DAM connector in the Deploy app
To configure and enable the DAM connector:
-
Log in to the Deploy app.
-
On the navigation pane of the Deploy app, click Projects.
-
On the Projects page, click the project that contains the environment where you want to enable the DAM connector.
-
On the project page, click the environment where you want to enable the DAM connector.
-
On the environment page, click Variables, then click Create variable.
-
Create the following variables. For each variable, set the Target to CM.
Variable Value Description Sitecore_ConnectionStrings_DAM_dot_ContentHub ClientId={client_id};ClientSecret={client_secret};UserName={username};Password={password};URI={uri};Example: ClientId=App;ClientSecret=a51a8fb6-4f57-1234;UserName=john;Password=hunter2;URI=https://example.com/; The Client ID and Client Secret of the connector's OAuth client.The username and password of the user you created in Content Hub.uri of your Content Hub instance. Sitecore_ConnectionStrings_DAM_dot_SearchPage Sitecore Content Hub search page URIExample: https://sitecore-contenthub-dam-uri/en-us/sitecore-dam-connect/approved-assets The URI for the page that opens the DAM in an IFrame. Sitecore_ConnectionStrings_DAM_dot_ExternalRedirectKey Sitecore SITECORE_AppSettings_damEnabled__define yes By default, when you deploy an environment to SitecoreAI, the DAM connector is disabled. To enable the connector, set this value to yes.
Configure a DAM connection
If you don't have a content security policy (CSP), we strongly recommend you create one to guard against cross-site scripting (XSS) and data injection attacks. If you already have a CSP, you need to add the relevant Content Hub instance URLs.
To configure a DAM connection and add your CSP:
-
Clone the source control repository linked to your SitecoreAI environment.
-
In the SitecoreAI repository folder, create the following subfolder:
plaintext -
Open the
Xdtssubfolder, create a file namedWeb.config.xdt, and open it for editing. Add the following code, then add your CSP in thevalueattribute value:xmlEnsure that the
Content-Security-Policytag contains the URL of the Content Hub instance (for example,content-hub-url.stylelabs.com), other delivery hostnames (for example,content-hub-url-delivery.stylelabs.cloud), and generated public links (for example,content-hub-url.stylelabs.com:8686).NoteIn Content Hub, you can configure different delivery hostnames for public links by using the AssetExtensionDataConfigurationSetting setting.
If you have configured different hostnames, you must add all the hostnames as sources to the
Content-Security-Policyparameter, in theimg-src,child-src, andconnect-srcproperties. -
Save the file.
-
To include the
web.configfile transformation in the SitecoreAI build configuration, navigate to the root folder, and open thexmcloud.build.jsonfile for editing. Add the following properties:jsonNoteXM Cloud is now SitecoreAI Some code examples, images, and UI labels may still use XM Cloud while engineering assets are being updated.
-
In the authoring/platform folder, open the
Platform.csprojfile and add the following:xml -
Commit your changes and push them to the remote repository.
-
In the Deploy app, create a build and deploy it to your environment.
Configure CORS for DAM
To enable the Content Hub DAM iframe to successfully display in the Content Editor and the Page builder media item picker, you need to add the Pages and environment host name URLs to Content Hub CORS configuration.
To configure CORS for DAM:
-
On the Sitecore DAM main menu, click Manage, then Settings.
-
On the Settings page, click PortalConfiguration, then click CORSConfiguration.
-
In URL field, enter the URL of the Page builder:
https://pages.sitecorecloud.io/, then click Add. -
In URL field, enter
https://, then the environment host name of your SitecoreAI environment, for example:https://my-xmc-environment-host-name.cloud/, then click Add. You can find your environment host name in your environment details.NoteXM Cloud is now SitecoreAI Some code examples, images, and UI labels may still use XM Cloud while engineering assets are being updated.
You can now display DAM assets in the Content Editor.