Created
March 7, 2023 06:14
-
-
Save vukasinterzic/3f70ee68defeda2cba950283655b3ee7 to your computer and use it in GitHub Desktop.
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-ResourceTypeAbbreviation { | |
param( | |
[Parameter(Mandatory=$true)] | |
[string]$ResourceType | |
) | |
if ($tableData.Resource -contains $ResourceType) { | |
$Answer = $tableData | Where-Object Resource -like $ResourceType | Select-Object -ExpandProperty Abbreviation | |
Write-Host "Correct abbreviation for $ResourceType is: $Answer" | |
} elseif ($tableData.Namespace -contains $ResourceType) { | |
$Answer = $tableData | Where-Object Namespace -like $ResourceType | Select-Object -ExpandProperty Abbreviation | |
Write-Host "Correct abbreviation for $ResourceType is: $Answer" | |
} else { | |
throw "Unknown resource type: $ResourceType" | |
} | |
} | |
#Examples: | |
#Get-ResourceTypeAbbreviation -ResourceType "Virtual Machine" | |
#Get-ResourceTypeAbbreviation -ResourceType "Microsoft.Compute/virtualMachines" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment