Created
March 10, 2017 10:24
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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