Jaa


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:

Comments

  • Anonymous
    January 01, 2003
    Could you show how to use API steps? To call and create an pages
  • Anonymous
    December 20, 2013
    Pingback from Windows Azure Pack Blog Post Overview on Building Clouds & TechNet - Building Clouds Blog - Site Home - TechNet Blogs
  • Anonymous
    March 13, 2014
    Throughout this Success with Hybrid Cloud series, I’ve emphasized the importance of linking private and
  • Anonymous
    May 20, 2014
    Pingback from Success with Hybrid Cloud: Getting Deep – Windows Azure Pack | Dot Net RSS
  • Anonymous
    May 20, 2014
    Pingback from Success with Hybrid Cloud: Getting Deep – Windows Azure Pack | Dot Net RSS
  • Anonymous
    August 20, 2014
    When try login with the Windows Azure Pack tenant account, the following error shows up:

    Failed to login to WAP service...No MediaTypeFormatter is available to read an object of type 'User' from content with media type 'text/html'.

    Any idea what is the cause?
  • Anonymous
    December 28, 2014
    原文地址: http://blogs.technet.com/b/privatecloud/archive/2013/11/28/sample-portal-code-based-on-windows