Gallery

Overview

The gallery builder is used to create Galleries for sharing VM images. These can be used to create virtual machines or virtual machine scale sets that can expand or contract to scale capacity as needed.

  • Galleries (Microsoft.Compute/galleries)
  • Gallery Image (Microsoft.Compute/galleries/images)

Builder Keywords

Applies ToKeywordPurpose
gallerynameName of the gallery resource, up to 80 characters, alphanumerics and periods.
gallerydescriptionDescription for the gallery.
gallerysharing_profileSharing profile that must be set to share with the community or groups.
gallerysoft_deleteIndicate soft deletion of images should be enabled or disabled (default disabled).
galleryadd_tagsAdd tags to the gallery resource.
gallerydepends_onAdd explicit dependencies for the gallery resource.
galleryImagenameName of the image in the gallery.
galleryImagegallery_nameName of the gallery where the image is created.
galleryImagegallerySpecify the gallery in the same deployment. The image will depend on the gallery.
galleryImagearchitectureIndicates x64 or ARM 64 images - defaults to x64 if not set.
galleryImagedescriptionOptional description for the image in the gallery.
galleryImageeulaOptional End User License Agreement for using the image.
galleryImagehyperv_generationThe Hyper-V generation for the image. This should be set to match the Hyper-V generation of the source image that was used to create this image.
galleryImagegallery_image_identifierThe publisher, offer, and sku for the image in the gallery.
galleryImageos_stateIndicate if the VM is Generalized or Specialized. A generalized image allows OS configuration options, such as setting the username and password, whereas this is typically set already in a specialized image.
galleryImageos_typeOS type for the image - Windows or Linux
galleryImageprivacy_statement_uriURI where the privacy statement for the use of the image can be found.
galleryImagepurchase_planA purchase plan name, publisher, and product for the image, for use in a community gallery or marketplace images.
galleryImagerecommended_configurationRecommended range of vCPUs and memory for VMs created from this image.
galleryImagerecommended_memoryA recommended range of memory for VMs created from this image. Default is 1 Gb to 32 Gb.
igalleryImagemagerecommended_vcpuA recommended range of vCPUs for VMs created from this image. Default is 1 to 16.
galleryImagerelease_notes_uriURI where release notes can be found for the image.
galleryImageadd_tagsAdd tags to the image resource.
galleryImagedepends_onAdd explicit dependencies for the image resource.

Example

open Farmer
open Farmer.Arm.Gallery
open Farmer.Builders

let myGallery = 
    gallery {
        name "mygallery"
        description "Example Community Image Gallery"
        sharing_profile (
            Community {
                Eula = "End User License Agreement goes here"
                PublicNamePrefix = "farmages"
                PublisherContact = "farmer.gallery@example.com"
                PublisherUri = System.Uri "https://compositionalit.github.io/farmer"
            }
        )
    }

let myImage =
    galleryImage {
        name "my-server-image"
        gallery myGallery

        gallery_image_identifier (
            {
                Offer = "my-server"
                Publisher = "farmages"
                Sku = "my-server-2023"
            }
        )

        hyperv_generation Image.HyperVGeneration.V2
        os_state Image.OsState.Generalized
        os_type OS.Linux
    }

arm {
    add_resources [
        myGallery
        myImage
    ]
}