Create a custom resource in Azurestack marketplace example XenDesktop

After dabbling around with AzureStack for some time I decided to see how easy it was to add custom resources to AzureStack marketplace so users themselves can provision virtual machines. As an example I choose XenDesktop (empty site with pre-installed SQL server)

There are a few steps needed to actually do this.

1: Download Azure Gallery Packaging Tool, here –> http://www.aka.ms/azurestackmarketplaceitem

2: Open the downloaded file and copy the “SimpleVMteplate” into another folder and rename it to something else.

3: AzureStack uses Resource Manager so you need a finished template which you can use to set this up, I need to complete my template for XenDesktop (will then place it on github) but until then we can use the sample azuredeploy-101-simple-windows-vm JSON file.

4: Make changes to the files, there are some things to make notice of. There are 3 folders

DeploymentTemplates —> JSON ARM files go here

Icons –> Icons which should be visiable in AzureStack portal should be placed here, there are 4 different sizes Large(115×115) Medium (90×90),  Small (40×40), Wide (255×115) all the images should be in PNG

Strings –> Here we have the resources JSON file where we can define the different things that should appear in the AzureStack portal, an example

{
  “displayName”: “XenDesktop”,
  “publisherDisplayName”: “Citrix”,
  “summary”: “Sets up a fully empty XenDesktop 7.8 site”,
  “longSummary”: “Sets up a fully empty XenDesktop 7.8 site with a local SQL express installed into it”,
  “description”: “<p>This is just a sample of the type of description you could create for your gallery item!</p><p>This is a second paragraph.</p>”,
  “documentationLink”: “Documentation”
}

We also have

rootmanifest.json
rootUIDefinition.Json

The manifest.json file is which ties it all together,

{ “$schema”: “https://gallery.azure.com/schemas/2014-09-01/manifest.json#”,
    “name”: “XenDesktop_empty_site”,
    “publisher”: “Citrix_Systems”,
    “version”: “1.0.0”,

    “displayName”: “ms-resource:displayName”,
    “publisherDisplayName”: “ms-resource:publisherDisplayName”,
    “publisherLegalName”: “ms-resource:publisherDisplayName”,
    “summary”: “ms-resource:summary”,
    “longSummary”: “ms-resource:longSummary”,
    “description”: “ms-resource:description”,
    “longDescription”: “ms-resource:description”,
    “links”: [
        { “displayName”: “ms-resource:documentationLink”, “uri”: “
http://go.microsoft.com/fwlink/?LinkId=532898″ }
    ],
    “artifacts”: [
        {
            “name”: “xendesktop”,
            “type”: “Template”,
            “path”: “DeploymentTemplates\xendesktop_empty_site.json”,
            “isDefault”: true

        }
    ],
    “icons”: {
      “Small”: “Icons\Small.png”,
      “Medium”: “Icons\Medium.png”,
      “Large”: “Icons\Large.png”,
      “Wide”: “Icons\Wide.png”
    },
    “categories”:[
    “Desktop brokers”
      ],

    “uiDefinition”: {
      “path”: “UIDefinition.json”
    }
}

So I have added the name of the template, published, version and changes artifacts which JSON template to use and such, also I defined another category which is called Desktop Brokers.

After you have successfully changed everything we need to convert it to a azpkg, this can be done using the AzureGalleryPackager.exe (Which is part of the download)

Using the following parameters

AzureGalleryPackager.exe –m c:somethingxendesktoptemplatemanifest.json –o c:output

Make sure there are no spaces in version or publisher this will generate an error when creating the azpkg. Now we need to import this into AzureStack. the way to do this is go RDP into the clientVM, open up PowerShell, use this script to connect to your local AzureStack resources. Remember to change your AadTenantID.

# Add the Microsoft Azure Stack environment

        $AadTenantId=”youtpublicdomaininazuread.com”

# Configure the environment with the Add-AzureRmEnvironment cmdlet
        Add-AzureRmEnvironment -Name ‘Azure Stack’ `
            -ActiveDirectoryEndpoint (“
https://login.windows.net/$AadTenantId/”) `
            -ActiveDirectoryServiceEndpointResourceId “
https://azurestack.local-api/”`
            -ResourceManagerEndpoint (“https://api.azurestack.local/”) `
            -GalleryEndpoint (“
https://gallery.azurestack.local/”) `
            -GraphEndpoint “
https://graph.windows.net/”

        # Authenticate a user to the environment (you will be prompted during authentication)
        $privateEnv = Get-AzureRmEnvironment ‘Azure Stack’
        $privateAzure = Add-AzureRmAccount -Environment $privateEnv -Verbose
        Select-AzureRmProfile -Profile $privateAzure

        # Select an existing subscription where the deployment will take place
        Get-AzureRmSubscription -SubscriptionName “Default Provider Subscription”  | Select-AzureRmSubscription

Using the command Get-AzureRmSubscription we can check if we are connected take note of the subscriptionID . Next we use the command,

Add-AzureRMGalleryItem -SubscriptionId XXXXXXXXXXXXXXXX -ResourceGroup system -Name Citrix_Systems.XenDesktop_empty_site.1.0.0 -Path C:AzurestackCitrix_Systems.XenDesktop_empty_site.1.0.0.azpkg  -Apiversion “2015-04-01” –Verbose

Note that the NAME needs to match what we have defined in the manifest.json file
PUBLISHER.NAME.VERSION

   “name”: “XenDesktop_empty_site”,
    “publisher”: “Citrix_Systems”,
    “version”: “1.0.0”,

And there we go, we can see the categori and the template resource we just created

image

Leave a Reply

Scroll to Top