<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sathiyamoorthi Subramanian on Medium]]></title>
        <description><![CDATA[Stories by Sathiyamoorthi Subramanian on Medium]]></description>
        <link>https://medium.com/@sathyamail95?source=rss-ab3f136062b7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*CmD_7WJNkFNpsuAdplwM2Q.jpeg</url>
            <title>Stories by Sathiyamoorthi Subramanian on Medium</title>
            <link>https://medium.com/@sathyamail95?source=rss-ab3f136062b7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 11:24:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sathyamail95/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to Update Rendering Data Source with Azure Functions + GraphQL in XM Cloud]]></title>
            <link>https://medium.com/@sathyamail95/how-to-update-rendering-data-source-with-azure-functions-graphql-in-xm-cloud-d7175c610ddc?source=rss-ab3f136062b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/d7175c610ddc</guid>
            <dc:creator><![CDATA[Sathiyamoorthi Subramanian]]></dc:creator>
            <pubDate>Thu, 31 Jul 2025 12:10:01 GMT</pubDate>
            <atom:updated>2025-07-31T12:20:49.476Z</atom:updated>
            <content:encoded><![CDATA[<p>In headless XM Cloud solutions, content is typically managed through GraphQL APIs. But when it comes to programmatically manipulating rendering configurations, like changing the Datasource For a rendering, you hit some limitations</p><p>This article walks through how you can <strong>update your rendering data sources dynamically</strong> using <strong>Azure Function + GraphQL</strong>:</p><ol><li><strong>Create an Azure Function to Fetch Rendering Data and Mutations</strong></li></ol><p>The Sitecore Edge and Preview APIs do not provide access to standard fields such as __Renderings. Therefore, we need to use the GraphQL Authoring API to retrieve the __Renderings value.</p><p>Please use the query below along with the appropriate method to generate an access token for the GraphQL Authoring API.</p><pre>public ItemBaseModel GetItemRenderings(string ItemId, string language)<br>{<br>    ItemBaseModel? resultItems = null;<br>    var query = @&quot;query GetItemRenderings($ItemId: String!, $language: String!) {<br>                  item(where: { path: $ItemId, language: $language }) {<br>                    itemId<br>                    name<br>                    path<br>                    Renderings: field(name: &quot;&quot;__Renderings&quot;&quot;) {<br>                      value<br>                    }<br>                  }<br>                }&quot;;<br><br>    var variables = new { ItemId, language };<br>    var response = ExecuteGraphQLAuthoringQuery(query, variables).Result;<br><br>    var data = JsonConvert.DeserializeObject&lt;ItemBaseResponse&gt;(response);<br>    if (data != null &amp;&amp; data.Data != null &amp;&amp; data.Data.Item != null)<br>    {<br>        resultItems = data.Data.Item;<br>    }<br>    return resultItems;<br>}<br><br>public async Task&lt;string&gt; ExecuteGraphQLAuthoringQuery(string query, object variables)<br>{<br>    string _sitecoreAccessToken = await GetAccessTokenAsync();<br>    var request = new { query, variables };<br>    var json = JsonConvert.SerializeObject(request);<br>    var content = new StringContent(json, Encoding.UTF8, &quot;application/json&quot;);<br><br>    _httpClient.DefaultRequestHeaders.Clear();<br>    _httpClient.DefaultRequestHeaders.Add(&quot;Authorization&quot;, $&quot;Bearer {_sitecoreAccessToken}&quot;);<br><br>    var response = await _httpClient.PostAsync(_sitecoreAuthoringAPI, content);<br>    response.EnsureSuccessStatusCode();<br><br>    return await response.Content.ReadAsStringAsync();<br>}<br><br>public async Task&lt;string&gt; GetAccessTokenAsync()<br>{<br>    try<br>    {<br>        if (!string.IsNullOrEmpty(_cachedToken) &amp;&amp; DateTime.UtcNow &lt; _expiresAt.AddMinutes(-5))<br>        {<br>            return _cachedToken;<br>        }<br>//Replace the value with your sitecore access details:  Sitecore_ClientId, Sitecore_ClientSecret, Sitecore_Graphql_TokenEndpoint<br>        var clientId = &quot;Sitecore_ClientId&quot;;<br>        var clientSecret = &quot;Sitecore_ClientSecret&quot;;<br>        var tokenEndpoint = &quot;Sitecore_Graphql_TokenEndpoint&quot;;<br>        var audience = &quot;https://api.sitecorecloud.io&quot;;<br><br>        if (clientId == null || clientSecret == null || audience == null)<br>        {<br>            throw new Exception(&quot;Failed to retrieve clientId, clientSecret, audience from appsettings&quot;);<br>        }<br>        var content = new FormUrlEncodedContent(new[]<br>        {<br>            new KeyValuePair&lt;string, string&gt;(&quot;grant_type&quot;, &quot;client_credentials&quot;),<br>            new KeyValuePair&lt;string, string&gt;(&quot;client_id&quot;, clientId),<br>            new KeyValuePair&lt;string, string&gt;(&quot;client_secret&quot;, clientSecret),<br>            new KeyValuePair&lt;string, string&gt;(&quot;audience&quot;, audience)<br>        });<br><br>        _httpClient.DefaultRequestHeaders.Clear();<br>        var response = await _httpClient.PostAsync(tokenEndpoint, content);<br>        if (!response.IsSuccessStatusCode)<br>        {<br>            throw new Exception(&quot;Failed to retrieve Sitecore authoring access token&quot;);<br>        }<br><br>        var responseString = await response.Content.ReadAsStringAsync();<br>        using var doc = JsonDocument.Parse(responseString);<br>        _cachedToken = doc.RootElement.GetProperty(&quot;access_token&quot;).GetString() ?? throw new Exception(&quot;Access token is null&quot;);<br>        var expiresIn = doc.RootElement.GetProperty(&quot;expires_in&quot;).GetInt32(); // in seconds<br>        _expiresAt = DateTime.UtcNow.AddSeconds(expiresIn);<br>        return _cachedToken;<br>    }<br>    catch (Exception ex)<br>    {<br>        throw new Exception(&quot;Error retrieving Sitecore access token&quot;, ex);<br>    }<br>}</pre><p>It will return the raw value of the <strong>__Renderings </strong>Standard field in XML format.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/911/1*xXKMZYuFqC-1DRsG-5zvSA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PpIhHe5Dnr0mLmn9MaeKkg.png" /></figure><p><strong>2. Get all the renderings of an item, and use the GraphQL layout query</strong></p><p>For example, if I want to update only the data source of the <strong>HeroBanner </strong>component, I find that the RAW value returns a UID. Therefore, to obtain the unique ID of the rendering, I need to call the layout query to fetch the rendering using both the UID and the component name.</p><pre>public LayoutModel GetAllRenderings(string itemPath, string sitename, string language)<br>{<br>    LayoutModel? resultItems = null;<br>    var query = @&quot;query layout($itemPath: String!, $sitename: String!, $language: String!) {<br>                  layout(routePath: $itemPath, site: $sitename, language: $language) {<br>                    item {<br>                      rendered<br>                    }<br>                  }<br>                }&quot;;<br><br>    var variables = new { itemPath, sitename, language };<br>    var jsonString = _commonService.ExecuteGraphQLQuery(query, variables).Result;<br>    var jObj = JObject.Parse(jsonString);<br><br>    var route = jObj.SelectToken(&quot;data.layout.item.rendered.sitecore.route&quot;);<br>    string routeString = route?.ToString(); // full JSON of route<br>    var data = JsonConvert.DeserializeObject&lt;LayoutModel&gt;(routeString ?? string.Empty);<br>    if (data != null)//data?.layout?.item?.rendered?.sitecore?.route?.placeholders<br>    {<br>        resultItems = data;<br>    }<br>    return resultItems;<br>}<br><br>public async Task&lt;string&gt; ExecuteGraphQLQuery(string query, object variables)<br>{<br>    var request = new { query, variables };<br>    var json = JsonConvert.SerializeObject(request);<br>    var content = new StringContent(json, Encoding.UTF8, &quot;application/json&quot;);<br><br>    _httpClient.DefaultRequestHeaders.Clear();<br>    _httpClient.DefaultRequestHeaders.Add(&quot;sc_apikey&quot;, _sitecoreApiKey);<br><br>    var response = await _httpClient.PostAsync(_sitecorePreviewAPI, content);<br>    response.EnsureSuccessStatusCode();<br><br>    return await response.Content.ReadAsStringAsync();<br>}</pre><p>Layout query doesn’t support in GraphQL Authoring API, so we have to use Sitecore Edge or Preview API</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7T7Ti77V75rcyMgVaehifQ.png" /></figure><p>3.<strong> Parse and Modify the XML Layout</strong></p><p>Parse the XML value and loop through the devices and renderings, checking if the XML <strong>UID </strong>is available in the entire renderings collection. If it is present, compare it with the <strong>component name</strong> and update the data source.</p><pre>private async Task UpdateDataSource(DataItem globOfferItem)<br>{<br>    var offerItem = _offers.GetItemRenderings(globOfferItem.ItemId);<br>    if (offerItem != null &amp;&amp; !string.IsNullOrEmpty(offerItem.Path) &amp;&amp; !string.IsNullOrWhiteSpace(offerItem.Renderings.Value))<br>    {<br>        string renderingPath = offerItem.Path.Replace(&quot;Home Node Path&quot;, string.Empty);<br>        var layoutData = _offers.GetAllRenderings(renderingPath, Constants.SiteNames);<br>        var layoutDataList = layoutData?.Placeholders?.SelectMany(x =&gt; x.Value).ToList();<br>        if (layoutData != null &amp;&amp; layoutDataList != null)<br>        {<br>            bool isUpdated = false;<br>            XDocument doc = XDocument.Parse(offerItem.Renderings.Value);<br>            XNamespace? s = doc.Root?.GetNamespaceOfPrefix(&quot;s&quot;);<br>            if (s != null)<br>            {<br>                // Loop through each &lt;d&gt; device<br>                foreach (var device in doc.Descendants(&quot;d&quot;))<br>                {<br>                    //var deviceId = (string)device.Attribute(&quot;id&quot;);<br><br>                    //if (!deviceIds.Contains(deviceId))<br>                    //    continue;<br><br>                    // Loop through each &lt;r&gt; rendering inside this device<br>                    foreach (var rendering in device.Elements(&quot;r&quot;))<br>                    {<br>                        var uid = (string)rendering.Attribute(&quot;uid&quot;);<br>                        if (!string.IsNullOrEmpty(uid))<br>                        {<br>                            var renderingItem = layoutDataList.FirstOrDefault(x =&gt; Guid.Parse(x.UID) == Guid.Parse(uid));<br>                            if (renderingItem != null)<br>                            {<br>                                switch (renderingItem.ComponentName)<br>                                {<br>                                    case &quot;HeroBanner&quot;:<br>                                        rendering.SetAttributeValue(s + &quot;ds&quot;, &quot;DataSource Path Or ID&quot;);<br>                                        isUpdated = true;<br>                                        break;<br>                                    case &quot;Articles&quot;:<br>                                        rendering.SetAttributeValue(s + &quot;ds&quot;, &quot;DataSource Path Or ID&quot;);<br>                                        isUpdated = true;<br>                                        break;                                    <br>                                }<br>                            }<br>                        }<br>                    }<br>                }<br>                if (isUpdated)//allow if any changes<br>                {<br>                    var fieldsToUpdate = new List&lt;NameValuePair&gt;<br>                {<br>                    new() { name = &quot;__Renderings&quot;, value = doc.ToString() },<br>                };<br>                    await _graphQL.UpdateSitecoreItem(globOfferItem.ItemId, fieldsToUpdate);<br>                }<br>            }<br>        }<br>    }<br>}</pre><p><strong>4. Update the Layout Field Using GraphQL Mutation</strong></p><p>Finally updating the <strong>__Renderings </strong>field value with the updated XML-formatted value.</p><pre>public async Task&lt;ItemBaseModel&gt; UpdateSitecoreItem(string itemId, List&lt;NameValuePair&gt; fields, string language = &quot;en&quot;)<br>{<br>    ItemBaseModel resultItems = new ItemBaseModel();<br>    var mutation = @&quot;mutation UpdateSitecoreItem($input: UpdateItemInput!) {<br>            results:updateItem(input: $input) {<br>                item {<br>                    itemId<br>                    path<br>                }<br>            }<br>        }&quot;;<br><br>    var input = new<br>    {<br>        itemId,<br>        language,<br>        fields<br>    };<br><br>    var variables = new { input };<br>    var response = await _commonService.ExecuteGraphQLAuthoringQuery(mutation, variables);<br>    var data = JsonConvert.DeserializeObject&lt;UpdateItemResponse&gt;(response);<br><br>    if (data != null &amp;&amp; data.Data != null &amp;&amp; data.Data.Results != null &amp;&amp; data.Data.Results.Item != null)<br>    {<br>        resultItems = data.Data.Results.Item;<br>    }<br>    return resultItems;<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d7175c610ddc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to include or exclude fields from the GraphQL layout rendered query]]></title>
            <link>https://medium.com/@sathyamail95/how-to-include-or-exclude-fields-from-the-graphql-layout-rendered-query-e0bd80e91130?source=rss-ab3f136062b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/e0bd80e91130</guid>
            <dc:creator><![CDATA[Sathiyamoorthi Subramanian]]></dc:creator>
            <pubDate>Wed, 23 Jul 2025 17:59:54 GMT</pubDate>
            <atom:updated>2025-07-23T17:59:54.984Z</atom:updated>
            <content:encoded><![CDATA[<p>I needed to include and exclude certain fields from the GraphQL layout rendered query response. To achieve that, I customized the GraphQL response pipeline. Follow these steps to accomplish this.</p><p><strong>Step 1:</strong> Extend the <strong>DefaultItemSerializer</strong></p><p>Here I have added two methods to get the fields for Include and Exclude, and it will support <strong>FieldName</strong>, <strong>FieldID </strong>and <strong>wildcard</strong></p><pre>using Sitecore.Data.Fields;<br>using Sitecore.Diagnostics;<br>using Sitecore.LayoutService.Serialization.ItemSerializers;<br>using Sitecore.LayoutService.Serialization.Pipelines.GetFieldSerializer;<br>using System;<br>using System.Collections.Generic;<br>using System.Xml;<br>using Sitecore.Xml;<br>using System.Text.RegularExpressions;<br><br>namespace MyCode.Foundation.Pipelines.ItemSerializer<br>{<br>    public class GraphQLLayoutQuerySerializer : DefaultItemSerializer<br>    {<br>        protected readonly HashSet&lt;Guid&gt; ExcludedFieldIds = new HashSet&lt;Guid&gt;();<br>        protected readonly List&lt;string&gt; ExcludedFieldSpecs = new List&lt;string&gt;();<br>        protected readonly HashSet&lt;Guid&gt; IncludedFieldIds = new HashSet&lt;Guid&gt;();<br>        protected readonly List&lt;string&gt; IncludedFieldSpecs = new List&lt;string&gt;();<br><br>        public GraphQLLayoutQuerySerializer(IGetFieldSerializerPipeline getFieldSerializerPipeline) : base(getFieldSerializerPipeline)<br>        {<br>        }<br><br>        public virtual void AddIncludedFields(XmlNode configNode)<br>        {<br>            Assert.IsNotNull((object)configNode, nameof(configNode));<br>            string attribute1 = XmlUtil.GetAttribute(&quot;fieldId&quot;, configNode);<br>            if (attribute1 != string.Empty)<br>            {<br>                Guid result;<br>                if (!Guid.TryParse(attribute1, out result))<br>                    throw new InvalidOperationException(&quot;The inlcuded field ID &quot; + attribute1 + &quot; was not a valid GUID value.&quot;);<br>                this.IncludedFieldIds.Add(result);<br>            }<br>            else<br>            {<br>                string attribute2 = XmlUtil.GetAttribute(&quot;name&quot;, configNode);<br>                if (!(attribute2 != string.Empty))<br>                    throw new InvalidOperationException(&quot;A field inclusion did not contain a &#39;fieldId&#39; or &#39;name&#39; attribute. Please correct this.&quot;);<br>                this.IncludedFieldSpecs.Add(attribute2);<br>            }<br>        }<br><br>        public virtual void AddExcludedFields(XmlNode configNode)<br>        {<br>            Assert.IsNotNull((object)configNode, nameof(configNode));<br>            string attribute1 = XmlUtil.GetAttribute(&quot;fieldId&quot;, configNode);<br>            if (attribute1 != string.Empty)<br>            {<br>                Guid result;<br>                if (!Guid.TryParse(attribute1, out result))<br>                    throw new InvalidOperationException(&quot;The excluded field ID &quot; + attribute1 + &quot; was not a valid GUID value.&quot;);<br>                this.ExcludedFieldIds.Add(result);<br>            }<br>            else<br>            {<br>                string attribute2 = XmlUtil.GetAttribute(&quot;name&quot;, configNode);<br>                if (!(attribute2 != string.Empty))<br>                    throw new InvalidOperationException(&quot;A field exclusion did not contain a &#39;fieldId&#39; or &#39;name&#39; attribute. Please correct this.&quot;);<br>                this.ExcludedFieldSpecs.Add(attribute2);<br>            }<br>        }<br><br>        protected override bool FieldFilter(Field field)<br>        {<br>            Assert.ArgumentNotNull(field, nameof(field));<br><br>            // If a field is explicitly included, it should always be serialized.<br>            if (IncludedFieldIds.Contains(field.ID.Guid))<br>            {<br>                return true;<br>            }<br><br>            foreach (string includedFieldSpec in this.IncludedFieldSpecs)<br>            {<br>                if (IsWildcardMatch(field.Name, includedFieldSpec))<br>                    return true;<br>            }<br><br>            // Check against custom exclusion rules.<br>            if (this.ExcludedFieldIds.Contains(field.ID.Guid))<br>                return false;<br>            foreach (string excludedFieldSpec in this.ExcludedFieldSpecs)<br>            {<br>                if (this.IsWildcardMatch(field.Name, excludedFieldSpec))<br>                    return false;<br>            }<br><br>            // Fall back to the base implementation for all other cases.<br>            // This ensures default behavior (like filtering system fields) is maintained.<br>            return base.FieldFilter(field);<br>        }<br>        protected virtual bool IsWildcardMatch(string input, string wildcards)<br>        {<br>            return wildcards.IndexOf(&#39;*&#39;) &lt; 0 ? wildcards.Equals(input, StringComparison.OrdinalIgnoreCase) : Regex.IsMatch(input, &quot;^&quot; + Regex.Escape(wildcards).Replace(&quot;\\*&quot;, &quot;.*&quot;).Replace(&quot;\\?&quot;, &quot;.&quot;) + &quot;$&quot;, RegexOptions.IgnoreCase);<br>        }<br><br>    }<br>}</pre><p><strong>Step 2: </strong>Create a config patch file</p><p>We need to replace or extend this method, but I have used my custom code instead of the existing implementation<br><strong>Sitecore.XA.JSS.Foundation.Presentation.Serialization.SxaItemSerializer</strong></p><p><strong>AddIncludedFields </strong>method claims the included fields with the help of<strong> </strong>raw:AddIncludedFields<br><strong>AddExcludedFields</strong> method claims the excluded fields with the help of raw:AddExcludedFields</p><pre>&lt;configuration xmlns:patch=&quot;http://www.sitecore.net/xmlconfig/&quot;&gt;<br> &lt;sitecore&gt;<br>  &lt;layoutService&gt;<br>   &lt;configurations&gt;<br>    &lt;config name=&quot;sxa-jss&quot;&gt;<br>     &lt;rendering&gt;<br>      &lt;!-- Use patch:instead for a clean replacement, and copy all required config inside --&gt;<br>      &lt;itemSerializer patch:instead=&quot;*[@type=&#39;Sitecore.XA.JSS.Foundation.Presentation.Serialization.SxaItemSerializer, Sitecore.XA.JSS.Foundation.Presentation&#39;]&quot;<br>        type=&quot;MyCode.Foundation.Pipelines.ItemSerializer.GraphQLLayoutQuerySerializer, DubaiHoldings.Foundation.Pipelines&quot; resolve=&quot;true&quot;&gt;<br>       &lt;AlwaysIncludeEmptyFields&gt;true&lt;/AlwaysIncludeEmptyFields&gt;<br>       &lt;!-- Your custom rules remain here with fieldId or name --&gt;<br>       &lt;IncludedFields hint=&quot;raw:AddIncludedFields&quot;&gt;<br>        &lt;include name=&quot;__Updated&quot; /&gt; &lt;!-- By default standard fields exluded but explicity including the field by name--&gt;<br>       &lt;/IncludedFields&gt;<br>       &lt;ExcludedFields hint=&quot;raw:AddExcludedFields&quot;&gt;<br>        &lt;exclude name=&quot;SEO_*&quot; /&gt; &lt;!-- Start with SEO field will be excluded--&gt;<br>        &lt;exclude name=&quot;Claim Points&quot; /&gt;<br>        &lt;!-- Manually copy the fields from Sitecore.XA.JSS.Foundation.SiteMetadata.config to ensure they are processed --&gt;<br>        &lt;exclude fieldId=&quot;{508C54C0-CD02-4266-8B68-D71F88DE1AA9}&quot; desc=&quot;Claim Points Resorts&quot; /&gt;<br>        &lt;exclude fieldId=&quot;{76FB6FFD-4487-4028-A1CF-705FBE360CBA}&quot; desc=&quot;Priority&quot; /&gt;<br>       &lt;/ExcludedFields&gt;<br>      &lt;/itemSerializer&gt;<br>     &lt;/rendering&gt;<br>    &lt;/config&gt;<br>   &lt;/configurations&gt;<br>  &lt;/layoutService&gt;<br> &lt;/sitecore&gt;<br>&lt;/configuration&gt;</pre><p>Finally, check the layout query. The <strong>__updated</strong> field is included in this response, and the field name starts with SEO_, and other excluded fields must not be rendered.</p><pre>query {<br>  layout(site: &quot;sitename&quot;, routePath: &quot;/&quot;, language: &quot;en&quot;) {<br>    item{<br>      rendered<br>    }<br>  }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/795/1*Bnin6FXFFULnbhRdJYCEPA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e0bd80e91130" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[XM Cloud + SSO Integration with Azure AD]]></title>
            <link>https://medium.com/@sathyamail95/xm-cloud-sso-integration-with-azure-ad-a51b70a8d964?source=rss-ab3f136062b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/a51b70a8d964</guid>
            <dc:creator><![CDATA[Sathiyamoorthi Subramanian]]></dc:creator>
            <pubDate>Thu, 10 Jul 2025 19:08:05 GMT</pubDate>
            <atom:updated>2025-07-10T19:08:05.465Z</atom:updated>
            <content:encoded><![CDATA[<p>To configure SSO, you must have an <strong>Organization Admin</strong> or <strong>Organization Owner role</strong>. You must also have the ability to register Sitecore Cloud Portal with your identity provider (IdP) and the ability to create a TXT record with your domain host.</p><p>To allow team members to log in using an OIDC identity provider, you need to configure OpenID Connect.</p><h4>Step 1: Register Sitecore Cloud Portal with your OIDC identity provider</h4><ol><li>Login to <a href="https://portal.azure.com/">Azure Portal</a></li><li>Navigate to Microsoft Entra ID -&gt; App Registrations</li><li>Click the New Registration.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xeWXLYvszCsozgNDfIlCkQ.png" /></figure><p>4. Fill in the required information — name, supported account type, and Redirect URI</p><p><strong>Redirect URI</strong> — <a href="https://auth.sitecorecloud.io/login/callback">https://auth.sitecorecloud.io/login/callback</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gvh6Le_h3vK96f4ySD_YUg.png" /></figure><p>5. Go to the Authentication tab and check the ID tokens checkbox.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*i3-Lr70ycUMissKk25Goaw.png" /></figure><p>6. Navigate to the Overview page, copy the <strong>Client ID</strong> and <strong>Open ID </strong>endpoint</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QoRzzipGRpU243hs60vSnw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3fod9Cxwyc9s-wApsVl6xg.png" /></figure><p><strong>Step 2: Add an SSO connection in Sitecore Cloud Portal</strong></p><ol><li>Login into <a href="https://portal.sitecorecloud.io/">Sitecore Cloud</a></li><li>Click on <strong>Admin </strong>from the top menu and navigate to Single Sign-On (SSO)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CpQfzCBS5_6SrmBwSikWRg.png" /></figure><p>3. Click on<strong> Add SSO Connection</strong> <strong>&gt; OpenID Connect</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e61Cjs6RbWTrzCo1wqam-g.png" /></figure><p>4. Fill in the required information</p><ul><li><strong>Email Domain </strong>— The email domains associated with this SSO connection, up to 50 domains. example:- gmail.com</li><li><strong>Connection Type </strong>— Choose <strong>Front Channel</strong></li><li><strong>Issuer URL</strong> — Copied from the Azure <strong>OpenID URL</strong></li><li><strong>Scopes</strong> — openid profile email<br>We recommended that you also include the scopes that will return the following claims: name, given_name, family_name, nickname</li><li><strong>Client ID</strong> — Copied from the Azure Client ID</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A1vjgmYkAeASdMBotGTaJw.png" /></figure><p>5. Click Save. A TXT record will be generated. Copy the TXT record and add it to your domain’s DNS record.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-sDrvd45YeuchGAntJ2aMA.png" /></figure><p>Here, I have added a TXT record to my domain in DNS Records.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*4g9tPYeskxJ13wzM1zJDGw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a51b70a8d964" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Connect Content Hub and XM Cloud: Local Setup Guide]]></title>
            <link>https://medium.com/@sathyamail95/how-to-connect-content-hub-and-xm-cloud-local-setup-guide-c1b71166dae7?source=rss-ab3f136062b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/c1b71166dae7</guid>
            <dc:creator><![CDATA[Sathiyamoorthi Subramanian]]></dc:creator>
            <pubDate>Wed, 16 Apr 2025 06:49:32 GMT</pubDate>
            <atom:updated>2025-04-16T06:49:32.491Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Setting Up XM Cloud Local Instance using Docker:</strong></p><ol><li>Download the XM Cloud starter kit repository to your local machine.<br><a href="https://github.com/sitecorelabs/xmcloud-foundation-head.git">https://github.com/sitecorelabs/xmcloud-foundation-head.git</a></li></ol><p>2. Refer to the following link for the necessary software dependencies and installation instructions<br><a href="https://doc.sitecore.com/xmc/en/developers/xm-cloud/set-up-your-full-stack-xm-cloud-local-development-environment.html">https://doc.sitecore.com/xmc/en/developers/xm-cloud/set-up-your-full-stack-xm-cloud-local-development-environment.html</a></p><p>3. After installing the required dependencies, open PowerShell in Administrator mode. Navigate to your source code repository and execute the following command</p><p>Replace `&lt;C:\path\to\license.xml&gt;` with the path to your valid Sitecore license file and `&lt;desired password&gt;` with your chosen administrative password.</p><pre>./local-containers/scripts/init.ps1 -InitEnv -LicenseXmlPath &quot;&lt;C:\path\to\license.xml&gt;&quot; -AdminPassword &quot;&lt;desired password&gt;&quot;</pre><p>4. Next, run the script below to download the Sitecore Docker images, and install and configure the containers along with the client application</p><pre>./local-containers/scripts/up.ps1</pre><p>5. Troubleshooting Errors:</p><p>If you encounter the following error:</p><pre>Invalid volume specification: &#39;/c/xm-cloud-app/xmcloud-contenthub/local-containers/docker/data/solr:c:\data:rw&#39;</pre><p><strong>Solution</strong>: Execute this command in PowerShell to resolve the issue</p><p>Remove-Item Env:\COMPOSE_CONVERT_WINDOWS_PATHS -ErrorAction SilentlyContinue</p><p>If you face issues related to `ltsc2022`:</p><pre>Error response from daemon: manifest for traefik:v3.0.4-windowsservercore-ltsc2012 not found: manifest unknown: manifest unknow</pre><p><strong>Solution: </strong>Update the `.env` file located in the `local-containers` directory with the following values</p><pre>ITECORE_VERSION=1-ltsc2019<br>EXTERNAL_IMAGE_TAG_SUFFIX=ltsc2019<br>TRAEFIK_IMAGE=traefik:v3.0.4-windowsservercore-1809<br>NODEJS_PARENT_IMAGE=mcr.microsoft.com/windows/nanoserver:1809</pre><p>By following these steps, you should be able to successfully set up your XM Cloud local instance using Docker.</p><p><strong>Setting Up the Content Hub DAM Connector:</strong></p><p>To utilize Sitecore Digital Asset Management (DAM) in a local XM Cloud development environment running within a Docker container, follow the steps below.</p><p>By default, XM Cloud enables the Content Hub feature and includes some environment keys.</p><p><strong>Step 1:</strong> Add the following keys to the `.env` file</p><pre>Sitecore_DAM_ContentHub=ClientId=App;ClientSecret=a51a8fb6-4f57-1234;UserName=Sathiya;Password=FindMe;URI=https://contenthub-url<br>Sitecore_DAM_SearchPage=https://contenthub-url/en-us/sitecore-dam-connect/approved-assets<br>Sitecore_DAM_ExternalRedirectKey=Sitecore<br>SITECORE_DAM_ENABLED=yes</pre><p>Sitecore_DAM_SearchPage = refers to the URI for the page that opens the DAM in an iframe</p><p>The <strong>Client ID</strong> and <strong>ClientSecret</strong> pertain to the OAuth client of the connector, which can be found in Content Hub under</p><p><strong>Manage -&gt; Settings -&gt; OAuth Client</strong></p><p>Make sure to replace placeholders, such as `<a href="https://contenthub-url`/">https://contenthub-url`</a>, with the actual URL of your Content Hub</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/1*vOr_IXnKngTzNHs879EY-A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WBOs_WROasq7N6kMbP0YRg.png" /></figure><p>Open the docker-compose.override.yml file, and add the following key-value pairs to the services &gt; cm &gt; environment attribute</p><pre>Sitecore_ConnectionStrings_DAM_dot_ContentHub: ${Sitecore_DAM_ContentHub}<br>Sitecore_ConnectionStrings_DAM_dot_SearchPage: ${Sitecore_DAM_SearchPage}<br>Sitecore_ConnectionStrings_DAM_dot_ExternalRedirectKey: ${Sitecore_DAM_ExternalRedirectKey}<br>SITECORE_AppSettings_damEnabled__define: ${SITECORE_DAM_ENABLED} </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hiDJpUDrQJca-m1iKZyKRA.png" /></figure><p><strong>Step 2: </strong>To ensure the Content Hub DAM iframe displays correctly in the Content Editor and XM Cloud Pages media item picker, you must add the Pages and environment hostname URLs to the Content Hub CORS configuration.</p><p>Sitecore DAM main menu -&gt; <strong>Manage -&gt;Settings <br>Settings</strong> page <strong>-&gt; PortalConfiguration -&gt; CORSConfiguration</strong></p><p>Add the below URLs:<br>XM Cloud Pages: <a href="https://pages.sitecorecloud.io/">https://pages.sitecorecloud.io</a><br>Local environment, for example: <a href="https://xmcloudcm.localhost/">https://xmcloudcm.localhost/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DfeNFPRS5N0T-toge595cw.png" /></figure><p><strong>Step 3:</strong> Set up a DAM connection by adding the content security policy with your content hub URL</p><p>Create a <strong>transforms </strong>folder in local-containers\docker\build\cm</p><p>Create a Web.config.xdt file inside the transforms folder and paste this code below inside it.</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br>&lt;configuration xmlns:xdt=&quot;http://schemas.microsoft.com/XML-Document-Transform&quot;&gt;<br>    &lt;location path=&quot;sitecore&quot;&gt;<br>        &lt;system.webServer&gt;<br>            &lt;httpProtocol&gt;<br>                &lt;customHeaders&gt;                             <br>                    &lt;add xdt:Transform=&quot;SetAttributes&quot; xdt:Locator=&quot;Match(name)&quot; name=&quot;Content-Security-Policy&quot; value=&quot;default-src &#39;self&#39; &#39;unsafe-inline&#39; &#39;unsafe-eval&#39; https://apps.sitecore.net https://web-sdk-eu.aptrinsic.com https://esp-eu.aptrinsic.com; img-src &#39;self&#39; data: https://s.gravatar.com https://*.wp.com/cdn.auth0.com/avatars https://cdn.auth0.com/avatars; style-src &#39;self&#39; &#39;unsafe-inline&#39; https://fonts.googleapis.com https://web-sdk-eu.aptrinsic.com; font-src &#39;self&#39; &#39;unsafe-inline&#39; https://fonts.gstatic.com; frame-src &#39;self&#39; https://*.sitecore-staging.cloud/auth https://*.sitecorecloud.io/auth https://contenthub-url; block-all-mixed-content;&quot;/&gt;<br>                &lt;/customHeaders&gt;<br>            &lt;/httpProtocol&gt;<br>        &lt;/system.webServer&gt;<br>    &lt;/location&gt;<br>&lt;/configuration&gt;</pre><p>Replace the <a href="https://contenthub-url/">https://contenthub-url</a> with your content hub sandbox URL</p><p>Open the Dockerfile located in local-containers/docker/build/cm and add the following code at the end to invoke XdtTransform.</p><pre>COPY .\transforms\ \transforms\<br>RUN C:\tools\scripts\Invoke-XdtTransform.ps1 -Path .\ -XdtPath C:\transforms</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5TRQwES1mk9f_FE_xMdCDw.png" /></figure><p>Finally, run up.ps1 script in PowerShell admin mode</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*mx4XqVQkbXl_UxDxrRPeoA.png" /></figure><p>Visit <a href="https://xmcloudcm.localhost/sitecore">https://xmcloudcm.localhost</a>/sitecore and go to any image field where you can find the option ‘Browse Sitecore DAM’. By clicking on it, you will be able to access the DAM in an iframe</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yi4yMSfuaVmI2yLXY2W9yA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZQjKecPxz-KQ1RaB8WhqGQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c1b71166dae7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“How to Retrieve Content from Content Hub Using GraphQL]]></title>
            <link>https://medium.com/@sathyamail95/how-to-retrieve-content-from-content-hub-using-graphql-2735b596a345?source=rss-ab3f136062b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/2735b596a345</guid>
            <category><![CDATA[content-strategy]]></category>
            <category><![CDATA[sitecore-xm-cloud]]></category>
            <category><![CDATA[sitecore]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[sitecore-content-hub]]></category>
            <dc:creator><![CDATA[Sathiyamoorthi Subramanian]]></dc:creator>
            <pubDate>Thu, 27 Feb 2025 20:39:38 GMT</pubDate>
            <atom:updated>2025-02-27T20:39:38.225Z</atom:updated>
            <content:encoded><![CDATA[<h3>Accessing the GraphQL Playground</h3><ol><li><strong>Preview API</strong></li></ol><p>Use the Preview API to access content that has not yet been approved, including drafts.</p><p><strong>Endpoint</strong>: &lt;ContentHubURL&gt;/api/graphql/preview/ide<br><strong>Authentication:</strong><br>{ “X-GQL-Token”:”aEtSNzBsTaEtSNzBMA”}</p><p>The Preview API key is used to authenticate requests.</p><p>2. <strong>Delivery API</strong></p><p>The Delivery API is a <a href="https://doc.sitecore.com/ch/en/developers/cloud-dev/graphql.html">GraphQL</a> endpoint that exposes approved and published content</p><p><strong>Endpoint:</strong> <a href="https://edge.sitecorecloud.io/api/graphql/ide%60">https://edge.sitecorecloud.io/api/graphql/ide</a></p><p>The Delivery API key is used to authenticate requests.</p><h3>Fetch Digital Assets</h3><p>Use the appropriate query to retrieve all assets of a specific file type.</p><pre>{<br>  allM_Asset(where: { fileName_endswith: &quot;.png&quot; }) {<br>    results {<br>      id<br>      fileName<br>      urls<br>    }<br>  }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M09rF4QgbGUcdHlNtX7xlg.png" /></figure><h3>Fetching Content Collections</h3><p>To fetch all content collections, follow these guidelines</p><pre>{<br> allM_ContentCollection {<br>  results {<br>   contentCollectionName<br>   id<br>  }<br> }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AqgHxdVo3TXnPfOezWuXXQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*07X6shAbQmxqrGwE1lsWYw.png" /></figure><h3>You have two options to access a specific content collection</h3><p>1. Use a specific API key for that particular collection</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hfPd3xfZLR1VBYsK1aPVVA.png" /></figure><p>2. Use the content collection ID to fetch content from that collection</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*mTIQef1tohMY9vtskb4Tpg.png" /></figure><h3><strong>Fetch content from a specific collection</strong></h3><p>If I have two items in the “Sat Collection” and I want to access the promo content, I would specify that in my query</p><pre>{<br>  m_ContentCollection(id: &quot;hJqhlrDCQvC032sVVZWNqQ&quot;) {<br>    createdBy<br>    createdOn<br>    contentCollectionToContent {<br>      results {<br>        ... on M_Content_Promo {<br>          promo_Headline<br>          promo_Offer<br>        }<br>      }<br>    }<br>  }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lzUEytn18WnxX5Qn7M_1oA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*40_hmp5PqkIYLZlXq5eYqQ.png" /></figure><h3>Fetching Multiple Content Types in a Single Request</h3><pre>query contentPromosAndAds {<br>  allM_Content_Promo(first:3) {<br>    total<br>    results {<br>      content_Name<br>      promo_Headline<br>      promo_Offer<br>    }<br>  }<br>  allM_Content_a(first:3, orderBy: A_TITLE_ASC) {<br>    total<br>    results {<br>      content_Name<br>      a_Title<br>      a_Body<br>    }<br>  }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1E9LGy1qvlvy_bLb2_iM3A.png" /></figure><p>You can streamline your queries by fetching multiple content types in a single request</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2735b596a345" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>