Seamless Media Migration to XM Cloud: A Step-by-Step Guide from Sitecore XP 10.4 and Content Hub Integration - Part 1
We have been working with Sitecore and the media library for a long time. Now if the requirement comes from the client to use Sitecore Content Hub instead of Sitecore media library, and they are also planning to move from Sitecore XP to XMCloud, then the following questions will pop up
- How to connect Sitecore Content Hub
- How to make sure all the Images in the Sitecore Media library are added to the Sitecore content hub
- How can we add the Sitecont Content Hub assets public link to all the Images from the Media library referenced
- How to migrate all content from Sitecore XP to XM Cloud
Let's explore the migration step by step as follows
- Connect Sitecore XP with Sitecore Content Hub
- Migrate all the Sitecore XP Media Items to Sitecore Content Hub
- Configure public link creation for all the assets migrated from the Sitecore media library
- Replace all the media item references with the public link of the assets
- Sitecore Content Hub integration with XM Cloud
- Migration of content from Sitecore XP to Sitecore XM Cloud
Connecting Sitecore XP with Sitecore Content Hub.
Steps:
- Download Sitecore Connect™ for Content Hub SIF Package
- Download Sitecore Connect™ for Content Hub WDP Package
- Unzip the Sitecore Connect™ for Content Hub SIF Package and add the Sitecore Connect™ for Content Hub WDP Package.zip to this folder.
- Open Windows PowerShell in administrator mode and run the following file deploy.ps1 available in the folder Sitecore Connect™ for Content Hub
- Open the deploy.ps1 and update the following settings before executing this deploy.ps1
- ScchWdpPackage - "$($PSScriptRoot)\Sitecore.Connector.ContentHub.WDP.5.2.96-r00458.5768.scwdp.zip"
- InstanceName - your Sitecore XP 10.4 instance
- InstanceUrl - your Sitecore XP 10.4 website URL
- SitecoreAdminUser - Admin user
- SitecoreAdminPass - Admin password
- SqlInstanceName - SQL instance from connectionstring.config, usually the prefix of the database created before _core
Example: if the core database name is sclocal104_core, then the SqlInstanceName will be "sclocal104" - SqlUser - SQL user name from connectionstring.config
- SqlPass - SQL password from connectionstring.config
- SqlServerName - SQL server name from connectionstring.config
- SkipDatabaseInstallation - $true
- Go to the extracted SIF folder location and execute the deploy.ps1
- After the above script is successfully executed, content from the WDP package will be deployed to the Sitecore CMS along with some newly added settings to the connectionString.config file. Here, we will target only the DAM module, so the CMP module-related settings in the ConnectionStrings.config file will be commented out.
- DAM.ExternalRedirectKey value should be Sitecore
- Open Sitecore Content Hub and get the following information for replacing the ConnectionString.config settings variable shown above.
- ClientId
- ClientSecret
- UserName
- Password
- To get the ClientId and ClientSecret from Content Hub, go to Manage -- OAuth clients
Find LogicApp and click the Quick edit icon to get its ClientId and ClientSecret - We need to create a new user for this purpose instead of using the superuser, which would be provided for accessing the whole Content Hub feature.
- To create a User, go to Manage--User and provide the username, and click Save
- After the user is created, click on Edit Profile and provide the email address, which will be used to reset the password.
- Click on Reset password to update the password that will be used in our connectionstring.config file.
- Go to User Group and find the M.Builtin.SitecoreDAM.Everyone, click on the Policies icon and from the Rules tab, click on the New Rule button, select M.Asset, with Read and ReadPublicLinks access
Before Assigning the M.Builtin.SitecoreDAM.Everyone
- Now we have all the information ready, let's update the values in the Connectstring.config.
- Go to the web.config file and add Content-Security-Policy settings for making the DAM module and Sitecore communicate without any issue.
Here, replace https://playground.sitecoresandbox.cloud with the Content Hub URL
<add name="Content-Security-Policy" value="default-src 'self' 'unsafe-inline' 'unsafe-eval' https://apps.sitecore.net;
img-src 'self' data: https://playground.sitecoresandbox.cloud/;
style-src 'self' 'unsafe-inline' https://fonts.googleapis.com;
font-src 'self' 'unsafe-inline' https://fonts.gstatic.com;
upgrade-insecure-requests; block-all-mixed-content;
child-src 'self' https://playground.sitecoresandbox.cloud/;
connect-src 'self' https://playground.sitecoresandbox.cloud/;
media-src https://playground.sitecoresandbox.cloud/;" />
- Add the CORS in Sitecore Content Hub to have the local Sitecore CMS URL.
- Restart the Sitecore CMS, and let's see the DAM module installed in CMS, and changes to Rich Text Editor, General Link, and Image controls.
DAM module: - Mapping from Content hub to Sitecore defined field will be done like below.
- Transformation can be done by adding the transformation item in the DAM module and enabling it by the image control.
RichText Editor:
In RTE, a new icon has been added that will help to add the DAM-approved assets in the RTE. This will be the public link to the DAM assets from different renditions. The User can select any rendition and add the image to RTE.
Image:
The user can able to add DAM assets using the different transformations on the selected asset.
General Link:
Part 3
Let's learn and grow together, happy programming 😊
Comments
Post a Comment