Functions/Teams/Get-Teams.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Function Get-Teams {
    [CmdletBinding()]
    Param(      
    )

    if ($global:PowerGraph_BaseUrl.ToLower().Contains("beta") -eq $false)
    {
        Write-Warning 'This query/command is currently only supported on the Beta endpoint - please call 'Connect-MSGraph' again with the following setting: -BaseUrl "https://graph.microsoft.com/beta/"'
    } else {
        $uri = $global:PowerGraph_BaseUrl + "groups?`$filter=resourceProvisioningOptions/Any(x:x eq 'Team')"

        $return = Invoke-MSGraphRequest -Uri $uri
    }
    
    return $return.value
}