In my pursuit to learn different kind of databases I have chosen to learn Neo4j as my first nosql database.

Neo4j is a graph database that allows you to store information in nodes and relationships. Both these entities can have properties attached to them. Together with the sophisticated query language, Cypher, you can do advance queries and analysis of the database.

This database is a good choice when having data that is connected in for example social graphs. It is also good to save spatial data because of the query language that can be used to map routes.

This is a step-by-step instruction to create a Neo4j database in Azure and then use Azure Mobile Services to access it. These instructions presumes some knowledge of Azure already.

1. In the Azure portal, download and register a new Ubuntu Neo4j Image from VM Depot


2. Create a new Virtual Machine from that image

Step 1


Step 2


Step 3


3. Test if it works by opening a browser and go to http://<your name>

If you get a login window, read the text carefully and you see what the credentials are to login.


4. Open an SSH connection to your machine. In Mac, use Terminal, in Windows, use Putty and login.

5. Go to /var/lib/neo4j/plugins

6. Download the following file with this command:

sudo wget

7. Go to /var/lib/neo4j/conf

8. Edit the file and add: (change to your own password and username)



I use sudo pico

8. Go to /var/lib/neo4j and run sudo ./bin/neo4j restart to restart the neo4j server.

9. Test by going to the site again.

Now you should login with the credentials you specified above.

Azure Mobile Service

1. Create a new Azure Mobile Service

2. Create a table called “person

3. Set the Permissions for insert to Everyone

(This is to make it more simple. This should never be used in Production.)

4. Open that table and go to the script menu and do something to the insert script.

Add for example a comment. This is to trigger a creation of the javascript that we will use later.

5. Go to the dashboard page and choose “Set up source control”.

6. Copy the git url. (If you don’t find it, look under the menu Configure.)

7. Open a command window on your development machine and clone the repository:

git clone https://<…><…>.git

8. Still in the command window, go to the directory ./services/table

9. Import the Node module Neo4j:

npm install neo4j

I presume that node.js is already installed on the machine. If not, go to and install it first.

10. Edit the file person.insert.js

function insert(item, user, request)
  var neo4j = require('neo4j');
  var db = new neo4j.GraphDatabase('http://<username>:<password>@<your neo url>');
  var node = db.createNode({name:}); (err, node) {
    if (err)
      console.err('Error saving new node to database:', err);
      console.log('Node saved to database with id:',;


11. In the command window, do:

Git add .
Git commit –m “neo4j”
Git push

12. Done


I use Postman in Google Chrome


Hit send and if it works you can now go to neo4j admin site: http://<your name> and you will find that you node has been saved into the database.