Setting resource location in ARM template and Test VM

  1. Home
  2. Setting resource location in ARM template and Test VM

AZ-303 is retired. AZ-305 replacement is available.

This tutorial will help you learn about Setting resource location in ARM template and describes how to deploy and test an Azure virtual machine (VM) from the generalized VHD image created in the previous section (Create Azure VM technical asset) to ensure the VHD image meets Azure Marketplace publishing requirements.

When deploying an Azure Resource Manager (ARM) template, you must provide a location for each resource. The location doesn’t need to be the same location as the resource group location.

Get available locations

Different resource types are supported in different locations. To get the supported locations for a resource type, use Azure PowerShell or Azure CLI.

Use location parameter

To allow for flexibility when deploying your template, use a parameter to specify the location for resources. Set the default value of the parameter to resourceGroup().location.

Test VM

Complete these steps to generate a compatibility report, which certifies your VHD image can be used on Azure Marketplace.

  1. Firstly, Create and deploy certificate required for remote VM management to Azure Key Vault.
  2. Subsequently, Deploy an Azure VM from your generalized VHD image created in Create Azure VM technical asset.
  3. Furthermore, Run tests on the deployed VM to ensure the VHD image is ready to be published and used to deploy VMs.

Running scripts

This contains three scripts to be run in PowerShell. The desktop PowerShell works best, however, the Azure Cloud Shell can also be used with the PowerShell option selected (top left of window).

  1. Firstly, Ensure PowerShell is configured to run scripts.
    • Always open PowerShell with the Run as administrator option.
    • Ensure you can run these scripts: Set-ExecutionPolicy and RemoteSigned.
  2. Also, Install Azure CLI.
  3. Subsequently, Install Azure PowerShell Az Module.
    1. Option A: No modules installed yet.
      • Install-Module -Name Az -AllowClobber -Scope AllUsersFor more information, see Install Azure PowerShell module.
    2. Option B: Currently using AzureRM module.
      • Uninstall-AzureRM
      • Install-Module -Name Az -AllowClobber -Scope AllUsers
      • Enable-AzureRmAlias -Scope CurrentUserFor more information, see Migrate Azure PowerShell from AzureRM to Az.
  4. Lastly, Save session parameters.

The scripts in this section use session variables/parameters. If you close the session, the parameters are erased. We recommend using one session to run all scripts to avoid parameter value errors. If this is not possible, you’ll have to reinitialize the parameters when opening a new session, especially for the later scripts.

Create certificates for Azure Key Vault

This process consists of three steps:

  1. Create the security certificate.
  2. Create the Azure Key Vault to store the certificate.
  3. Store the certificates to the key vault.

You can use either a new or an existing Azure resource group for this work.

Next step is to Deploy an Azure VM from your generalized VHD image.

Lastly, Run tests on the deployed VM

Download and run the certification test tool

The Certification Test Tool for Azure Certified is a self-test tool that runs on a local Windows machine but tests an Azure-based Windows or Linux VM. It certifies that your user VM image can be used with Microsoft Azure and that the guidance and requirements around preparing your VHD have been met. This tool ensures your VM is ready to publish per Azure Marketplace requirements.”

  1. Download and install the most recent Certification Test Tool for Azure Certified.
  2. Open the certification tool, then select Start New Test.
  3. From the Test Information screen, enter a Test Name for the test run.
  4. Select the Platform for your VM, either Windows Server or Linux. Your platform choice affects the remaining options.
  5. If your VM is using this database service, select the Test for Azure SQL Database check box.
free practice test for AZ- 303 and learn to Setting resource location in ARM template and Test VM

Go back to home page

Reference documentation – Set resource location in ARM template

Test Virtual Machine (VM) deployed from VHD

Menu