Skip to content

Instantly share code, notes, and snippets.

@chelnak
Created March 10, 2017 10:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chelnak/161e4e3864584e3ff2aa3daf6ef33692 to your computer and use it in GitHub Desktop.
Save chelnak/161e4e3864584e3ff2aa3daf6ef33692 to your computer and use it in GitHub Desktop.
Small profile function to easily retrieve a list of API versions for a given Resource Type
function Get-AzureRMResourceTypeAPIVersion {
<#
.SYNOPSIS
Retrieve a list of API versions for a given ResourceTypeName
.DESCRIPTION
Retrieve a list of API versions for a given ResourceTypeName
.PARAMETER ProviderNamespace
The the namespace of for the provider of the ResourceTypeName
E.g. Microsoft.Network
.PARAMETER ResourceTypeName
The type of resource to query
E.g. loadBalancers
.EXAMPLE
Get-AzureRMResourceTypeAPIVersion -ProviderNamespace "Microsoft.Network" -ResourceTypeName loadBalancers
#>
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true, Position=0)]
[ValidateNotNullOrEmpty()]
[String]$ProviderNamespace,
[Parameter(Mandatory=$true, Position=1)]
[ValidateNotNullOrEmpty()]
[String]$ResourceTypeName
)
(Get-AzureRmResourceProvider -ProviderNamespace $ProviderNamespace).ResourceTypes | `
Where-Object {$_.ResourceTypeName -eq $ResourceTypeName} | `
Select-Object -ExpandProperty "ApiVersions"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment