azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

get-azureresourcegroupgallerytemplate returning "missing api version in the query string"

Open simonsabin opened this issue 11 years ago • 6 comments

Reported in the forums https://social.msdn.microsoft.com/Forums/azure/en-US/1a5a32c8-3975-4c3e-afae-8797dba2af36/getazureresourcegroupgallerytemplate-error-missing-api-version-query-string-allowed-values-are?forum=windowsazuremanagement

Using Microsoft Azure Powershell 9.8

simonsabin avatar Oct 05 '15 22:10 simonsabin

Thank you for reaching out - We deprecated Get-AzureResourceGroupGalleryTemplate and removed the API that supported it too early. Please accept our apologies about this.

We are working on a replacement for these cmdlets. It will enable all the current capabilities add ability to save "non default" templates (like variations on SQL images), will not require to authenticate to save public items, among other improvements. Let us know if there is anything you'd like to see in the new Cmdlets that will replace Get/Save AzureResourceGroupGaleryTemplate.

In the meantime, here are some powershell snippets which will allow you to do the same thing (and in fact, more):

Retrieve all available items

$allGalleryItems = Invoke-WebRequest -Uri "https://gallery.azure.com/Microsoft.Gallery/GalleryItems?api-version=2015-04-01&includePreview=true" | ConvertFrom-Json

Get all items published by Microsoft

$allGalleryItems | Where-Object { $_.PublisherDisplayName -eq "Microsoft" }

Get all gallery items with "SQL" in the description

$allGalleryItems | Where-Object { $_.Description -match "SQL" }

Save default template for all items under directory "C:\Templates"

$allGalleryItems | Foreach-Object { $path = Join-Path -Path "C:\templates" -ChildPath $_.Identity New-Item -type Directory -Path $path

$.Artifacts | Where-Object { $.type -eq "template" } | ForEach-Object { $templatePath = Join-Path -Path $path -ChildPath ( $_.Name + ".json" )

(Invoke-WebRequest -Uri $_.Uri).Content | Out-File -FilePath $templatePath } }

Thanks,

-Gilles (MSFT)

GillesZunino avatar Oct 06 '15 16:10 GillesZunino

Is there a replacement command for Get-AzureResourceGroupGalleryTemplate yet? If not, can we have the old API back for now please?

jfatticq avatar Oct 14 '15 05:10 jfatticq

@GillesZunino you lost a couple of underscores in the code snips you provided.

Thanks for the code snips.

the removal of an API that is still used by the most current version of the azure powershell module is very concerning, Powershell is used to automate workflows, if Microsoft is going to remove APIs like this in the future we need some notification and usable replacement API/solution and time to implement the new solution before the old API/solution is just removed.

robplank avatar Oct 14 '15 19:10 robplank

the information is great for finding out what is available ... How do I find out what my subscriptions are using from the marketplace? What is the best means to do this?

crshnbrn66 avatar Mar 14 '16 20:03 crshnbrn66

Bump for this. Currently, saving custom templates is broken in the portal and non-existent via powershell et .

weznagwama avatar Mar 06 '17 08:03 weznagwama

The Gallery service is no longer supported. If you are having issues with templates, please file an issue for the particular problem you are experiencing.

markcowl avatar Mar 21 '18 18:03 markcowl