Sitecore Active Directory Module 1.3 setup guide

Recently I have installed Sitecore Active Directory Module 1.3 against Sitecore 8.2 update 3 – 170407 overall I got the integration fully working and I was happy with it…

I have performed the configuration on premise, but theoretically should work also in IAAS / PAAS approach assuming that you can perform the LDAP queries…

This is the list of the steps that I have performed to configure it

1) Download Sitecore Active Directory module 1.3

https://dev.sitecore.net/Downloads/Active_Directory/1_3/Active_Directory_1_3.aspx

2) Install Sitecore Module

Upload and install the sitecore package

3) Amend the Connection string Adding:

<add name="LDAP_CONN" connectionString="LDAP://DOMAINCONTROLLERNAME:389/OU=Sitecore,OU=Dev,OU=AppStreams,OU=PARENT,OU=PARENT,OU=Locations... DC=com" />

Note OU are used to filter within the Active directory forest… Generally you do not want to have all the AD users on Sitecore but just a subset preassigned to your forest (eg. IT & Marketing users).

Also note that you need to have a service user to perform LDAP queries, in this case

4) Add Domain in the domain.config

<domain name="DOMAIN" ensureAnonymousUser="false" />

5) Amend Sitecore Config

<membership>
<provider providerName="sql" storeFullNames="true" wildcard="%" domains="*" />
<provider providerName="ad" storeFullNames="false" wildcard="*" domains="DOMAIN" />
</membership>

<roleManager>
<provider providerName="sql" storeFullNames="true" wildcard="%" domains="*" ignoredUserDomains="" allowedUserDomains="" />
<provider providerName="ad" storeFullNames="false" wildcard="*" domains="DOMAIN" />
</roleManager>

6) Amend WebConfig

Amend all the switching providers appropriately

<add name="ad" type="LightLDAP.SitecoreADMembershipProvider" connectionStringName="LDAP_CONN" applicationName="sitecore" minRequiredPasswordLength="1" minRequiredNonalphanumericCharacters="0" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" connectionProtection="Secure" connectionUsername="DOMAIN\sitecoredev" connectionPassword="XXXXX" attributeMapUsername="sAMAccountName" enableSearchMethods="true" enablePasswordReset="false" />

<add name="ad" type="LightLDAP.SitecoreADRoleProvider" connectionStringName="LDAP_CONN" applicationName="sitecore" attributeMapUsername="sAMAccountName" cacheSize="2MB" username="DOMAIN\sitecoredev" password="XXXX" />

note that you need to have a service user like SitecoreDev to perform LDAP queries…

7) Test it

now you can login as a Sitecore Admin and try to add domain users and set them as Administrator…

8) Bugfix to login with AD users… within Sitecore 8.2 Update 3 you need to install the following hotfix in order to be able to login…

https://kb.sitecore.net/articles/520134

From https://sitecore.app.box.com/s/31iyjczyqt5r59f4gtk6q65qmkloa7fh

Copy the file in the Bin

Update

<add name="switcher" type="Sitecore.Support.Security.SwitchingMembershipProvider, Sitecore.Support.139945" applicationName="sitecore" mappings="switchingProviders/membership" />

https://sitecoresysadmin.wordpress.com/2017/04/12/sitecore-how-to-fix-login-attempt-leads-to-application-crash-when-ad-module-1-3-is-used/comment-page-1/#comment-64 

9) Test it again to login to Sitecore shell with an active directory user selected as Admin…

Happy Sitecore!!!!

 

Azure PAAS for your Sitecore Dev environment with Power Shell

As I have previously blogged about Sitecore 8.2 on Azure PAAS  I decided that it was arrived the right moment for me to provision my Sitecore Dev environment on an Azure WebApp…

The main reason for doing it is to keep all the environments as similar as possible and deploy my code easily from VisualStudio OnLine and simplify my build & CI pipeline for my Dev environment having a production environment PAAS…

In regard having all the environments as similar as possible,  it could be a bit expensive with a cloud consumption based model…  and you can be tempted, as I have been, to have a much simpler configuration without the Sitecore Analytics in the Dev environment.

DevG.png

My ideal configuration for the Dev environment is as simple as possible to keep the cost down and be able to validate my code, to do that what I really need is just one WebApp to use as CM/CD and the standard SQL databases Master, Core, Web, in addition to this you may consider to keep the Insight Analytics on to monitor the environment and notify if any error occur.

Having played a bit with the Sitecore Azure toolkit and the Sitecore Arm Templates, I realised that any of the scripts was helping me to achieve my ideal Dev environment since all the scripts provision Azure Search and Redis cache provider and so I decided to get hands dirty with PowerShell.

After few attempts to change the scripts, I decided to go for an alternative approach:

  1. Take CM scripts and the CM web deploy packages, pretty standard…
  2. Remove all the Configs that relate to Azure Search in the CM package and repackage the webdeploy and upload on Azure Storage
  3. Make a power shell script to remove: Azure Search, Redis Cache Provider, CD WebApp
  4. Happy days with a cheap Sitecore dev environment running on an Azure WebApp

Changing the CM web deployment package is a trivial task just unzip the CA package and change the configs as you wish, in my case disabling these ones and enabling the equivalent ones for Lucene…

  • Sitecore.ContentSearch.Azure.DefaultIndexConfiguration
  • Sitecore.ContentSearch.Azure.Index.Core
  • Sitecore.ContentSearch.Azure.Index.Master
  • Social/Sitecore.Social.Azure.Index.Master
  • Sitecore.Social.Azure.IndexConfiguration
  • Sitecore.ListManagement.Azure.Index.List
  • Sitecore.ListManagement.Azure.IndexConfiguration
  • Sitecore.Marketing.Azure.Index.Master
  • Sitecore.Marketing.Azure.IndexConfiguration
  • Sitecore.Marketing.Definitions.MarketingAssets.Repositories.Azure.Index.Master
  • Sitecore.Marketing.Definitions.MarketingAssets.Repositories.Azure.IndexConfiguration

In regard the power shell script, it is also very simple since it use just Azure Resource manager commands and it looks like that…

 

$Name = "DevResGroup";

$redisserviceName = "$Name-redis";		
$searchserviceName = "$Name-as";
$cdserviceName =  "$Name-cd";
$cdPlanserviceName =  "$Name-cd-hp";

 #Deleting Redis Cache
Remove-AzureRmRedisCache -Name $redisserviceName -ResourceGroupName $Name
 
 #Get Search service and store it in $resource
$resource = Get-AzureRmResource `
    -ResourceType "Microsoft.Search/searchServices" `
    -ResourceGroupName $Name `
    -ResourceName $searchserviceName `
    -ApiVersion 2015-08-19
	
$resource
	
#Deleting your service will delete all indexes and data in the service
$resource | Remove-AzureRmResource

#Deleting your CD WebApp
Remove-AzureRmWebApp -Name $cdserviceName -ResourceGroupName $Name

#Deleting your CD WebApp Service Plan
Remove-AzureRmAppServicePlan  -Name  $cdPlanserviceName -ResourceGroupName $Name

Sitecore 8.2 on Azure PAAS

As you have probably already heard, Sitecore 8.2 is “finally” fully suporting Azure PAAS

In practical terms since the Update 1 version Sitecore is shipping the full platform on Azure to run in PAAS mode and it is officially supporting it.

scPaas

New building blocks of your PAAS deployment model will be:

  • Content Delivery servers on Web Apps (Azure App Service) – it means autoscaling + Application Insight
  • Azure Redis Cache for Session State Provider
  • Azure Search as distributed Search Provider
  • XDB – is still not fully supported in native PAAS mode, but you can provision it on MLAB or in IAAS mode on your VM – Note that Document DB x Mongo is not supported
  • SQL Azure – Master -Core-Web + reporting DB
  • Content Management as a different Azure App Service
  • Processing & Reporting as a different Web Apps or consolidated in the CM role

What has drastically changed? – Logs management now it is part of Application Insight, support for Azure Redis for the Session State Provider, Azure Search is now recommended instead of SOLR.

How do I deploy Sitecore on Azure?

Sitecore reccomend you also the Sizes to run Sitecore on PAAS

My personal recommendation having played with it is to go definitively with Update 3 or a following version and not to use the Azure Market Place to provision your production environment.

 

WebAPI 2 native support in Sitecore 8.2

webapi-pic-300x300-2-2

Here we go with an other episode of the WebAPI and Sitecore saga…

As you probably know each version of Sitecore has managed WebAPI in a different way….

https://sitecorecommerce.wordpress.com/2014/11/30/webapi-attribute-routing-is-not-working-with-sitecore-7-5/

http://kamsar.net/index.php/2014/05/using-web-api-2-attribute-routing-with-sitecore/

Within 8.2 finally Sitecore is officially supporting WebApi NATIVELY

So what do you need to do to write your first WebAPI Controller and start using it?

very simple:

public class MyCustomController : Controller
{
   public ActionResult Test()
   {
      return Content("This is a test");
    }
}

and this is the Url where you can access your controller

Url: http://yourInstanceName/api/sitecore/MyCustom/test

public class MyOtherCustomController : Controller
{
   public ActionResult OtherTest(string mycustomId)
   {
      return Content("This is a test with params" + mycustomId);
    }
}

Url: http://yourInstanceName/api/sitecore/MyOtherCustom/OtherTest/thisIsMyParam

will return “This is a test with params thisIsMyParam”

Happy Sitecore and happy webApi to everybody!

Sitecore Dictionaries Best Practices

Sitecore Dictionaries are a powerful tool if used correctly… Unfortunately Sitecore Dictionaries are often misused from Sitecore newbie developers and I have seen dictionaries leading to catastrophic consequences for the project…
 best-dictionaries-use
let’s go with order:
What are Sitecore Dictionaries
Sitecore allow the developer to define Dictionary when you need to define a simple association Key Name – value Name for your resources.
Typically the developers will hardCode the keyName of the dictionary within the code of the Rendering.
Domain dictionaries:
You could have global dictionaries and you could define global dictionaries that could variate for each site of your multisite implementation.
More reference on domain dictionary can be found here
Dictionaries Localization:
Dictionaries support multiple languages and it reuse Sitecore logic for localization (such as language fall back etc)
further reference on the language fallback of Dictionaries can be found here
When shall you use Dictionaries:
The more common scenario where you should use Dicitonary is for static labels that you use for your website, eg.  the text that you display for a button.
The main difference between using a Dictionary versus the Datasource item association  is that Sitecore dictionaries have a simple structure and do not allow the content authors to change the datasource/behavior of your rendering but allow the content authors just editing the text of the label.
Typically you would use a dictionary for content that does not change very often and for simple content elements such labels of a button
When you should not use it:
Since Dictionaries are “Hardcoded” in the rendering, the use of Dictionaries for certain resources would mean that you cannot take advantage of the personalisation and testing functionalities for the resources stored in the dictionary
you have also to take in account the fact that you “loose” the flexibility for Content Authors to associate the Item Datasource in the name of a SIMPLER solution…
How could you use it:
There are several way to reference to a dictionary key:
Directly in your View
@Sitecore.Globalization.Translate.Text("myKeyName")

or

@Sitecore.Globalization.Translate.TextByDomain("MyDomainDictionary","myKeyName")
Directly in your Controller
return Sitecore.Globalization.Translate.Text("myKeyName");
Exposing the Dictionary values as a WebApi Endpoint (especially in the case that you can cache with your CDN) there are several examples that explain how to build your webApi endpoint..
Creating a static JSON file for each language when the content authors publish the Dictionary item
I hope this post helped you to clarify all what you need to know about Sitecore Dictionaries…

Sitecore 8 Profiling Visitors for Beginners

The first step to deliver Personalisation for Anonymous Visitors of your web site is knowing your Visitors through the pages that they have visited…

Sitecore allow you to Profile your customers interests and behavior through the Profile framework where you can define the Profile Keys, Profile Cards and PatternMatch Cards.

In order to be able to fully benefit from this feature, you need to have XDB & Analytics enabled so that you can fully track your customer behavior.

pofiledefinition

profilecard

patterncard

As you can see, there is not always a clear classification, but often the definition touch multiple dimensions…

Once that you have defined your Profiles, it is time to TAG your content so that you can classify your visitors….

contenttagging

contentsegmentation

Once that you have defined your Profiles and Tagged your content you can easily identify your Anonymous visitors and start delivering personalized content based on the interest and behavior that you were able to track….

Some example of personalisation rules are reported here…

personalisationrule

personalisationrulepatterncards

 

 

Sitecore MVT for Beginners

MVT stands for multivariate testing if you are not familiar with the concept and you know A/B testing is more or less the same thing and in the case you have never heard about it, the principle behind it is to expose your web site visitors to multiple variations of the website content/functionalities to TEST  what is the variant that perform better.

It is important to specify that Sitecore generate the TESTS variation server side and it requires XDB enabled to track analytics and to help you to understand the more effective variant.

There are two way that Sitecore use to deliver MVT functionalities:

Component Based Testing

you can configure it either in Page Editor Mode either from the presentation details here you can specify all the variations that you want to expose your customers and it is very easy to configure as you can see in the following screenshots.

testcomp

mvtcomponents

Page Based Testing

From here you can control all the running Tests and you can see Sitecore suggestions for the Pages to test…

When you create a new Test you will be asked for the page to Test and the Variations of the page to test (you can either use different pages or create different versions of the same page)

You can than define:

  1. The Percentage of the traffic visiting the page to run the test
  2. The Success criteria of your test (eg. if the user is visiting more pages / increasing the engagement value or if the user is triggering a specific Goal/Event eg. conversion rate
  3. The Duration of your test (for how long you want to run the test)
  4. The confidence level, when do you want Sitecore to decide the winner of the test and serve automatically the winner of the test

Happy Testing!

ExperienceOptimisation.png

checkouttest

testdefinition

testwinner