Create and deploy VM Applications (preview)

VM Applications are a resource type in Azure Compute Gallery (formerly known as Shared Image Gallery) that simplifies management, sharing and global distribution of applications for your virtual machines.

Important

VM applications in Azure Compute Gallery are currently in public preview. This preview version is provided without a service-level agreement, and we don't recommend it for production workloads. Certain features might not be supported or might have constrained capabilities. For more information, see Supplemental Terms of Use for Microsoft Azure Previews.

Prerequisites

Before you get started, make sure you have the following:

This article assumes you already have an Azure Compute Gallery. If you don't already have a gallery, create one first. To learn more, see Create a gallery for storing and sharing resources..

You should have uploaded your application to a container in an Azure storage account. Your application can be stored in a block or page blob. If you choose to use a page blob, you need to byte align the files before you upload them. Here is a sample that will byte align your file:

$inputFile = <the file you want to pad>

$fileInfo = Get-Item -Path $inputFile

$remainder = $fileInfo.Length % 512

if ($remainder -ne 0){

    $difference = 512 - $remainder

    $bytesToPad = [System.Byte[]]::CreateInstance([System.Byte], $difference)

    Add-Content -Path $inputFile -Value $bytesToPad -Encoding Byte
    }

You need to make sure the files are publicly available, or you will need the SAS URI for the files in your storage account. You can use Storage Explorer to quickly create a SAS URI if you don't already have one.

If you are using PowerShell, you need to be using version 3.11.0 of the Az.Storage module.

Create the VM application

Choose an option below for creating your VM application definition and version:

  1. Go to the Azure portal, then search for and select Azure Compute Gallery.
  2. Select the gallery you want to use from the list.
  3. On the page for your gallery, select Add from the top of the page and then select VM application definition from the drop-down. The Create a VM application definition page will open.
  4. In the Basics tab, enter a name for your application and choose whether the application is for VMs running Linux or Windows.
  5. Select the Publishing options tab if you want to specify any of the following optional settings for your VM application definition:
    • A description of the VM application definition.
    • End of life date
    • Link to a Eula
    • URI of a privacy statement
    • URI for release notes
  6. When you are done, select Review + create.
  7. When validation completes, select Create to have the definition deployed.
  8. Once the deployment is complete, select Go to resource.
  9. On the page for the application, select Create a VM application version. The Create a VM Application Version page will open.
  10. Enter a version number like 1.0.0.
  11. Select the region where you have uploaded your application package.
  12. Under Source application package, select Browse. Select the storage account, then the container where your package is located. Select the package from the list and then click Select when you are done.
  13. Type in the Install script. You can also provide the Uninstall script and Update script. See the Overview for information on how to create the scripts.
  14. If you have a default configuration file uploaded to a storage account, you can select it in Default configuration.
  15. Select Exclude from latest if you do not want this version to appear as the latest version when you create a VM.
  16. For End of life date, choose a date in the future to track when this version should be retired. It is not deleted or removed automatically, it is only for your own tracking.
  17. To replicate this version to other regions, select the Replication tab and add more regions and make changes to the number of replicas per region. The original region where your version was created must be in the list and cannot be removed.
  18. When you are done making changes, select Review + create at the bottom of the page.
  19. When validation shows as passed, select Create to deploy your VM application version.

Now you can create a VM and deploy the VM application to it using the portal. Just create the VM as usual, and under the Advanced tab, choose Select a VM application to install.

Screenshot of the Advanced tab where you can choose to install a VM application.

Select the VM application from the list, and then select Save at the bottom of the page.

Screenshot showing selecting a VM application to install on the VM.

If you have more than one VM application to install, you can set the install order for each VM application back on the Advanced tab.

Next steps

Learn more about VM applications.