private/Get-AzureResourceType.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
function Get-AzureResourceType {
    [CmdletBinding()]
    param (
        [parameter(Mandatory = $true)] 
        [String] $Type
    )

    $resType = ""
    if ($type -like 'PS*') { $type = $type.Substring(2) }
    if ($type -like '*IntegrationRuntime') { $type = 'IntegrationRuntime' }

    switch -Exact ($type)
    {
        'integrationRuntime'    { $resType = 'Microsoft.DataFactory/factories/integrationruntimes' }
        'pipeline'              { $resType = 'Microsoft.DataFactory/factories/pipelines' }
        'dataset'               { $resType = 'Microsoft.DataFactory/factories/datasets' }
        'dataflow'              { $resType = 'Microsoft.DataFactory/factories/dataflows' }
        'linkedService'         { $resType = 'Microsoft.DataFactory/factories/linkedservices' }
        'trigger'               { $resType = 'Microsoft.DataFactory/factories/triggers' }
        default                 { Write-Error "Type '$Type' is not supported." }
    }

    return $resType
}