DevOpsHandling/Get-DevOpsProjects.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-DevOpsProjects -devOpsOrganization test -devOptsToken "1234567890"
#>

function Get-DevOpsProjects {
    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-DevOpsProjects