Teams Call quality SignIn issue

2023-03-10T16:20:11.7333333+00:00

Hi ,

I am trying to get the Teams data using PowerShell as below without asking for the signIn popup dialog box.

$tenantId = "xxxxxxxxxxxx"
$appId = "xxxxxxxxxxx"
$appSecret = "xxxxxxxxxxxx"
$scope = "https://cqd.teams.microsoft.com/.default"
$authority = "https://login.microsoftonline.com/$tenantId/oauth2/v2.0/token"
$body = @{
    client_id     = $appId
    client_secret = $appSecret
    scope         = $scope
    grant_type    = 'client_credentials'
}
$accessTokenResponse = Invoke-RestMethod -Uri $authority -Method Post -Body $body
$accessToken = $accessTokenResponse.access_token

$startDate = Get-Date -Date "2023-03-08"
$endDate = Get-Date -Date "2023-03-09"
$data = Get-CQDData -BearerToken $accessToken -ReportId "calls" -StartDate $startDate -EndDate $endDate

If i use only Get-CQDData without parameters, it is working. But it will ask for sign in popup.

getting the error as:

Get-CQDData : A parameter cannot be found that matches parameter name 'BearerToken'.

If any idea Please suggest on SignIn issue.

Thanks

Satya

Microsoft Teams
Microsoft Teams
A Microsoft customizable chat-based workspace.
9,034 questions
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,526 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
2,829 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Vasil Michev 94,911 Reputation points MVP
    2023-03-10T17:53:56.39+00:00

    There's no such parameter in the cmdlet definition, and afaik the underlying endpoints do not support the client credentials flow.


  2. James Parkes (MSFT) 0 Reputation points Microsoft Employee
    2023-03-13T16:03:04.9833333+00:00

    The CQDPowerShell module requires the user to log in manually and does not support programmatic access. This is to prevent export-type queries from running repeatedly against the CQD back-end and overloading the service.

    I would recommend exploring CallRecords in Graph API to see if that fits your requirements.

    0 comments No comments

  3. James Parkes (MSFT) 0 Reputation points Microsoft Employee
    2023-03-13T16:03:31.86+00:00

    The CQDPowerShell module requires the user to log in manually and does not support programmatic access. This is to prevent export-type queries from running repeatedly against the CQD back-end and overloading the service.

    I would recommend exploring CallRecords in Graph API to see if that fits your requirements.