20 05 2016
Deploy a three-server SharePoint 2013 Farm on Azure in few minutes
Few years ago all of us dreamed with the automated creation and configuration of a SharePoint environment in kind of silent mode. Microsoft shares the PowerShell scripts and it’s matter of adapt them to your needs.
With Azure, we saw the wizards in the Azure portal and we could create using some VM using templates. Not bad but still far from the sweet dream. Finally, with the Azure Resource Manager, the dream comes true. ☺
Introduction: Azure Deployment models
As we know, we have to live still with two versions of Azure (and that is not just the portal we also have two models) the classical portal and the brand new one. Why have we two live portals? Because we have some services just run on the old one, and we need a smooth transition to the new one.
The Classic portal was using the Service Management Model and the new portal always use the Azure Resource Manager Model. (For further info, click Classic model vs new model)
Let’s focus on the new model and some of the remarkable benefits.
Azure Resource Manager (For further info, click overview)
This model has several benefits but I would like to highlight the most important ones for our topic:
You can use declarative templates to define your deployment.
Using PowerShell DSC. It’s no longer matter of execution of long scripts like so far, it’s about declaratively define the state of the machine that you want and execute it as many times as you want
- PowerShell DSC Extension is one of the best Microsoft approach for “infrastructure as code” paradigm. If you didn’t hear about it, I’m sure you will.
You can define dependencies between resources
- Let’s have a look to our SharePoint environment example: we need to have an AD service before configure SharePoint Server, and before that you will need your SQL Server install also. No problem, define your dependencies J
What’s the point, I want to create my SharePoint environment now!
If we have a look to the new portal we will find our SharePoint templates on the azure marketplace.
These templates are validated and published by Microsoft. From the portal, you can create the SharePoint Environment from the UI. There is a good starting point but you just can select few options.
If you want to understand where these two templates come from and what implements, read the official article Create SharePoint Server farms
Said that, let’s focus on the SharePoint 2013 non-HA Farm (non-High-Availability) farm with 3 servers:
The official template allows us to define values for some parameters (which is good but not enough). For instance, it uses always machines with Premium Storage. Definitely, the template has a lot of fixed parameters that you would like to change.
Here the trick comes
Idea: What if I dig into the template and try to update it
First thing to know: All official templates are published on GitHub.
Here you can find the SharePoint 2013 non-HA.
I forked the code into my account and I have modified the parameters that I needed.
Once I was on my account, I click the json file with all the parameters (azuredeploy.json)
And I clicked on edit for update some values.
Mainly, the size of my attached extra drives (by default 1000GB, too much for my taste) and the VM types (by default, DS with premium, Why premium if I want to create a PoC)
Once I finished with my changes I committed the code in my fork
Finally, I got the raw URL of my json file. Save this URL, we are going to use it later on.
Now we have to open our Azure PowerShell and create the environment using our template with the following commandlets
NOTE: First of all, you need to setup your PowerShell environment with the right version of Azure PowerShell (For the details, click here)
New–AzureResourceGroup –Name $RGName –Location $locName
New–AzureResourceGroupDeployment –Name $deployName –ResourceGroupName $RGName –TemplateUri $templateURI
The configuration takes a while, around 1h. DSC has to do all the setup behind the scenes among all the 3 machines J
Note: There is a way on the Azure portal where you can see the configuration progress.
àOn the Azure portal, Click on the Resource Group that the PowerShell has created (that should take just few seconds) and click on Settings àDeployments
Once the “updating” message disappears of all the VM, it should be completed. Go to the SharePoint machine, browse the 80 port and voilà!
Azure deployments References
Why does it take 1h?
If you want to know what are the dependences in the template, you can have a look graphically. From the GitHub template page (click here) go to the bottom and click “Visualize”.
Here you can see why it takes around 1h to execute all these dependencies. But it’s much better that setup the environment manually, don’t you think?
Of course, that doesn’t stop here, you can create your custom Template with your topology and just use it on Azure J
Automate as much as you can!
Enjoy! Don’t hesitate to leave a comment!