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