RSS

Azure: On Premises vs IaaS vs PaaS vs SaaS

Azure cloud model is generally divided into two: Infrastructure as a Service (IaaS) and Platform as a Service (PaaS).

The difference is how much you have to manage in each service. The more you have to manage, the more you have to pay.

See this graph below:

azure-on-premises-vs-iaas-vs-paas-vs-saas

 
Leave a comment

Posted by on May 21, 2015 in General

 

Tags: , , , ,

Difference Between Azure Web App and Cloud Service

When I first getting started on Microsoft Azure, I am confused between these two: Azure Web Site and Web Role.

Azure Web Site is one of many Azure services while Web Role is an instance running behind Azure Cloud Service, another service offered by Azure. Since then, Azure Web Site has been changed to Azure Web App.

Basically, the difference is the control you have and portion you have to manage in each service.

Azure Cloud Service, Web Role in this case, gives you more control, but with more control, comes greater responsibility. See this graph below:

difference-between-azure-web-app-and-cloud-service

For detail technical difference, see Feature Comparison on Azure App Service, Cloud Services, and Virtual Machines comparison.

 
Leave a comment

Posted by on May 20, 2015 in General

 

Tags: , , ,

Introduction to Azure Services

Microsoft Azure is evolving universe. Couple years ago, there were only less than 15 services. Today, there are hundreds and Microsoft keeps adding more so expect even more to come.

Generally, the services are divided into the following group. There more than what is listed here, but these are the main groups.

  • Compute
  • Data Management
  • Networking
  • Mobile
  • Messaging and Integration
  • Backup
  • Identity and Access
  • Big Data

See below graph to get some idea which service belongs to which group. Again, these are generally idea, not every service and group are listed here.

introduction-to-azure-services-1

To get more detail on Azure Services and its groups, check out this Azure infographic from Microsoft.

Architecture

Now, what do all these components mean to you as a developer? Each component is a tool and you can use it as a building block to your application, be it a web, mobile or windows application. To give you some ideas, this is what your typical application architecture would look like using Azure Platform.

introduction-to-azure-services-2

Open World

What’s really amazing about Microsoft Azure is Microsoft has opened up Azure for ecosystem other than Microsoft. If you are MEAN stack developer, you can deploy MongoDB, Express, AngularJS and Node.js in Azure. You can even deploy MySQL, write PHP code or spin up Linux virtual machine in Azure. Yes, it’s now Microsoft Azure and not WIndows Azure anymore because it doesn’t just belong to Windows or .Net developers, but all kind of developers.

The Future

Azure is huge and it is the future. If you haven’t got your hand in Azure, roll up your shirt sleeves and get dirty now. And if you care to read more, head out to Introducing Microsoft Azure.

 
Leave a comment

Posted by on May 11, 2015 in General

 

Tags: ,

Add Authentication to MongoDB Database

To prevent un-authorized access to your MongoDB database, you can add security to it by requiring authentication whenever someone tries to connect.

It’s simple, run the mongod with --auth option. the command is:

// To add user
> use admin;
> db.addUser('admin','123456');

// Start mongod with --auth
$ sudo mongod --auth --dbpath /data

// Run mongo and login
$ mongo localhost:27017
> use admin
> db.auth('admin','123456');

// Include login in mongo command
$ mongo localhost:456789/admin -u admin-p 123456

More MongoDB security option: http://docs.mongodb.org/manual/administration/security/

 
Leave a comment

Posted by on May 7, 2015 in General

 

Tags: , , ,

Unit Testing WIF’s ClaimsPrincipalPermission.CheckAccess

WIF 4.5 has ClaimsPrincipalPermission.CheckAccess method, very useful to check user’s authorization. You can use this as method call or attribute.

// Imperative method call
using System.IdentityModel.Services;
public ActionResult Index()
{
    ClaimsPrincipalPermission.CheckAccess("foo", "bar");

    return View();
}

// Attribute
[ClaimsPrincipalPermission(SecurityAction.Demand, Operation="foo", Resource="bar")]
public ActionResult ViewFoobar()
{
    return View();
}

Either way, how do we unit test this? My approach is to first abstract out ClaimsPrincipalPermission and create a new wrapper class that will be injected to the dependent class.

Abstract Out

using System.IdentityModel.Services;

public class ClaimsPrincipalWrapper : IClaimsPrincipalWrapper
{
    public void CheckAccess(string resource, string action)
    {
        ClaimsPrincipalPermission.CheckAccess(resource, action);
    }
}

Dependency Injection

using System.IdentityModel.Services;

public class HomeController : Controller
{
    private readonly IClaimsPrincipalWrapper _ClaimsPrincipalWrapper;

    public HomeController(IClaimsPrincipalWrapper claimsPrincipalWrapper)
    {
        _ClaimsPrincipalWrapper = claimsPrincipalWrapper;
    }

    public ActionResult Index()
    {
        _ClaimsPrincipalWrapper.CheckAccess("foo", "bar");

        return View();
    }
}

Unit Test

[TestMethod]
public void TestIndex()
{
    // Arrange
    var _claimsPrincipal = new Mock<IClaimsPrincipalWrapper>();
    _claimsPrincipal.Setup(m => m.CheckAccess(It.IsAny<string>, It.IsAny<string>));
    var _controller = new HomeController(_claimsPrincipalMock.Object);

    // Act
    var _result = _controller.Index() as ViewResult;

    // Assert
    Assert.IsTrue(_result.View != null);
}
 
Leave a comment

Posted by on May 4, 2015 in General

 

Tags: , , , , , , ,

Visual Studio 2012: Debugging Unit Tests Doesn’t Work

There’s a problem in Visual Studio 2012 where debugging unit tests doesn’t work. This often happens when you enable code coverage.

The solution is fairly simple, un-check any selected test setting file under Test > Test Settings.

This behavior is expected, at least according to Microsoft, they just don’t support debugging for code coverage.

 
Leave a comment

Posted by on May 1, 2015 in General

 

Tags: , ,

Enable SSL in IIS Express

It’s possible, fairly easy too. I am running Visual Studio 2013.

Highlight Web project from your Solution Explorer.

enable-ssl-in-iis-express-1

Under “View” menu, click on “Properties Window” (CTRL + W, P). Then, change “SSL Enabled” property to True

enable-ssl-in-iis-express-2

The first you run the web application, you will be shown a warning message that you run on SSL. Then, Security Warning message to install certificate, just “Yes” it out.

enable-ssl-in-iis-express-3

You can now browse to HTTPS of the web app by clicking on the IIS Express. The port of HTTPS address may be different than non-SSL.

enable-ssl-in-iis-express-4

Your browser may show untrusted SSL certificate. If you prefer trusted SSL certificate, you can generate this yourself. How to Create Valid and Trusted SSL Certificate (Wildcard) for Development.

For configuring IIS-hosted WCF to run on SSL, see Configure IIS-Hosted WCF to Run On SSL.

 
Leave a comment

Posted by on April 30, 2015 in General

 

Tags: , ,

 
Follow

Get every new post delivered to your Inbox.

Join 54 other followers

%d bloggers like this: