Hello Readers!

As you may recall, I published this post (Automation–Microsoft Azure Automation–The Evolution of Cloud Automation) last month, as my first experience with Microsoft Azure Automation. It illustrated the evolution – my evolution – through and to where we are with Cloud Automation.

Here I am again, with a new script – well, in truth, a new version of that script – which makes things a little easier to provision a VM with one click and the completion of a form (taking in Runbook parameters).

So, no long post, no big explanation…just a link to the script, and the hope that you will find it useful.

Script Center Contribution and Download

The download is the example: New-AzureEnvironmentResourcesFromGallery.ps1

Here is a brief description:

This runbook creates a number of Azure Environment Resources (in sequence): Azure Affinity Group, Azure Cloud Service, Azure Storage Account, and Azure VM all from an existing VM Image (specified as a Variable in the Assets).

A detained Description, full set of Requirements, and the actual Runbook Contents are available within the Script Center Contribution (not to mention, the actual download).

Download the Provision Azure Environment Resources from Gallery Example Runbook from Script Center here:


A bit more about the Requirements…

(same as previous script)

Runbook Parameters

  • Azure Connection Name

    REQUIRED. Name of the Azure connection setting that was created in the Automation service.
        This connection setting contains the subscription id and the name of the certificate setting that
        holds the management certificate. It will be passed to the required and nested Connect-Azure runbook.

  • Project Name

    REQUIRED. Name of the Project for the deployment of Azure Environment Resources. This name is leveraged
        throughout the runbook to derive the names of the Azure Environment Resources created.

  • VM Name

    REQUIRED. Name of the Virtual Machine to be created as part of the Project.
  • VM Instance Size

    REQUIRED. Specifies the size of the instance. Supported values are as below with their (cores, memory)
        "ExtraSmall" (shared core, 768 MB),
        "Small"      (1 core, 1.75 GB),
        "Medium" (2 cores, 3.5 GB),
        "Large"      (4 cores, 7 GB),
        "ExtraLarge" (8 cores, 14GB),
        "A5"         (2 cores, 14GB)
        "A6"         (4 cores, 28GB)
        "A7"         (8 cores, 56 GB)

  • Storage Account Name

    OPTIONAL. This parameter should only be set if the runbook is being re-executed after an existing
    and unique Storage Account Name has already been created, or if a new and unique Storage Account Name
    is desired. If left blank, a new and unique Storage Account Name will be created for the Project. The
    format of the derived Storage Account Names is:
        $ProjectName (lowercase) + [Random lowercase letters and numbers] up to a total Length of 23

Other Requirements

  • An existing connection to an Azure subscription (requires the Connect-Azure runbook and its pre-requisites)

  • Five (5) Automation Assets (to be configured in the Assets tab). These are suggested, but not necessarily required. Replacing the "Get-AutomationVariable" calls within this runbook with static or parameter variables is an alternative method. For this example though, the following dependencies exist:
            $AGLocation = Get-AutomationVariable -Name 'AGLocation'
            $VMImage = Get-AutomationVariable -Name 'VMImage'
                Example Image: a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-R2-201404.01-en.us-127GB.vhd
            $VMImageOS = Get-AutomationVariable -Name 'VMImageOS'
            $AdminUsername = Get-AutomationVariable -Name 'AdminUsername'
            $Password = Get-AutomationVariable -Name 'Password'

Note     The entire runbook is heavily checkpointed and can be run multiple times without resource recreation.

Thanks for checking out my blog post! For more information, tips/tricks, and example solutions for Automation within System Center, Windows Azure Pack, Microsoft Azure, etc., be sure to check out the other blog posts from Building Clouds in the Automation Track!