Windows Azure Pack for Enterprises – Changes to the Tenant Site

The Windows Azure Pack Tenant Site offers a variety of functionality to Tenants and for Service Providers it’s absolutely required however for Enterprise customers there are typically various processes involved in adding disks to VMs, removing disks, deleting VMs, etc.

Inframon have been heavily involved with several customers to help them use Windows Azure Pack within their enterprise and help them to map their processes into it. Many of their processes involve various tasks that must be undertaken on a Virtual Machine prior to it being deleted or where they want to offer the ability for a Tenant to add a disk of any size.

Additionally there may be areas of the Tenant Site that are not required, for example if the Windows Azure Pack Administrators are not offering any VM Roles to Tenants then the VM Role option shouldn’t be shown to them, unfortunately this functionality is not part of the standard options available from Microsoft.

Hiding the VM Role Option

As can be seen from the screenshot below the VM Role option is available:

This screenshot shows the New Tray with the VM Role option

This screenshot shows the New Tray with the M Role option

If the user was to select the Virtual Machine Role | From Gallery option then an empty list of VM Role options would be shown:

Empty VM Roles in the WAP Tenant Site
Empty VM Roles in the WAP Tenant Site

This could lead to inquiries from Tenants as to why this list is empty. If this option wasn’t available for the Tenant they would be none the wiser!

To hide this option there are several files that need to be altered but PLEASE NOTE THIS NOT SUPPORTED BY MICROSOFT

Removing Virtual Machine Roles from the New Tray

To remove elements from the New Tray in Windows Azure Pack the following file can be amended:

C:\inetpub\MgmtSvc-TenantSite\Views\Shared\GetDisabledFeatures.cshtml

A new JavaScript function can be added:

<script type="text/javascript">
	setInterval(function(){
		
		//Custom JS functions here
},100);

</script>

This runs the code within the function every 100ms in Tenant’s browser. Adding this line of code will remove the VM Role instance:

$('.VirtualMachineRoleExtension').parent().parent().parent().hide();

This makes the code in the file overall look like this:

@model IEnumerable
@using System.Web.Script.Serialization;
@using Microsoft.Azure.Portal.Configuration;
@using Microsoft.WindowsAzure.Server.Configuration;

@{
    // TODO: This is a temporary workaround for missing feature in AUXFX framework
    var serializer = new JavaScriptSerializer();
    var jsonArray = serializer.Serialize(Model);
}
<script>
    (function(global, undefined) {
        "use strict";

        global.getAccountsExtensionDisabledFeatures = function () {
            return @Html.Raw(jsonArray);
        };
    })(this);
</script>
// ADDED BY INFRAMON
<script type="text/javascript">
	setInterval(function(){
		
		//Custom JS functions here
		$('.VirtualMachineRoleExtension').parent().parent().parent().hide();
},100);

</script>

Restarting the MgmtSvc-TenantSite in IIS then refreshing the Tenant Site shows the Virtual Machine Role has disappeared (mostly):

VM Role gone from the New Tray but sub menu options still remain
VM Role gone from the New Tray but sub menu options still remain

The sub menu options are still shown for Quick Create and From Gallery. To remove these further changes are needed however these are to two JS files:

  • C:\inetpub\MgmtSvc-TenantSite\Content\VM\Scripts\Extension\VM.Menu.QuickCreate.js
  • C:\inetpub\MgmtSvc-TenantSite\Content\VM\Scripts\Extension\VM.Menu.Gallery.js

VM.Menu.QuickCreate.js

This file is responsible for registering the Quick Create options for the VM Extension in the Tray. To prevent the Quick Create VM Role option from appearing the file should be amended as follows:

(function(global, $, resources, constants, undefined) {
    "use strict";

    var roleView = new global.VMExtension.View.VMRole.QuickCreate(),
        instanceView = new global.VMExtension.View.VMInstance.QuickCreate();
/*
    global.ExpFx.registerSubMenu(constants.extensionName, constants.roleMenuName, {
        name: "QuickCreate",
        displayName: resources.viewQuickCreateName,
        description: resources.viewRoleQuickCreateDescription,
        template: roleView.template,
        label: resources.viewQuickCreateVMRoleLabel,
        opening: function() {
            roleView.onOpening.call(roleView);
            this.data = roleView.viewModel;
        },
        open: function(args) {
            return roleView.onOpen.call(roleView, args);
        },
        ok: function(args) {
            return roleView.onOk.call(roleView, args);
        },
        close: function() {
            return roleView.onClose.call(roleView);
        }
    });
*/
    global.ExpFx.registerSubMenu(constants.extensionName, constants.instanceMenuName, {
        name: "QuickCreate",
        displayName: resources.viewQuickCreateName,
        description: resources.viewInstanceQuickCreateDescription,
        template: instanceView.template,
        label: resources.viewQuickCreateVMInstanceLabel,
        opening: function() {
            instanceView.onOpening.call(instanceView);
            this.data = instanceView.viewModel;
        },
        open: function() {
            return instanceView.onOpen.call(instanceView);
        },
        ok: function() {
            return instanceView.onOk.call(instanceView);
        },
        close: function() {
            return instanceView.onClose.call(instanceView);
        }
    });

})(this,
   this.jQuery,
   this.VMExtension.Resources,
   this.VMExtension.Constants);

VM.Menu.Gallery.js

This file is responsible for registering the Gallery options for the VM Extension in the Tray. To prevent the From Gallery VM Role option from appearing the file should be amended as follows:

(function(global, $, resources, constants, undefined) {
    "use strict";

    var instanceView = new global.VMExtension.View.VMInstance.Gallery(),
        roleView = new global.VMExtension.View.VMRole.Gallery();

    global.ExpFx.registerSubMenu(constants.extensionName, constants.instanceMenuName, {
        name: "FromMarketplace",
        displayName: resources.viewFromGalleryName,
        description: resources.viewInstanceFromGalleryDescription,
        label: resources.viewInstanceFromGalleryLabel,
        execute: function() { instanceView.launch(); }
    });
/*
    global.ExpFx.registerSubMenu(constants.extensionName, constants.roleMenuName, {
        name: "FromMarketplace",
        displayName: resources.viewFromGalleryName,
        description: resources.viewRoleFromGalleryDescription,
        label: resources.viewRoleFromGalleryLabel,
        execute: function() { roleView.launch(); }
    });
*/
})(this,
   this.jQuery,
   this.VMExtension.Resources,
   this.VMExtension.Constants);

Once these files have been amended and the MgmtSvc-TenantSite site restarted in IIS the options have completely disappeared:

The Quick Create and From Gallery options are gone
The Quick Create and From Gallery options are gone

The Tenant can only provision from Standalone Virtual Machines.

Summary

The Windows Azure Pack Tenant Site is a complicated entity that is made of up multiple files, each of which can be manipulated as required. Things to remember with this:

  1. Do not expect support from Microsoft on this
  2. When Microsoft update the Tenant Site all changes are lost so document your changes
  3. Test the interface changes on a Windows Azure Pack Express installation and not on your production environment

This is by no means the limit of what can be achieved with modifications to the Tenant Site. Control functions can be removed, such as the ability to Delete Virtual Machines, Attach options can be removed (potentially just disks or NICs). For customers where functionality has been removed we have typically created a Service Request in System Center 2012 R2 Service Manager and presented it through Request Management for WAP from GridPro.

One thought on “Windows Azure Pack for Enterprises – Changes to the Tenant Site

  1. Nice Post
    I had to Achieve Simular but with a little change the Polling goes away.
    Add the Hie function to Scripts.cshtml and let it clear the Interval.
    (just a little bit sugar)

    $( document ).ready(function() {
    var checkExist = setInterval(function() {
    if ($(“.VirtualMachineRoleExtension”).length) {
    $(“.VirtualMachineRoleExtension”).parent().parent().parent().hide();
    console.log(“Exists!”);
    clearInterval(checkExist);
    }
    }, 100);

    });

Leave a Reply

Your email address will not be published. Required fields are marked *