Copying Template from One Region to Another Region in Azure

Prev Next

This document outlines the process of copying the existing template to another region for the customer within their Azure subscription.

Tool:

MS PowerShell Script

The MS PowerShell script is built to complete the task of copying the template from one region to another region using GUI-based steps. You will find the script attached below in a Word Doc (Disk Copy and Template Creation PS Script)

Please ensure that the machine where this executable will run has the PowerShell Azure module installed. You can install the Azure module using the command below.

  • Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

  • Install-Module -Name Az -Repository PSGallery -Force

Data Required:

The following are the required details to complete the activity.

  • Azure Subscription ID

  • Azure Tenant ID

Steps:

  • Launch the MS PowerShell tool with elevated permissions.

  • Locate the script file path and run the script.

  • Azure subscription ID for the account to be provided in the following window and click ok.

  • Provide Azure Tenant ID details and click ok.

                               

  • Next it will redirect to the Azure Authentication windows to validate the credentials and after successful login, you will see the following window, where we have to provide all the required information to copy the template VM into another region.

    • Source resource Group:  The existing Template resource group to be selected.

    • Source Storage Account: Existing Template Storage account to be selected.

    • Source Storage Container: Existing Template VM “VHD” container to be selected.

    • Source VHD File: Existing template VM’s OS vhd file to be selected.

    • Destination Resource Group: The Resource group to be selected to copy the new template VM.

    • Destination Storage Account: The storage account to be selected for the new template VM.

    • Destination Storage Container: The storage Container to be selected to copy the new vhd file of the newly created VM.

    • New Template Destination: Need to choose the Network Subnet for the new Template VM to access it via RDP session.

    • Diagnostic Storage Account (Optional): Selecting the location in this field will store the diagnostic logs of the VM. This is an option field and can be left empty.

    • Network Security Group (Optional): The defined NSG policy can be selected to apply on this newly copied Template VM.

    • New Template VM Name: Provide the name for the newly copied VM.

    • New Template Disk Size:  Need to select the disk size for the newly copied Template VM.

    • New Template VM Size: Need to select the VM size(SKU) for the newly copied Template VM.

  • Selecting the check box for Install Azure VM agent and enable RDP will enable the Azure plugin for the VM to access/operate it through Azure portal options.

For now, we are leaving the following options unchecked and manually installing and configuring the Workspot Agent in the newly copied template.

  • Click “Ok” to finish the template copy process to the selected region.

The following is an example output for the successfully copied template.

  • Close the PowerShell and continue to install and configure the Workspot agent in the newly copied template VM.

Workspot Desktop Agent Installation and Configuration for Templates

  • RDP into the newly created Template VM to complete the Workspot Agent installation and configuration for the template.

  • The new Template VM may already have the Workspot agent installed from the previous template VM and it is recommended to clean and uninstall the existing Workspot desktop agent from the template to download and install the latest Workspot agent in it.

Download the Agent Installer:

The Agent Installer is on the Workspot download site

On the new template VM, open a browser and navigate to https://download.workspot.com.

On the new template VM, download the Workspot Agent installer WorkspotAgentSetup.msi.

Run the Agent Installer

Prerequisites:

  • You need to be a Windows Administrator to install the Agent.

  • Run Console with admin privilege and execute the script.

  • The Agent needs credentials that allow it to be registered with Control Administrator Credentials.

Workspot Template configuration

The Workspot Agent config files are in the below paths.

  • C:\ProgramData\WorkspotAgent\Config

  • "C:\Program Files\WorkspotAgent\WorkspotConfig.xml"

  • "C:\Program Files\WorkspotAgent\WorkspotConfigEditor.exe"

Please refer to the below link for details:

By default, the WorkspotConfig.xml is not located in the path (C:\ProgramData\WorkspotAgent\Config) and to edit the WorkspotConfigEditor.exe. The WorkspotConfig.xml file is to be copied into the path (C:\ProgramData\WorkspotAgent\Config) from the path (C:\Program Files\WorkspotAgent).

When you run the file ("C:\Program Files\WorkspotAgent\WorkspotConfigEditor.exe") with Admin privilege without copying the “WorkspotConfig.xml” into the location (C:\ProgramData\WorkspotAgent\Config). Then you will see the following prompt and clicking on the “OK” button will create the file (WorkspotConfig.xml”) into the location (C:\ProgramData\WorkspotAgent\Config).

Running the file ("C:\Program Files\WorkspotAgent\WorkspotConfigEditor.exe") will launch the following config window where you can test secure credentials and submit the configuration upon successful test.

Group Policy

In the template, Edit the following Group Policy to allow Time Zone redirection.

Path: Edit Allow Time Zone Redirection to Enable. It is in Computer Configuration\Administrative Templates\Windows Components\Remote Desktop Services\Remote Desktop Session Host\Device and Resource Redirection\

  • Delete files from downloads.

  • Empties recycle bin.

  • Shut it down.

  • Deallocate the VM in Azure.

Register or Add a Template to the Control

Now, we can register the newly copied template into the Control following the below steps.

Steps:

Go to “Setup > cloud name” and click the Register Template” button. To pop up the “Add Template” page.

Search for the newly created template using the following options and save the template.

  • Create a test pool in Control. Add 1 desktop.

  • Verify a VM is created to Ready state.