FunctionsPublic/Get-ProxsysGraphTenantByName.ps1
<#
.SYNOPSIS Get all tenants .DESCRIPTION Lists all tenants that are configured within the CDI #> function Get-ProxsysGraphTenantByName { [cmdletbinding()] param( [psobject]$accessToken, [string]$tenantName ) process { if($null -eq $accessToken -or $tenantName.Length -eq 0) { Write-Error "Invalid input received. Please specify all parameters in order to use this function." return $null } $requestBody = @{ "query" = "query { getTenantByName(name: ""$($tenantName)"") { id, name }}" } $responseBody = Invoke-RestMethod ` -Uri "https://graph.proxsys.dev" ` -Headers @{ "Authorization" = "Bearer $($accesstoken.AccessTokenCredential.GetNetworkCredential().password)" } ` -Body $requestBody ` -ContentType "application/json" $responseBody.data.getTenantByName } } |