Sample Portal Code based on Windows Azure Pack, Service Provider Foundation and Virtual Machine Manager

Recently we see many customers (including service providers) are looking for samples or best practice guidance on integrating either the existing portal or develop a complete new portal to integrate with Windows Azure Pack (WAP) API to deliver the WAP based out-of-the-box cloud services such as Web Site Clouds, VM Clouds, Service Bus Clouds, SQL Servers, My SQL Servers to its tenants for consuming those services in a subscription based model. Here in this post I am going to explain and deliver a sample portal code (like the one below) developed based on Windows Azure Pack (WAP), Service Provider Foundation (SPF) and Virtual Machine Manager (VMM) of System Center 2012 R2. The sample portal is an ASP.Net, MVC 4, web application which implements WAP APIs for performing some common WAP and Virtual Machine (VM) operations using WAP’s Service Management API.

image 


The Purpose of Sample Portal Code:

While most customers are able to develop their own portal using the published WAP Developer Kit document, we still see many customers asking for sample code that implements specific use cases or scenarios which can be used as an example to refer and extend to real world use case scenarios. Also, there are requirements where customers want to know more details behind implementing the Authentication logic for integrating with Service Management APIs both as Tenant and Administrator. The sample delivered here mainly addresses these two scopes and complements the information that is available in the WAP Developer Kit documentation, so for any latest up-to-date information on the WAP SDK, refer to the product documentation.

 

The Scenarios covered in Sample Portal Code:

The sample portal code covers the following scenarios:

Control Panel or Portal Integration

  1. WAP Authentication for Tenant (uses ASP.NET Membership Provider) and Administrator (uses Windows)
  2. List available Plans for subscription
  3. List Subscriptions for a tenant
  4. List Quota for tenant subscription

VM Cloud Resource Provider (SPF)

  1. List Virtual Machines for a subscription (Tenant)
  2. Perform Virtual Machine operations:
    • Start VM
    • Stop VM
    • Create VM
    • VM Details

 

The Parts of Sample Portal Code:

The sample portal code contains the following two parts or Visual Studio (VS) project in it:

  1. WAPWrapper.csproj - VS project implementing the common Service Management API calls for tenant authentication, subscriptions, VM operations, Cloud operations, and VM template operations
  2. WAPContosoPortal.csproj - VS project implementing the MVC (Model-View-Controller) code to call Service Management APIs through the WAPWrapper library and perform the user requested operations on the portal

For simplicity and from best practices perspective, the Service Management API layer integration is created in the form of a wrapper library which gives flexibility to use the same code across different types of portals such as Tenant and Administrator. Also, in the case of an upgrade in the Service Management API layer, it is enough to modify and build only the wrapper library as opposed modifying and building the complete portal code. Also in the sample code the wrapper library implements both Tenant and Admin related functions, whereas the portal code contains only the Tenant specific operations as it is for Tenant’s use only.

In a nutshell, the custom sample portal when implemented using WAP, SPF and VMM, it looks and connects in the layered order as depicted in the diagram below:

image

 

Some Screenshots of Sample Portal Code:

  • WAP Authentication for Tenant using ASP.NET Membership Provider

image 

  • List available Plans for tenant subscription

image

  • List Subscriptions for a tenant

image 

  • List Quota for a subscription

image

  • List Virtual Machines for a subscription (Tenant)

 image

 

More Information about Sample Portal Code:

The sample portal code contains the following deliverables in it:

  • Documents Folder: Contains the following three documents that describes about the source code, build and deploy the build to web server based on Internet Information Server (IIS).
  • Readme for WAPWrapper sample.docx – This document describes the source code details on the wrapper library (WAPWrapper.csproj) VS project
  • Readme for ContosoCloud sample (WAP version).docx – This document describes the source code details on the sample Contoso Portal (WAPContosoPortal.csproj) VS project
  • Readme for Deploying ContosoCloud sample (WAP version).docx – This document describes the deployment details on the sample Contoso Portal
  • Source Folder: Contains the following two folders for the source code
  • WAPWrapper – This folder contains the source code for the wrapper library (WAPWrapper.csproj) VS project
  • WAPSamplePortal – This folder contains the source code for the sample Contoso Portal (WAPContosoPortal.csproj) VS project
  • Download Location: You can download the documents and source files from the following TechNet Gallery site.

 BC-DLButton

Additional References: