After you're finished improving your Azure provisioning experience by reading Nick's recent post about improving error messaging, you can add a nice little touch to the service catalog experience by adding a link to visualize Azure templates in the long description.

This is quite simply adding a link to in the long description of your Azure service catalog, but due to a couple bugs, there's a little bit of work that needs to be done.

A cool trick with CloudForms that not everyone knows, is that the Long Description in the Catalog Items can accept raw HTML. This includes dropping in links. At the moment, there is a bug that doesn't allow us to edit the Long Description in Catalog Items based on an Orchestration Template. Once this gets fixed, this will be as simple as entering the link. For now, we can work around this by exporting the service catalogs, editing the Long Description manually, and importing it back in.

what we're after

The end result should be a link in the Catalog that looks like this:

and opens a new tab that shows the user something like this:


We're going to use a very simple deployment of a Linux VM for this. Check it out, but the description is pretty explanatory:

This template allows you to deploy a simple Linux VM using a few different options for the Ubuntu Linux version, using the latest patched version. This will deploy in West US on a D1 VM Size.

the code

The next few steps assume that you've created an Orchestration Template based on the azuredeploy.json for this template, automatically generated a dialog based on that template, and created a Catalog Item.

UPDATE: nick wrote a nice post on how to do all of this here.

This leaves us with a Service Catalog that looks like this:


Now comes the workaround. We need to export all of our catalog info so we can hack in a Long Description. This rake script will do the trick. Navigate to the tasks directory:

# vmdb
# cd lib/tasks

and place our rake script here. The syntax to execute the command is easy, we can see what's expected by using the usage feature:

# rake redhat:service_catalogs:usage
(in /var/www/miq/vmdb)
Export - Usage: rake redhat:service_catalogs:export[/path/to/export]
Import - Usage: rake redhat:service_catalogs:import[/path/to/export]

So let's export everything to a file:

# rake redhat:service_catalogs:export[/tmp/export]

Open the file and look for the service catalog that we want to add the long description, in our case, that's the Simple Linux VM(101), so find that in the JSON file and add the link in manually. It should look like this:

- name: Simple Linux VM (101)
  description: ''
  type: ServiceTemplateOrchestration
  display: true
  service_type: atomic
  prov_type: generic_orchestration
  long_description: <a href="link_to_visualization" target="_blank">Visualize This!</a>
  options: {}

Make sure you include a space before the ":" and the Long Description, since YAML requires it. Now use the rake script to import everything back in:

# rake redhat:service_catalogs:import[/tmp/export]

If things go well, you'll see an output of all your service catalogs and catalog items. Something like this:

Service Catalog: [Bundle]
Service Catalog: [VMware]
Service Catalog: [OpenStack]
Service Catalog: [OpenStack (Stacks)]
Service Catalog: [Amazon]
Service Catalog: [Azure]
Catalog Item: [Use Chef to deploy WordPress]
Catalog Item: [Create Tenant, User and Set Quota]
Catalog Item: [WordPress basic single instance]
Catalog Item: [RHEL 7 Gold Build]
Catalog Item: [RHEL 7 Gold Build]
Catalog Item: [Server with encrypted volume]
Catalog Item: [Chef server]
Catalog Item: [Server with Cinder volume]
Catalog Item: [Windows Server 2008 R2]
Catalog Item: [Webserver (RHEL)]
Catalog Item: [RHEL 6.5 (Chef config)]
Catalog Item: [Database (RHEL)]
Catalog Item: [Two servers and private network]
Catalog Item: [Windows Server 2012 R2]
Catalog Item: [Scalable, Load-balancing Web Server]
Catalog Item: [Simple Linux VM (101)]
Catalog Item: [Simple Windows VM (101)]
Catalog Item: [Web App and SQL Database (201)]
Catalog Item: [Single VM from Image]
Catalog Item: [LAMP Stack]

Let's have a look at the Service Catalog now:


There you go. Now the Long Description has a link that takes the user to a new tab and visualizes the service.