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:
- Take CM scripts and the CM web deploy packages, pretty standard…
- Remove all the Configs that relate to Azure Search in the CM package and repackage the webdeploy and upload on Azure Storage
- Make a power shell script to remove: Azure Search, Redis Cache Provider, CD WebApp
- 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…
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