In order to enable the DAM feature of Sitecore Content Hub, a connector must be enabled to work with XM Cloud. In this article, we will provide an introduction on this procedure.
![](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F3EzsSLfl7swYIlRDPAE7wm%2F734bda6777ebb6b2920ea9e4badc03ae%2Fnick-fewings-HI7l1up-590-unsplash.jpg&w=3840&q=75)
XM Cloud - Enabling the Sitecore Content Hub Connector
XM CloudDigital Asset ManagementOperationsPublished: 2023-07-12
Official document
The procedure is available on the official page.
Enable Connector
When using XM Cloud, the procedure for integrating connectors will be different from the traditional environment because it will be SaaS. Sitecore Content Hub offers DAM and CMP integration as a standard feature, and it is very easy to enable this functionality. In this article, we will introduce the procedure for DAM integration.
The official procedure is as follows
First, select the environment you wish to configure in XM Cloud Deploy and choose Variables from the tab menu item.
![contenthub01.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F5ZONsWV1HiOpFROQugtumd%2F6289d4a475a6bd1f362c2486a34aeb94%2Fcontenthub01.png&w=3840&q=75)
Add the following two items, where Target is all CM
Name | Value |
---|---|
SITECORE_AppSettings_damEnabled__define | Yes |
Sitecore_ConnectionStrings_DAM_dot_ContentHub | ClientId={client_id};ClientSecret = {client_secret};UserName={username};Password={password};URI={uri}; |
Sitecore_ConnectionStrings_DAM_dot_SearchPage | {Sitecore Content Hub search page URI} |
Sitecore_ConnectionStrings_DAM_dot_ExternalRedirectKey | Sitecore |
For information on how to find out the above parameters, please refer to our previous article.
The dialog while working on the addition will proceed as follows. The target is CM only.
![contenthub02.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F3GTy6dr5bO6IotuiJRhafi%2Fa8ac7d665d5182fad978886673c1df7d%2Fcontenthub02.png&w=3840&q=75)
After setting up, the following items are added.
![contenthub03.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F62FniBoyXxXvnqTylmrGtd%2F17b3b9eb3fa955296c88f51216368420%2Fcontenthub03.png&w=3840&q=75)
Preparation is now complete. Select Build & Deploy from the Option menu displayed in the upper right corner of the above screen to deploy the CM server again.
After the Build is completed, the following steps will be taken to confirm the results.
- Access to the management tools
- Launch Content Editor
- Open the Rich Text section of an item in Home
- The fifth button from the left shows the DAM icon
![contenthub04.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2FPgjANWlOURi9QfnZBgsom%2F2d24e66e50f06a954547666b6675f628%2Fcontenthub04.png&w=3840&q=75)
However, it still does not work due to some missing settings.
![contenthub05.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F6OVdq5xpxtJkbNjXRI3oZK%2Fa1b460f6934f19590ccf13b33a55d2d8%2Fcontenthub05.png&w=3840&q=75)
For the project repository, create a Web.config.xdt file under /src/platform/Xdts and add the following code
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<location path="sitecore">
<system.webServer>
<httpProtocol>
<customHeaders>
<add xdt:Transform="SetAttributes" xdt:Locator="Match(name)" name="Content-Security-Policy" value="default-src 'self' 'unsafe-inline' 'unsafe-eval' https://apps.sitecore.net https://*.sitecorecloud.io https://*.stylelabs.io https://*.stylelabs.cloud https://*.stylelabsdemo.com https://*.stylelabsqa.com https://*.stylelabsdev.com https://*.sitecoresandbox.cloud https://*.azureedge.net https://stylelabs.eu.auth0.com https://login.windows.net https://login.microsoftonline.com https://*.boxever.com https://*.xmcloudcm.localhost wss://www.xmcloudcm.localhost https://ipv4.jsonip.com; img-src 'self' data: https://s.gravatar.com https://*.wp.com/cdn.auth0.com/avatars https://*.sitecorecloud.io https://*.stylelabs.io https://*.stylelabs.cloud https://*.stylelabsdemo.com https://*.stylelabsqa.com https://*.stylelabsdev.com https://*.sitecoresandbox.cloud https://*.azureedge.net https://*.xmcloudcm.localhost; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://*.sitecorecloud.io; font-src 'self' 'unsafe-inline' https://fonts.gstatic.com https://*.sitecorecloud.io; frame-ancestors 'self' pages.sitecorecloud.io pages.sitecore.io symphony.sitecorecloud.io explorer.sitecorecloud.io https://pages.sitecorecloud.io https://*.xmcloudcm.localhost https://*.sitecoredemo.com; block-all-mixed-content"/>
</customHeaders>
</httpProtocol>
</system.webServer>
</location>
</configuration>
To include this file in your project, add the following code to the file src¥platform¥Platform.csproj in ItemGroup (only one line needs to be added in Content include).
<ItemGroup>
<Content Include="xdts\Web.config.xdt" />
<None Include="Platform.wpp.targets" />
<None Include="Properties\PublishProfiles\Local.pubxml" />
<None Include="README.md" />
<None Include="web.config" />
</ItemGroup>
Please add the following code to the file xmcloud.build.json to apply this file when building.
"transforms": [
{
"xdtPath": "/xdts/web.config.xdt",
"targetPath": "/web.config"
}
]
Apply the above code, reflect it on GitHub, and run Build & Deploy again. Errors will continue to appear, but this is due to missing settings on the Content Hub side. Please execute the next step.
Sitecore Content Hub Settings
In order to get it to work within the administrator's screen, we need to put the URL of the tool into the CORS configuration: with Content Hub administrator privileges, open the configuration screen under Manage - Settings, then PortalConfiguration - CORSConfiguration PortalConfiguration - CORSConfiguration.
![contenthub06.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F1osWIL9Gt05ozg9mT8oj0G%2F384b03c94e1f6fa987f93d24883e70c1%2Fcontenthub06.png&w=3840&q=75)
We will add the following items so that we can run it in the local environment as well: The first item is the Environment host name as it appears in XM Cloud Deploy , matching the administration screen.
- https://xmc-yourinstance.sitecorecloud.io/
- https://pages.sitecorecloud.io/
- https://xmcloudcm.localhost/
![contenthub07.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F4u8fVseo9mo7LCVmWAGCiF%2Fba5ef62e6aac7d1d11a8a4a472bfced7%2Fcontenthub07.png&w=3840&q=75)
This completes the setup.
Check operation with XM Cloud editing tools
Make sure you have completed the setup and access the XM Cloud environment. First open the rich text editor's edit window to select a media file, then click on the Content Hub icon. After a few moments, click on the dialog and you will see the following to confirm that it is not blocked.
![contenthub08.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F4irffVzEhHQ2Ye4xycebgh%2F4a1e05a07264446fcc8195290f7b1eb3%2Fcontenthub08.png&w=3840&q=75)
You may have a pop-up blocker regarding login. If this is the case, please unblock the pop-up, or move the login click on the screen. Once you have logged in, you will see your DAM assets and be able to use search and other functions.
![contenthub09.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F6uJrChBP16Zd9NbDuKAKWV%2F45fb21470357dcde2210c1e52791b2b5%2Fcontenthub09.png&w=3840&q=75)
We will also check the operation from the Pages tool. Click on the area where the image is used, and you will see a button to change the image in the edit area on the right.
![contenthub10.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2FMjutDU07RpOtLAyzAeq6X%2Fb7a2237ba150239f2ebca5046c0265ec%2Fcontenthub10.png&w=3840&q=75)
Clicking on the Change button brings up the image selection screen. Two tabs, Media Library and Content Hub, are displayed, so clicking on Content Hub allows you to select images as you did in the Content Editor.
![contenthub11.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2FXnk363dvP628t1f8EuiIi%2Fb42d89ee31730f40c7c0e84ff5e51045%2Fcontenthub11.png&w=3840&q=75)
Local Environment Settings
The next step is to make Content Hub DAM accessible to the local environment running on Docker.
The procedure is described in the following pages, but one point is missing and will be included in this blog.
First follow the steps and add the following parameters to .env
SITECORE_AppSettings_damEnabled__define=Yes
Sitecore_DAM_ContentHub=ClientId=ClientId={client_id};ClientSecret = {client_secret};UserName={username};Password={password};URI={uri};
Sitecore_DAM_SearchPage={Sitecore Content Hub search page URI}
Sitecore_DAM_ExternalRedirectKey=Sitecore
Set the parameters according to the server environment, except for the first and fourth lines, which should be the same as the values you set for XM Cloud.
Simply setting this value does not allow either docker-compose.yml or docker-compose.override.yml files to reflect the above value. Therefore, please add the following code to the enviromnent for the cm role in docker-compose.override.yml
SITECORE_AppSettings_damEnabled__define: ${SITECORE_AppSettings_damEnabled__define}
Sitecore_ConnectionStrings_DAM_dot_ContentHub: ${SITECORE_DAM_ContentHub}
Sitecore_ConnectionStrings_DAM_dot_SearchPage: ${SITECORE_DAM_SearchPage}
Sitecore_ConnectionStrings_DAM_dot_ExternalRedirectKey: ${SITECORE_DAM_ExternalRedirectKey}
Now you can pass the values set in the .env file to the container.
Next, the Content-Security-Policy needs to be changed. Copy the same Web.config.xdt file that was created for XM Cloud to docker\build\cm\Xdts\Web.config.xdt.
Then, to reflect this file when building, please add the following code to the docker\build\cm\Dockerfile file.
# Copy Xdts
COPY .\Xdts\ .\Xdts
# Perform transforms
RUN (Get-ChildItem -Path 'C:\\inetpub\\wwwroot\\xdts\\web*.xdt' -Recurse ) | `
ForEach-Object { & 'C:\\tools\\scripts\\Invoke-XdtTransform.ps1' -Path 'C:\\inetpub\\wwwroot\\web.config' -XdtPath $_.FullName `
-XdtDllPath 'C:\\tools\\bin\\Microsoft.Web.XmlTransform.dll'; };
The preparation is now complete. Start the container with the following command
docker compose build
docker compose up -d
If there are no errors, move on to the operation check.
Confirmation of local operation
For the local server, go to https://xmcloudcm.localhost/sitecore. Then, as with XM Cloud, launch the content editor and validate using the rich text field.
The fifth icon from the left to access the Content Hub DAM is shown.
![contenthub12.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F5jAdfpYoPSHMlNMJiCgHxT%2F557fcfbae49564896b5d1a644c3b5406%2Fcontenthub12.png&w=3840&q=75)
Clicking on the button will display the login screen, followed by the screen for the list of DAM assets.
![contenthub13.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F2XESDtPYU5LtswMKJsYh9I%2Fa74c531d9e3c97ae2801dfeee0630025%2Fcontenthub13.png&w=3840&q=75)
We were able to confirm that they are connected safely.
Summary
In this article, we introduced the XM Cloud environment and the procedures for integrating it with Content Hub DAM. As for digital assets, XM Cloud has a media library, but by directly using assets from Content Hub DAM, it is possible to utilize DAM assets on the Web.
Related article
- Enabling Sitecore CMP and DAM in Sitecore XM Cloud
- Walkthrough: Enabling the DAM connector in XM Cloud on Sitecore Cloud Portal
- Walkthrough: Enabling the DAM connector in XM Cloud on Docker
- Sitecore Connect for Content Hub 5.0 Install