Get-AzureResourceGroupGalleryTemplate

Get-AzureResourceGroupGalleryTemplate

Gets resource group templates in the gallery

Syntax

Parameter Set: List gallery templates
Get-AzureResourceGroupGalleryTemplate [[-Publisher] <String> ] [[-Category] <String> ] [ <CommonParameters>]

Parameter Set: Get a single gallery template
Get-AzureResourceGroupGalleryTemplate [-Identity] <String> [ <CommonParameters>]

Detailed Description

The Get-AzureResourceGroupGalleryTemplate cmdlet gets resource group gallery templates from the template gallery that Azure hosts. To save a gallery template as a JSON file, use the Save-AzureResourceGroupGalleryTemplate cmdlet.

A resource group template is a JSON string that defines a resource group for a complex entity, such as a web portal, a blog, a photo gallery, a commerce site, or a wiki. The template defines the resources that are typically needed for the entity, such as web sites, database servers, databases and storage accounts, and includes parameters for user-defined values, such as the names and properties of the resources. To create a resource group with a template, just identify the template and provide values for its parameters.

You can create your own templates or use the Get-AzureResourceGroupGalleryTemplate get a template from the template gallery that Azure hosts. You can also create templates by editing the gallery templates. If you create or edit a template, be sure to use the Test-AzureResourceGroupTemplate cmdlet to verify that your template and its parameters are valid.

To create a resource group with a custom or gallery template, use the New-AzureResourceGroup or New-AzureResourceGroupDeployment cmdlets.

Parameters

-Category<String>

Gets only gallery templates in the specified category. Wildcards are not permitted. You can specify only one category in each command. This parameter is optional. By default, Get-AzureResourceGroupGalleryTemplate gets all gallery templates.

Aliases

none

Required?

false

Position?

3

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-Identity<String>

Gets the gallery template with the specified Identity value. Wildcards are not permitted. You can specify only one Identity in each command.

To find the Identity of a gallery template, run Get-AzureResourceGroupGalleryTemplate without parameters.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-Publisher<String>

Gets only gallery templates from the specified publisher. Enter one publisher name. Wildcards are not permitted. This parameter is optional. By default, Get-AzureResourceGroupGalleryTemplate gets all gallery templates.

Aliases

none

Required?

false

Position?

2

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see  about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • None

    You can pipe input to this cmdlet by property name, but not by value.

Outputs

The output type is the type of the objects that the cmdlet emits.

  • System.Management.Automation.PSCustomObject

    When you use the Identity parameter, this cmdlet returns a GalleryItem object. Otherwise, it returns a PSCustomObjet.

  • Microsoft.Azure.Gallery.GalleryItem

    When you use the Identity parameter, this cmdlet returns a GalleryItem object. Otherwise, it returns a PSCustomObjet.

Notes

  • The Get-AzureResourceGroupGalleryTemplate cmdlet is included in the Azure Resource Manager module beginning in module version 0.8.0.

Examples

This command gets all gallery templates in the Azure template gallery and displays the Identity and Description of each gallery template in a list. The list lets you browse through the templates and select the ones that meet your needs.

To save the list in a text file that you can search, use the redirection operator (>). For example, Get-AzureResourceGroupGalleryTemplate | Format-List Identity, Description > $home\Documents\Azure\TemplateDescriptions.txt.

PS C:\> Get-AzureResourceGroupGalleryTemplate
Publisher                                                   Identity
--------- --------
Acquiacom Acquiacom.AcquiaDrupal7MySQL.0.1.0-preview1
Acquiacom Acquiacom.AcquiaDrupal7SQL.0.1.0-preview1
Avensoft Avensoft.nService.0.1.0-preview1
BlogEngineNET BlogEngineNET.BlogEngineNET.0.1.0-preview1
Brandoo Brandoo.BrandooWordPressMSSQLorAzureSQL.0.1.0-preview1
bugnetproject bugnetproject.BugNET.0.1.0-preview1
CakeSoftwareFoundation CakeSoftwareFoundation.CakePHP.0.1.0-preview1
CommerceGuys CommerceGuys.DrupalCommerceKickstartMySQL.0.1.0-preview1
...

This command uses the Get-AzureResourceGroupGalleryTemplate cmdlet to get the WikimediaFoundation.MediaWiki.0.1.0-preview1 gallery template. You can review the gallery template and its properties, such as icons and screenshots.

PS C:\ps-test> Get-AzureResourceGroupGalleryTemplate -Identity WikimediaFoundation.MediaWiki.0.1.0-preview1

When you find a gallery template that matches your resource needs, you can save it as a JSON file on disk. This makes it easy to review and analyze the resources that the template creates and the parameters (user-defined values) that it defines for each resource. Then, you can use the template with the New-AzureResourceGroup and New-AzureResourceGroupDeployment cmdlets.

The first command uses the Save-AzureResourceGroupGalleryTemplate cmdlet to save the Microsoft.PhotoGallery.0.1.0-preview1 gallery template as a JSON file in the path that you specify.

The second command uses the Get-Content cmdlet to get the content of the template file. The output that's displayed here is just an excerpt of the JSON template file, but you can see the Parameters and Resources attributes that are common to every template file. To see examples of using the template, type: Get-Help New-AzureResourceGroup or Get-Help New-AzureResourceGroupDeployment.

PS C:\> Save-AzureResourceGroupGalleryTemplate -Identity Microsoft.PhotoGallery.0.1.0-preview1 -Path $home\Documents\Azure\MyTemplates

PS C:\>Get-Content -Path $home\Documents\Azure\MyTemplates Microsoft.PhotoGallery.0.1.0-preview1.json 

{
  "$schema": "https://johngosmanage.blob.core.windows.net/schemas/2014-04-01-preview/deploymentTemplate.json",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "siteName": {
      "type": "string"
    },
    "hostingPlanName": {
      "type": "string"
  },

...

  "resources": [
    {
      "apiVersion": "2014-04-01",
      "name": "[parameters('siteName')]",
      "type": "Microsoft.Web/sites",
      "location": "[parameters('siteLocation')]",
      "tags": {
        "[concat('hidden-related:/subscriptions/', 
      },
      "properties": {
        "name": "[parameters('siteName')]",
        "serverFarm": "[parameters('hostingPlanName')]",
        "computeMode": "[parameters('computeMode')]",
        "siteMode": "[parameters('siteMode')]"
      }
...

Example 4: Get the category, identity, and summary of the templates

This example shows you how to display the category (CategoryIds property), identity, and summary of each template in a list. You can use commands with this format to get any template property. To find all template properties, pipe a Get-AzureResourceGroupGalleryTemplate command with the Identity parameter to the Get-Member cmdlet. For example: (Get-AzureResourceGroupGalleryTemplate Microsoft.TeamProject.0.1.0-preview1 | Get-Member).

PS C:\> Get-AzureResourceGroupGalleryTemplate | Foreach-Object {Get-AzureResourceGroupGalleryTemplate -Identity $_.Identity} | Format-List -Property CategoryIds, Identity, Summary
CategoryIds : {web, blogscms, ecommerce}
Identity : Acquiacom.AcquiaDrupal7MySQL.0.1.0-preview1
Summary : Acquia Drupal 7 provides the fastest on-ramp to build dynamic and social web sites featuring both editorial and user-generated content. Includes Drupal core and popular modules.


CategoryIds : {web, other}
Identity : Avensoft.nService.0.1.0-preview1
Summary : Help desk and service management software that empowers you to provide great services to your employees and customers. This free edition allows one concurrent technician and unlimited end users.
...