UserName Overwrite with Azure AD – SSO for Identity server

As you probably know, Sitecore is shipping from version 9.1 with the Identity server….

If you want to integrate Sitecore with Azure Active Directory, this resource will walk you through the configuration step by step:

However once you have followed all the steps, you will have an unpleasant surprise when you discover that the Sitecore UserName is mapped with some random unfriendly characters…



As you can probably agree, this is not very user-friendly since the user-name is used in the item version history and within the workflows…


this code snippet will help you to use as user-name, either for the email address as username or the cleaned name of the active directory user…



Celebrating my 200th post

I am happy to celebrate with you my 200th blog post and still counting…

This year has been a great year for the Sitecore community having fun with Sitecore 9 & DevOps… in case you have missed I would suggest you take a look at my posts talking about Azure, Powershell, Gulp, Helix and best way to build your deployment pipeline…



Copying Unicorn Files With PowerShell for Azure Pipeline within an Helix style solution without GULP

In the case, you have an Helix style solution, you are using Unicorn and you use Azure Dev ops as your build pipeline to publish your solution on Azure PAAS and you want to use Gulp only for styles and scripts manipulations…

you will definitively need this snippet since you probably have already encountered this problem within your Build Pipeline…

The principle is pretty simple, you need to copy your YML files and keep all the folder structure within serialization… within the App_Data/Unicorn folder within a website Temp folder that you will later zip with the rest of Bin and Views so that you can install your changes once the package is deployed across the environment…

This is done within the Gulp – Package task typically, but if you want to get rid of it, I would recommend doing a separate PowerShell Task just to copy Unicorn files…


The content of the Powershell is pretty simple and copy the files keeping your serialization structure across Feature, Foundation, Project folders…

Disaster Recovery region in Azure for Sitecore 9.x

In case you are worried about an Azure region going down and want to make your Sitecore Azure infrastructure not dependent on a single region, deploying a region for disaster recovery could be an option…

Obviously, depending on the complexity of your website, Sitecore resilience may be the minor problem in case of a region failure and further conversation should be taken to ensure that your infrastructure and data can be available across multiple regions….

As you can imagine, if your site is relying on Sitecore Analytics for personalization features your task won’t be trivial due to the Sitecore architecture, however, is a fair assumption and common practice to have analytics turned off on the DR region…

A typical DR region for Sitecore, would need the following elements:

  • Content Delivery server
  • WebDatabase
  • Redis cache (you could consider switching off if budget is an issue)
  • Search (assuming that is mandatory to have search available in case of DR)

My recommendation to provision a DR region on Azure PAAS would be to use the XM scaled scripts to provision a new environment in your favourite “backup” region and then delete the unrequired resources:

  • Identity server
  • Content Management Server
  • Master Database

The following Powershell script shows how to run the clean up of these resources…


Sitecore 9.2 Powershell using ARM Template for Azure PaaS

As you have probably heard, SAAS is coming summer 2020… but if your Sitecore project cannot wait that long, ARM templates are what you need to provision your Sitecore application on Azure PAAS…

In case you have no idea where to start, a few things that you need to know and decide

Sitecore Topology: you will have to choose between XM in case you do not need analytics and XP in case you need the fully flagged platform…

The topology is very different adding several additional configurations and servers in case you decide to go with the analytics….

Size of your installation, this will preset the size and kind of services provisioned, the default setting is extrasmall so that you can save on costs….

The url to get the Sitecore templates for 9.2 is

In addition to this, you will need the WDP packages for the topology selected don’t forget to download WDP for the identity server…

In addition to this, you will need a valid sitecore license, an azure subscription and you can provision a certificate for your test instance….

Once you have all the resource ready you will have upload on azure the WDP and the ARM templates in a storage account / Container…

Assuming you are going for the XM Scaled template, will look like:


once you are ready with thearm template, you can start editing your powershell required for trigger the deployment:

here is a very good example…

once you are ready to start provisioning, keep calm since the XM templates took more than 30 minutes and the XP scaled will take you more than one hour to complete…

in case you are working with test certificates, do not forget to add a allowInvalidClientCertificates parameter and set it to true in the parameters.json file…

Also worth mentioning that the key command to launch to provision your infrastructure is New-AzureRmResourceGroupDeployment -ResourceGroupName $Name -TemplateFile $ArmTemplateUrl -TemplateParameterObject $additionalParams -Debug -Verbose

note that the additionalparams is a hashtable generated from the parameters.json…

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.


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
#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.


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.