Monday, May 30, 2016

ARM template for LAP (Linux + Apache + Php) and Neo4j Deployment

Just finished writing my first ARM template that can deploy a set of VMs, where in one VM has an Apache and php installed with a sample website, and another VM with an installation of Neo4j which is accessible only to the first VM on a private port. The Sample website in the Apache node can echo out a message if it could get connected successfully.
The repo is yet to be merged with the Azure repo, but for now one can find it here


Friday, April 22, 2016

Hygiener- IOT Hack

Last week had the chance to participate in a hack with fellow Microsoft’ians at an internal hack event. Our team had four participants – Manish Sharma, Deepthi Anatharaman, Shubham Kumar and yours truly. The hack was around the concepts of  IOT, Azure IOT Hub, Azure Machine learning, Power BI and Azure Data factory.
Our topic was ‘Hygiener’ – A product that aims at finding the hygiene index of a workplace by placing sensors at Doors and on the Disinfectant bottles, Sensors send information about how many times the door was operated to get inside/outside the workplace/Washrooms/Hospital Wards, and how many times the dis-infectant bottle may have been used by finding if a person’s hands were too near the bottle. The data is sent to Azure IOT Hub, where the stream analytics Jobs make sense of data and sends it over to SQL from where the Power BI Reporting could show views over this data. Additionally the raw data is dumped in Azure Data lake for further analytics. A Machine learning implementation on top of the same data can reveal interesting insights like predictive Hygiene Index, or if one can gather the relative attendance in the workplace, Machine learning models can also suggest how attendance will fares against the hygiene index of the workplace.


Thursday, March 31, 2016

Bash! on Windows !!!!

Imagine yourself as someone who went in coma say in 2010 and woke up this morning, not much would have changed for you, there are mobile phones, drones (that’s new) and a couple other stuff that your mind would adjust too. You open your laptop and see the first technews as something like this – Bash comes on Windows !

What ! that’s impossible, Last time you checked these were 2 different worlds; the only exceptions were a minix console or a cygwin implementation, or install a full linux VM for yourself and if you are on ubuntu you can opt for the hideous Wine to get yourself flavor of MS Office.

Some of us, who really believe it’s a very difficult thing to do, considering the underlying structures are just too different to be able to just map, its another thing to map a DIR command to LS but its a different ballgame to map devices to file structures.

Note - The implementation is as official as it gets, MS has implemented it with Canonical as partner.

Well here are a few things to expect before it actually comes in our hands.
  • Its not a Virtual Machine running in Windows.
  • All linux tools – awk, sed, grep, vi, vim, emacs e.t.c will run as they run on Linux
  • Yes, APT-GET will work the way it works with Windows
  • You’ll be able to run tools like Redis and Memcache on your windows machine, and use them with your asp .net and .net apps
  • Manage your filesystem from Bash itself, its much easier to control from my POV.
I am not too sure if we’ll be able to manage the users of the system from here itself, but optimistic that it better does and run the windows in headless mode like a linux box and offcourse SSH in it Smile
Follow me on twitter at @brijrajsingh for more updates over the same.

Thursday, December 24, 2015

Installing PHPMyAdmin for Azure WebApp using Site Control Manager (Kudu)

This tutorial shows you how to setup a PHPMyAdmin site in an Azure WebApp using Site Control Manager (KUDU Console)
When you are done with this tutorial, you’ll have a PHPMyAdmin site setup along with your Azure WebApp and connected with your MySql deployment (ClearDB as well as VM based MySQL).
Most PHP Developers are accustomed to use PHPMyAdmin tool to manage their MySQL workloads, for reasons like A-it comes in very handy and you can practically do everything related to your mysql databases right from within this web based console.
PHPMyAdmin can be downloaded from , but soon as the developers start working with the Azure WebApps they get confused as to if they should install their web app code or the phpmyadmin, or should phpmyadmin be a separate website altogether?
Well !  Azure has an answer – and that is – PHPMyAdmin is an extension and the extensions can live separate from your website code, and for installing an extension as mundane as PHPMyAdmin you don’t need to download or upload anything because Azure understands that its quite a very genuine thing to ask for when you are running a PHP + MySQL workload.
The installation of extensions such as PHPMyAdmin can be done using Site Control Manager (Kudu), SCM or Kudu is a dashboard application that is available for all your Azure Web Apps, to browse this dashboard just browse to https://{sitename} (that is add scm in front of your website name), you’ll be asked for credentials and those will be the same as your deployment credentials. If you haven’t setup your deployment credentials then take a look at this article and see how to .

Setting up PHPMyAdmin extension using SCM (Kudu)

1. Browse to the Site Control Manager (Kudu) for your web app – https://{sitename}  

2. Click “Site Extensions” -> then Click on “Gallery” , Search for ‘PHPMyAdmin’

3. Click on the “PLUS” Sign and it’ll do an install for you, then click on “Restart Site” Button at the top Right.
4. By now the PHPMyAdmin is installed and the site has been restarted.

Configuring the PHPMyAdmin to connect with MySQL

1. In the Kudu Console, Click on “Debug Console” à CMD

2. Click on Folder “Site Extensions” , then click on Folder “PhpMyAdmin” – the presence of this folder confirms that the phpmyadmin is indeed installed.
3. Scroll down the folder/file listing and find the file “” – Click on the “Edit” Button with the “Pencil” Sign.

4. This should open and Edit Window, Find the section with configuration for     $cfg['Servers'][$i]['host'] and $cfg['Servers'][$i]['AllowNoPassword'], set the “host” as the IP address of your MySQL installation (Put it as Localhost if the MySQL is in the same machine), and set AllowNoPassword to False, and Hit Save.

5. Go Back to “Site Extensions” and Click the button “Restart Site” on top Right.
6. Once the Site is Restarted browse to https://{sitename} , and Login using the “Username” of your MySQL Server and its password, and Voila! You have your PHPMyAdmin site working for you.

Interesting reads

Monday, December 21, 2015

Setting up a Custom Wordpress Website using Azure Web Apps with a Custom VM based MySql and Installing Plugins

This tutorial shows you how to setup a very simple Wordpress website using Azure WebApps with Custom Mysql DB Installation and Installation of plugins. This tutorial showcases the scenario where you don’t have a managed Azure MySql setup (via ClearDb), rather you are running your own MySql in a VM.
When you are done with the tutorial you will have a running Wordpress website using Azure WebApps (PAAS based Webapp offering by Microsoft), and you’ll know how to install plugins in your WebApp based Wordpress installation.
If you want to have a Managed MySQL Installation you may follow the steps given here  

You’ll learn

  1. How to make a blank WebApp
  2. Upload your local wordpress installation with config changed to link with the MySQL
  3. Installing plugins with your wordpress installation

I am assuming you have a running MySql on your Azure Virtual Machine.

Download Wordpress

First off, we need to get a copy of Wordpress from , download, unzip and keep it.

Create a Blank Azure Web App

  1. Go to Azure Portal at
  2. Go to New – Web+Mobile – Web App

  3. Enter the name of your Wordpress Web App, select a Resource Group, and proper App Service Plan.
  4. Click on “Create”, this will create a Blank Web App for you that you can browse to and you should see a view like this.

Uploading the code at our Web App

  1. Download the publish profile so we could get the FTP endpoints at which we should upload our code
Click over your Web App in resources and then Click over “Get Publish Profile” button
This should download a .publishsettings file
  1. Open the Publish Settings file and note that it’s a XML File, copy the tags publishUrl, username and userPWD, these are our FTP endpoints at which we will upload the basic WordPress website and later configure.
  2. Use any FTP Client and these endpoints that we just collected and open your FTP endpoint, and copy over the Wordpress code that we downloaded from to the site/wwwroot folder

Running setup of Wordpress

  1. I assume that you have a running MySql VM and you know its username and password.
  2. Open the Web App page at
  3. Select Language 

       4. Click “Continue”, the next page will show you the Database settings page where in you should be filling the details about the MySql login that you have already setup at your other VM, make sure that you use internal IP of your MySql VM, you may have to create the Blank Wordpress database in Advance.

   5. Once the Wordpress setup confirms your MySql Credentials, we can now start the Install.

    6. On the Next Page, fill in your site title, UserName and Password (You’ll need those to administer your wordpress website), and Click “Install Wordpress”

   7. Bang on! right after, you’d see a page that’ll ask you to login, login with the credentials you have just set, and you’ll be taken to your hot new Wordpress WebApp

Installing Plugins

Installing plugins becomes much easier with an Azure Web App as it comes with a default FTP endpoint so unlike other custom installations you don’t need to add FTP details to download and install a Plugin.
Just go to Plugins -> Add New and Select any plugin you want to install, I selected a plugin “Multiple themes” (You can search for your plugins) and clicked Install and Voila! It just downloads and installs.

If your setup has Continuous Deployment By FTP or Git or TFS, you can actually just work the same way as you were used to, you can even upload the plugins to FTP directly and it should just work for you.

Monday, December 7, 2015

Container Apps on Azure

If you are a fan of Containers (Docker especially) like me, Azure is making sure that it has the same love as you and me.


Apart from initiatives like CoreOS (which I believe is the best that could've happened to Azure from the containerization stand-point), Container apps are one more way to start with a Dockerized app pre-installed with a VM the moment you start with it.



Lets see how to make and use a container app, but before we do that I need you to learn about Azure Resource Manager Templates, do take some time out if you really want to understand the story of how it works ? Here are a few links to start you with Azure Resource Manager or ARM Templates as they popularly call it


Even if you don't know about ARM, don't get intimidated with the concept and a big repo, its just a template format by which you can deploy multiple resources (VM's, databases e.t.c) in one go, that's it, with a lots of bells and whistles when you actually get to know the entire concept.


I would start with creating a Containerized VM which has got a MongoDB running in Docker inside it


  1. Go to and click on 'New', and select 'Container App', Select 'MongoDB'

  1. In the next window, click on 'Create' - which will prompt you for settings to create a new virtual Machine, Selecting the VM size, Settings related to storage account and Network and Finally a review Summary

Click create in Review summary, and a VM will start deploying.

  1. This VM as you see can be accessed by a public port using ssh, what's great about this VM is it comes with a pre-installed Docker , and a Dockerized running MongoDB Image.

               4. Lets now SSH into this VM (using the public IP Address) and see if we have a running mongo docker image in it

  1. Voila! We have a running mongo that you can connect with, but since you have the mongo running inside docker and you don't have a client on your azure machine, you won't be able to do a command like mongo unless you install the mongodb client using the command

# apt-get install mongodb-clients

You can't possibly ssh into this docker image because the only open port is 27107 so install your client and go ahead connect with it like

# mongo localhost -p 27017

Awesome! Now you have a Dockerized Mongo running inside your VM.

What if you want to boot up with a rather complex container system which contains more than one container images, like you want nginx and mongo both installed in one go, the templates that you see in container apps are actually one platform in a container getting deployed at the server, if you want a rather complex one you need to create your own customized deployment; That we'll cover in our next blog post. 

Wednesday, December 2, 2015

Neo4j - The Nature Way to persist data - At Future Unleashed

Very recently had the pleasure of giving a session over Neo4J at Future Unleashed, 2015 as a part of OSS (Open Source Solutions) track.

I discussed very basics of Graphs, and how RDBMS's dominated the space of Databases for 2 long decades until the NOSQL breakout happened.

Showcase was around Neo4J - The Natural way to persist data, With a number of examples I showcased how it makes perfect sense to store the relational data in form of  graphs rather than the Relational Databases, just because it doesn't sound natural as the relations in RDBMS's are not natural in one go anyways, things like traversal of relationships are not possible and you'd always need a work around for such situations.

Not that RDBMS are all crap but that Graph Databases like Neo4J are like that Needle you need when it won't work with the sword.
All of our Demos and PPT are available at Github, so do feel free to download and play with

A specific demo that I showcased was around Game of thrones, I made a small database of Game of thrones characters, basically by scrapping from different wiki sites and all using python module beautifulsoup, I included columns like Name, House, IsDead, IsCaptured, IsHurt, title, and Prefix.

PS - The information may not be absolutely correct
We all know Jon Snow isn't Dead Yet, Or at least we don't want him dead, even if he is.

This is how that csv looks like, by the name characters.csv, I can generate different nodes from this csv, you may use

There is another csv of relations by the name of characters_relations2.csv this is how it looks like

I used another python file to generate the relations between the two nodes
All these nodes and relationships are also dumped in the file GOT_Query.txt
Once we are done making these relations and everything, this is how our final GOT tree would look like

You can then do some really interesting queries like
Finding relationship between Arya stark and Margaery Tyrell

MATCH (arya:Person { name:"Arya Stark" }),(marg:Person { name:"Margaery Tyrell" }),
  p = shortestPath((arya)-[*]-(marg))

At the end, we had the pleasure of discussing with audience how to scale the Neo4J instances, particular use cases for Graph databases and Managed hosting options for Neo4J available at Azure like Graphene DB.