Convert template gallery in portal to template specs

The Azure portal provides a way to store Azure Resource Manager templates (ARM templates) in your account. However, template specs offers an easier way to share your templates with users in your organization, and link with other templates. This article shows how to convert existing templates in the template gallery to template specs.

To see if you have any templates to convert, view the template gallery in the portal. These templates have the resource type Microsoft.Gallery/myareas/galleryitems.

Deprecation of portal feature

The template gallery in the portal is being deprecated on March 31, 2025. To continue using a template in the template gallery, you need to migrate it to a template spec. Use one of the methods shown in this article to migrate the template.

Convert with PowerShell script

To simplify converting templates in the template gallery, use a PowerShell script from the Azure Quickstart Templates repo. When you run the script, you can either create a new template spec for each template or download a template that creates the template spec. The script doesn't delete the template from the template gallery.

  1. Copy the migration script. Save a local copy with the name Migrate-GalleryItems.ps1.

  2. To create new template specs, provide values for the -ResourceGroupName and -Location parameters.

    Set ItemsToExport to MyGalleryItems to export your templates. Set it to AllGalleryItems to export all templates you have access to.

    The following example creates new template specs for each template in a resource group named migratedRG. The script creates the resource group if it doesn't exist.

    .\Migrate-GalleryItems.ps1 -ResourceGroupName migratedRG -Location westus2 -ItemsToExport MyGalleryItems
  3. To download templates that you can use to create the template specs, don't provide values for the resource group or location. Instead, specify -ExportToFile. The template isn't the same as your template in the gallery. Instead, it contains a template spec resource that creates the template spec for your template.

    The following example downloads the templates without creating template specs.

    .\Migrate-GalleryItems.ps1 -ItemsToExport MyGalleryItems -ExportToFile

    To learn how to deploy the template that creates the template spec, see Quickstart: Create and deploy template spec.

For more information about the script and its parameters, see Create TemplateSpecs from Template Gallery Templates.

Manually convert through portal

You can manually copy templates from the gallery to a new template specs.

  1. Open the Templates (preview) in the portal.
  2. Select the template to migrate.
  3. Select View Template.
  4. Copy the template content.
  5. In the portal search bar, search for Template specs. Select that option.
  6. Select Create template spec.
  7. Provide values for the name, subscription, resource group, location, and version.
  8. Select Next: Edit template.
  9. For the contents of the template, paste the template you copied from the template gallery.
  10. Select Review + Create.
  11. After validation successfully completes, select Create.

If you need to share the template spec with other users in your organization, set role-based access control to the group or users that need access.

Next steps

To learn more about template specs, see Create and deploy template specs.