DevOpsHandling/Get-DevOpsProjectList.ps1

<#
 .Synopsis
  Retrieves a list of projects within the given organziation
 .Description
  Returns a list of all projects within the provided organization
 .Parameter devOpsOrganization
  Name of the organization in Azure DevOps
 .Parameter devOpsToken
  Personal access token for Azure DevOps
 .Example
  Get-DevOpsProjectList -devOpsOrganization test -devOptsToken "1234567890"
#>

function Get-DevOpsProjectList {
    Param (
        [Parameter(Mandatory=$true)]
        [string] $devOpsOrganization,
        [Parameter(Mandatory=$true)]
        [string] $devOpsToken
    )

    try {
        return (Invoke-AzureDevOpsApi -url ('https://dev.azure.com/{0}/_apis/projects' -f $devOpsOrganization) -devOpsToken $devOpsToken).value
    } catch {
        return ""
    }
}
Export-ModuleMember Get-DevOpsProjectList