...building hybrid clouds that can support any device from anywhere
Hello readers, Victor Arzate here. I'm a Program Manager in the Windows Server and System Center CAT team and in this post I will walk you through the different steps required to deploy the Hello World custom Resource Provider sample that is included in the Windows Azure Pack Developers Kit. The purpose of this blog is to explain one of the methods used to extend Windows Azure Pack (WAP) by way of example. In this post I'll show how to deploy the Windows Azure Pack example resource provider 'Hello World'. One could develop their own resource provider and in this blog post I'll show all the basic steps to get the 'Hello World' example by way of the process and steps I used. In future blog posts, we will blog about how to extend the Hello World sample, and even how you can create your own Resource Provider taking the Hello World sample as a starting point.
Warning dear readers! – This blog post includes the following terms: Visual Studio and Compile –
Disclaimer – There's a known issue when you deploy the Hello World Custom Resource Provider that is included in the WAP Service Management API Samples for December 2013, where you won't be able to see the PowerShell code for the SMA Runbooks using the WAP Admin Portal. Please note that the SMA Runbooks are there, and you'll be able to start/stop them, but the code won't be visible. This issue is specific to the Hello World sample, and does not apply to other WAP custom extensions you may create. If you uninstall the Hello World Custom Resource Provider, you will be able to see the PowerShell code for the SMA Runbooks again. Hence I recommend to use this blog post to test/evaluate the Hello World sample and custom resource providers in a testing environment. If you're working quite heavily with SMA you may not want to import this custom resource provider until a fix is released.
You may ask, what are Resource Providers in Windows Azure Pack (WAP)? In a nutshell, the cloud services that Windows Azure Pack provides are represented by Resource Providers. For example, by now you may have already deployed Windows Azure Pack and you noticed that it includes the Web Site Clouds, VM Clouds, Service Bus, SQL Servers and MySQL Servers Resource Providers. Obviously you can choose which services to offer to your tenants (for example, VM Clouds only), but what if the services you'd like to offer to your tenant are not available in the Resource Providers included in WAP? For example, what if you'd like to offer your tenants the option that they can back up their own Virtual Machines?
As described in the Custom Resource Provider Overview documentation in MSDN, a Resource Provider can provide services on its own, or it can act as a proxy to an existing external system. This means that you could include the functionality required in the custom Resource Provider, or you could use the custom Resource Provider to proxy the user and administrators requests to an external system (for example, System Center Orchestrator).
The Hello World custom Resource Provider sample is a great starting point when you want to offer additional functionality in WAP that is not currently provided in the out-of-the-box Resource Providers (such as VM Clouds and SQL Servers) and you want to use the default portals provided by WAP. For example, the Hello World Custom Resource Provider simulates the capabilities to allow tenants to create new file shares in the file servers defined by the administrator (this capability is not provided in the out-of-the-box Resource Providers).
You can learn more about the Hello World sample here and also, you can learn more about custom resource providers here.
Note that you can find generic guidance in MSDN and in the read me files included within the Hello World sample on how deploy it. In this blog post I'll give you the detailed steps with examples J
You will find these assemblies in the server where WAP is installed (for example, you can find them in the following folder: C:\inetpub\MgmtSvc-AdminSite\bin).
Note – Before executing the next step, confirm that Visual Studio 2012 and that the Windows Installer XML (WiX) toolset 3.6.3303.0 are installed in the same machine.
C:\Projects\HelloWorld\Setup\Microsoft.WindowsAzurePack.Samples.HelloWorld.Setup.wixproj : error : The project file could not be loaded. Could not find file 'C:\Projects\HelloWorld\Setup\Microsoft.WindowsAzurePack.Samples.HelloWorld.Setup.wixproj'. C:\Projects\HelloWorld\Setup\Microsoft.WindowsAzurePack.Samples.HelloWorld.Setup.wixproj
In Solution Explorer locate the Microsoft.WindowsAzurePack.Samples.HelloWorld.Setup project and you will notice that it has a blue exclamation mark.
Once the project is reloaded, it will should correctly in the Solution Explorer
NewtonSoft.json is a NuGet package which normally is installed and resolved using the following NuGet command: Install-Package NewtonSoft.json. We have to execute this command for each of the projects where the NewtonSoft.json reference is not properly resolved. For this, go to the Tools Menu – Library Package Manager – Package Manager Console:
This will open the Package Manager Console:
In the Package Manager Console, in Default project select the project where the NewtonSoft.Json reference is not properly resolved (for example, Microsoft.WindowsAzurePack.Samples), and type the following command in the Package Manager Console: Install-Package NewtonSoft.json
You will receive an output similar to this to indicate that the Newtonsoft.Json reference was installed and added successfully:
Installing 'Newtonsoft.Json 5.0.8'.
Successfully installed 'Newtonsoft.Json 5.0.8'.
Adding 'Newtonsoft.Json 5.0.8' to Microsoft.WindowsAzurePack.Samples.
Successfully added 'Newtonsoft.Json 5.0.8' to Microsoft.WindowsAzurePack.Samples.
And also you will notice that the reference in the project is now properly resolved.
Repeat this procedure for the Microsoft.WindowsAzurePack.Samples.HelloWorld.Api and the Microsoft.WindowsAzurePack.Samples.HelloWorld.ApiClient projects making sure that the Newtonsoft.Json reference is properly resolved:
<!-- Following credentials are used for basic auth for hello world resource provider. Its shown like this for this sample only.
Its always recommended not to store credentials in plain text in web.config.
Encrypt the credentials or config file -->
========== Build: 7 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
In this section we will install the Hello World custom Resource Provider in the WAP server, and then we will register it with the Service Management API using the PowerShell script provided in the kit.
.\ Microsoft.WAP.Samples.HelloWorld\Setup\PowerShell folder to your WAP server and open it with the PowerShell ISE.
Save the script and close the Windows PowerShell ISE.
Note: Make sure that the credentials specified in the Web.config file (step 1.9 from this blog post) are the same as the ones specified in the Register-ResourceProvider.ps1 script.
That's it – the Hello World sample is now deployed in your WAP environment. Now let's take a few steps so that you explore this sample resource provider, and also, make it available to your tenants.
You will notice that the Register your Hello World REST endpoint option is grayed out, this indicates that the Resource Provider extension has been successfully registered. Navigate through the different options (File Servers, Products, Settings and Controls) to get an overview of this sample resource provider.
Now we want to give our tenants access to this resource provider. Let's assume that you already have a plan and you just need to add this custom resource provider to that plan.
Note that the Microsoft.WAP.Samples.HelloWorld.Setup.msi installer we generated when building the Hello World solution in Visual Studio, installs, updates, or removes the Hello World Custom Provider including the client-side and server-side management portal for administrators and the management portal for tenants. Hence you can use the installer when you've a new version of your solution, or when you want to uninstall a previously deployed extension:
Also note that you can use the Register-ResourceProvider.ps1 script in case you need to re-register the Resource Provider, as the script first checks if there is already an existing Resource Provider with the name provided using the Get-MgmtSvcResourceProviderConfiguration cmdlet. In case it exists, it will remove it using the Remove-MgmtSvcResourceProviderConfiguration cmdlet and then it will create and add the new Resource Provider using the New-MgmtSvcResourceProviderConfiguration and Add-MgmtSvcResourceProviderConfiguration cmdlets.
This is just the tip of the iceberg, but this will give you a quick start into another extensibility option available in the Windows Azure Pack.
Please let us know if you've any specific scenarios/functionality that is not covered by the out-of-the-box Resource Providers in WAP and that could be provided via a custom Resource Provider (either creating a new one or extending the Hello World sample).
Until next time!
Can I add multiple standalone Hyper-V servers (members of different domains) as providers to WAP without them being managed by a VMM (as they belong to different domains that have their own VMMs). I do not wish to have a trust relationship with those domains.
Just require to create user accounts in WAP and as they login, I'd like them to find their own assigned VM hosted on their respective Hyper-V server to be shown to them in the portal.
Hi Ranjana, If you want to use the VM Clouds Resource Provider that is included in WAP you require SPF and VMM. Take a look at this article that describes this architecture: http://technet.microsoft.com/en-us/library/dn457793.aspx. Note that VMM can manage
Hyper-V hosts on untrusted domains! Check this article for more details: http://technet.microsoft.com/en-us/library/gg610609.aspx. Please note that the maximum number of VMM servers that can be configured in SPF is 5. Hope this helps!
Hi Victor, Nice Post! Say the plugin has a backend. It communicates with the back end when calls are made to the plugin through these admin and tenant UIs. Now he needs to store credentials for himself to talk to the backend. Does the Azure pack framework provide some kind of support for storing these credentials. I mean is there a database or storage provided by the framework where the plugins can store their data or is it the plugins own responsibility to figure this. Ideally the plugin would be stateless but it may need some basic credentials to be persisted so that it can talk to the backend.Thanks
Hey VictorThanks for the great article. It's given me a better awareness of how these customisations are actually built up, and how they can be created.Asking about options that are not available in the out of box WAP that we'd like to see is deadly though! Straight out of the box would be a connector to Service Manager that will allow the self service portal for SM to be entirely replaced by WAP. Publish to WAP instead of the service service portal! This of course would require changes on the SM side as well :-)I'll keep thinking about this though... :-)Tim
Hi Venkat Thanks for your comments. Normally you’ve different ways to store custom configuration values. For example, the Hello World sample stores them in the web.config file, or you could use your own custom database. In both cases, you should encrypt the credentials just like WAP in general does. Please refer to the Protect-MgmtSvcConfiguration and Unprotect-MgmtSvcConfiguration PowerShell Cmdlets for more details on this (http://technet.microsoft.com/en-us/library/dn520965(v=sc.20).aspx and http://technet.microsoft.com/en-us/library/dn520996(v=sc.20).aspx).
Hi Tim,Thanks for your comments. Please check this new partner-provided WAP Resource Provider: http://www.gridprosoftware.com/en/products/requestmanagement
I have a problem. I have completed all steps successfully. But when i try to add it to an existing Plan, it pops an error message and says "Unable to add service helloworld to plan X".
I have checked the steps if I missed something but no, I did exactly the same things above. I wonder if this is a common problem or not? And do you have any idea?
Hi Cumhur Asci, did you checked that the Hello World resource provider was properly registed? Same PWD in the web.config file in the VS project and the Register-ResourceProvider.ps1 PS script? Is the Register your Hello World REST endpoint option is grayed
out in the WAP admin portal?
Hello. I am working on Windows azure pack and their Custom Resource provider feature. From your above blog I am able to deploy a 'Custom Resource Provider' successfully and now I want to deploy these 'Custome Resources provider' through Visual Studio or
through any script which I can run through Visual studio (On Project Build or Deployment through VS)
So, please help me out
Hi Pramod, in this blog post we're showing how to generate a .MSI from VS. Once you've the .MSI, you could deploy it silently from the command line or using a SW distribution tool like ConfigMgr 2012 R2. After deploying the .MSI, then you've to register
it as described in the PowerShell script in this post. After that, the resource provider is deployed and ready to be configured in the WAP Admin Portal.
Thanks a lot Victor Arzate..!! It also came in my mind later.
Hi Victor, Pramod again.
I am not able to see the file share details (grid) when I navigate from 'My account' tab in tenant site. But when I come from some other tab I can see it.
Hi Victor. Also please tell how can we work in code with Plan Quota in Hello world 'Plan Service'?
Hi Pramod Gupta, have you reviewed the Windows Azure Pack Developers Kit at