Category Archives: Azure

Using Microsoft Machine Learning Studio in Azure

Machine learning is one of the fields that having growing popularity from past decades probably had been there for long time as a different term which might be “data mining”. Microsoft ML studio in azure is quite easy to use and relatively cheap to use even in big projects.

What is Machine Learning?

According to Wikipedia Machine learning is the subfield of computer science that “gives computers the ability to learn without being explicitly programmed” (Arthur Samuel, 1959).

However I like to simply describe it as finds pattern in data and use those patterns to predict future!. E.g. Assume you had sample data set which contains income of particular individuals with some other various attributes about themselves such as social status, occupation, geographical are, age etc. Based on those sample data we can predict income of a individual given the other data attributes about that individual except income.

Using Microsoft Azure Machine Learning Studio without zero programming!

One cool thing about Azure ML studio is You can run lot of machine learning projects with zero programming (Rather than using R or Python scripts). Although it support Python and R scripts if necessary in some scenarios but most common decision tree algorithms can run with zero programming!

A Sample case study in Microsoft Azure Machine learning Studio for Heart Disease Prediction.

There is a sample machine learning project that you can run in machine learning studio. Based on previous clinical diagnostic data of heart disease patients you can predict presence of heart disease in a person Cortana gallery contains the sample in here. To run this project in your azure environment you can do following.

Log into Microsoft machine learning studio


Navigate to and click open in studio as shown below.


Project will be opened in Microsoft ML studio you can inspect how the workflow has been built and run the workflow


You can visualize scored model for positive and negative predictions(heart disease presence or absence in this case) with their underlying scored probability in scored


Leave a comment

Posted by on January 8, 2017 in Azure, Machine Learning


Tags: , ,

Configuring Redis Session State Provider With Azure

Redis is an open source (BSD licensed), in-memory data structure store, used as database, cache and message broker. Even though it has been originally developed for POSIX systems it can be easily configured to store session data in .NET with the aid of couple of nugget packages and using windows port that can be downloaded from

One particular need you might need to store session external to webserver itself is when you have a web farm/multiple webservers with an authenticated user where subsequent requests would be redirected to different servers for example via a load balancer. Traditionally this can be solved easily with session store providers but using Redis for this can be fast and easier if you have your host system in Azure which was in my case.

To test the implementation locally for development you could do following,

  1. Download Redis port for windows from Note: it is not available in site.redis windows port extract
  2. 2. Starting local Redis server is very easier as indicated below.

redis server

It will start the Redis server and note the connection details. You can change these by changing redis.conf file which is documented in the site.


redis server start

3. You can use various commands specified in the project site’s documentation e.g. to view session keys use command below. (not to worry on hacking my servers these are my DEV ENV values )

redis keys

4. Then you have to do install redis session state provider nugget package from to your project.

5. One caveat here is to support “sliding expiration” for session state you need to make sure you install package version >=1.5.0. Sliding expiration is typically a must in session state management. Current version at the time of writing is 1.6.5 so make sure you install the latest.

6. To install RedisSessionStateProvider, run the following command in theNuget Package Manager Console of Visual Studio.

PM> Install-Package Microsoft.Web.RedisSessionStateProvider -Version {latest version number here}

7. Then all you have to do is add following configuration section in your web.config and change values accordingly.

session state config

8. After you have successfully tested it in your development environment you might need to configure Redis in windows Azure. Creating Redis Cache in Azure is super easy as shown below. At the time of writing it will be only supported in new Azure portal found in Old portals does not support Azure Redis Cache.

azure redis create

azure redis create 2

9. Choose appropriate pricing tear depending your data load.

azure redis pricing

10. It will take a while to create the Redis cache. It sometimes takes more than 10 minutes to up and gets running.

redis cache creating

11. After you create Redis cache you need to configure cryptographic key and connection details for the nuget package. Selecting created Redis cache will show the access keys as below.

redis session config cryptographic keys

12. Then all you need to do is enter Access key and host name of azure redis server to the web.config. Notice how the connection details being entered, its quite different than we used earlier for local Redis server. Also note that host name given by Microsoft is always ends suffixed with So your full host name should look like This will essentially point your session store to Azure Redis cache.

redis session config values

Note: Redis desktop manager can be used to manage Redis DB if you prefer GUI interface which can be download at

redis desktop manager

Leave a comment

Posted by on October 20, 2015 in .NET, ASP.NET, ASP.NET MVC, Azure, C#


Tags: , , , , ,

PowerShell Script to Add Current IP Address to Azure FireWall Rules

When you are connecting to Azure databases it is necessary to add current public IP address to the Azure firewall rules to white list your public IP. This can be done via azure management portal but this might be annoying at sometimes especially when you’re IP changes with router restarts where you are not under a static public IP. The other drawback is automatic firewall rule generated via portal is the firewall rule names will clutter up in firewall rules table and you should remember to clean these unnecessary IP addresses to avoid not only to remove unnecessary IPs but to avoid security risks with public ISP provided dynamic IPs from the pool.

You could automate this by relatively easily by using PowerShell script as described below. In order for it to run you should import azure publish settings profile. Script uses certificate based authentication that can easily be achieved by importing publish settings profile. Note: this should be done in your azure management computer so after importing publish settings to your management machine’s certificate store, you can issue powershell azure cmdlets without explicitly needing to enter Azure credentials.

1. Run Windows PowerShell as an administrator as follows:
Choose Start, in the Search box, type Windows Powershell then Right-click the Windows PowerShell link, and then choose Run as administrator.

2. At the Windows PowerShell command prompt, type Get-AzurePublishSettingsFile and then press Enter.
3. Web browser opens with azure management portal and log in to it and follow instructions to download publish profile.
4. Once you have downloaded publish profile, import the publish profile by entering following command in Powershell command prompt.
Import-AzurePublishSettingsFile ‘{pathtopublishsettingsfile}’

5. If no error fired up then entering Get-AzureSubscription in powershell should show current subscription(s).


6. Once you have done that you can run the following PowerShell script by changing variables to appropriate values as shown below. You can save this to “ps1” type file(powershell script file) and execute the script through power shell when necessary or even better “PS2EXE” method as described below.

  • $subscriptionName – Get the subscription name from “Subscription Name” field got from above step 5
  • $firewallRule – Fire wall rule name which is something descriptive to you eg. Dimuthu-Home
  • $serverName – Your server name

Note : Full script can be downloaded at here...

$subscriptionName = 'Your Subscription Name'
$ipGetCommand = ''
$firewallRule = 'Dimuthu-Home'
$serverName = "Your Azure Server Instance Name";
$webclient = New-Object System.Net.WebClient
$queryResult = $webclient.DownloadString($ipGetCommand)
$queryResult -match '\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b'
$currentPublicIp = $($matches[0])

Select-AzureSubscription -SubscriptionName $subscriptionName

If ((Get-AzureSqlDatabaseServerFirewallRule -ServerName $serverName -RuleName $firewallRule) -eq $null) {
    New-AzureSqlDatabaseServerFirewallRule -ServerName $serverName -RuleName $firewallRule -StartIpAddress $currentPublicIp -EndIpAddress $currentPublicIp
else {
    Set-AzureSqlDatabaseServerFirewallRule -ServerName $serverName -RuleName $firewallRule -StartIpAddress $currentPublicIp -EndIpAddress $currentPublicIp

7. I have saved this script to “azure-ipenable.ps1” for demo purpose and executed it through PowerShell as shown below. This will create firewall rule with given name i.e. “Dimuthu-Home” if it does not exist or will update the IP address if the firewall rule does exist. This is especially useful when router resets or your dynamic public IP address changes.


Running PS1 Script More Easily By Converting to EXE

To make life more easier when after you change subscription details to appropriate values you could convert it to exe.

First download the PS2EXE utility and follow instructions!
Following is the command I used to convert PS script to exe…

This will generate .NET executable that will do the job more easily…:-)

ps2exe output

Leave a comment

Posted by on September 16, 2015 in Automation, Azure, Powershell


Tags: , ,

Azure CDN Limitations for using SSL with custom domains

Content delivery networks or content distribution networks (CDN) are great systems to have if you need to add extra bit of fuel towards application’s high performance and towards having high availability. In essence there are number of benefits to have a CDN, they have been discussed elsewhere a lot in the internet. What I am going to talk about is one serious limitation you must be aware of about Windows Azure CDN. There are number of other cloud CDN providers available which overcome this but here focus is on Windows Azure.

However if you already have your web applications deployed in windows azure your preferred choice is windows azure itself. At the time of writing new portal( does not have azure CDN functionality added you need to use regular management console ( for this.. If you go to CDN nodes on left in Azure management console you would find existing CDNs you have created or allows you to create new. Creating and configuring CDN has been relatively so easy with Azure portal.


You can map new CDNs you create with your storage accounts or cloud services or with custom origins (this is also another serious limitation azure has cut off recently as of writing this described here). Finally you will get CDN URls with something like this where hashes replaced with numbers…, “” If you don’t like to use these ugly Urls You could easily map this with your custom domain/subdomain easily. No issue so far.

What is the Limitation then?

SSL support for CDN is mostly a must for many public websites these days mainly to prevent private data sniffing and to prevent man in the middle attacks.

So for these SSL enabled public web pages you need to have your CDN with https support. Having regular http CDN URLs in SSL enabled web pages would give browser warnings varyingly by different browser vendors. Using protocol relative urls ( will not help for Azure CDN in this case.

At the time of writing Azure CDN does support https as shown below but the issue is it not usable with your custom domains!. azure https Instead you must use Microsoft provided CDN urls which are starting like this “”…. This might be ok or not depending your business requirements but we should keep this in mind in advance.

This will hopefully be fixed by Microsoft in near future. Please do vote at here if you find this feature is useful like I did.

You must use like Urls these subdomains are automatically get signed with Microsoft provided certificates. You don’t need to sign certificates additionally.

Issue is this prevents using Azure CDN with https support for your custom domain.

Leave a comment

Posted by on July 21, 2015 in Azure


Tags: , ,

Full Text Search Now Supported in SQL Azure PaaS Databases

It is really cool know that now that SQL Azure PaaS databases supports full text indexes which was earlier not. SQL azure PasS has serious limitations where some of the features that are supported in normal SQL server enterprise versions do not available.

One such feature was SQL server’s full text indexing. Alternative newly introduced features like “Azure Search” are arguably more preferred for newer implementations but however recently Microsoft has announced that full text search is available for SQL Azure PaaS databases. Detailed information on that is available in this link

Limitations on SQL azure PaaS databases are available on this link…

1 Comment

Posted by on May 5, 2015 in Azure, MS SQL Server, SQL, SQL Azure


Tags: , , ,

Using Azure traffic manager with apex/root domains

If you configure Windows Azure’s traffic manager to implement web servers with high availability scenarios, when they are distributed in different geo datacenters, scaling out scenarios in a fail over or more commonly distributing traffic across multiple web servers then in my experience that it would do a really fantastic job on solving the issue with relatively easy configuration.

However one serious limitation with Windows Azure traffic manager is its public endpoint does not have static IP address although it has static DNS name which is something like “”. Everybody knows that this would be utterly no problem at all if you have one public facing endpoint IP. Issue becomes overwhelming especially if your site has to support root domain with traffic manager (a.k.a naked domains or root domain).

Here is why… Let’s say you have a website “”. If user enters following you need to point your users to your hosted web server or traffic manager endpoint (“”).


When you configure DNS for your site you might need to enter “A” record for your root domain (“”) and in the IP address you need to enter your webserver’s public IP address. If you manage large CMS this is unavoidable since occasionally some customers prefer root domain over “www”. Here initial subdomain name can arbitrarily be selected in Windows azure traffic manager unless it is not already being taken by someone else. So it ends up something like “”. Issue here is Azure’s traffic manager does not have static IP address. Since Traffic Manager works at the DNS level, not the IP level, there is no such thing as an IP address for a Traffic Manager endpoint. Your traffic does not transit through Traffic Manager. But for you can easily solve by adding CNAME entry for name “www” and giving “” for pointer location since CNAME entries do accept FQDNs.

But still “” issue remains since CNAME entries do not allow to take root domains and “A” records only accepts public facing IP addresses, it appears to be hardly solvable but luckily there is solution for it. It appears some DNS providers these days’ supports aliases. So what are aliases in DNS? An ALIAS record is a virtual record type that created to provide CNAME-like behavior on apex domains. What does this means is you can create apex or root domain entries that points to whatever DNS names you have like in this case Windows Azure traffic manager end point’s DNS name.

One that I found to support this is one additional benefit with it is it has built in support to Windows azure websites. When it comes to domain name verifying etc. process of adding “awverify.yourdomainname” is super easy, they have built in support for Windows Azure. Sadly I had to switch from old DNS which didn’t support it. At the time of writing only some of the DNS providers support this. Note: This is not to be confused with domain name registrars.

Leave a comment

Posted by on March 31, 2015 in Azure


Tags: , , , ,