Forum Discussion
How to make source code from CQDPowerShell cmdlet acquiring access token non-interactively
I have contacted the owner of the PowerShell cmdlet, he told me that there is no non-interactive way of getting the access token.
hi there š
Oleksii_Kolinko just wondering if you have found a way to do non-interactive login on the CQDPowerShell module.
thanks,
Ed
- Oleksii_KolinkoJan 08, 2021Copper Contributor
I did not found the way. It does not exist. I got a response from a developer of the module.
- jonvasbarMar 10, 2021Copper Contributor
Hi Oleksii_Kolinko. Do you know if thereĀ“s a way to request to the developers of the CQD to enable the option "Allow public client flows" for the Microsoft Application: Call Quality Dashboard, Client Id: c61d67cf-295a-462c-972f-33af37008751?
For the moment, I already voted to your request in Teams User Voice:
Thanks.
- hdsouza1Jul 28, 2021Copper Contributor
I tried passing credentials to Invoke-WebRequest (Similar issue to https://docs.microsoft.com/en-us/answers/questions/290269/invoke-webrequest-to-get-access-token-for-system-a.html), but this did not get the token (in $response.content). What else do I need to add to this code to get the token?
$AdminName = "r987327" $Pass = Get-Content "encrypted_pass.txt" | ConvertTo-SecureString $cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $AdminName, $Pass $configRest = Invoke-RestMethod -Uri "https://cqd.teams.microsoft.com/repository/clientconfiguration" -Method Get -SessionVariable WebSession -UserAgent "CQDPowerShell V2.0" $WebResource = $configRest.AuthLoginResource $client_id = $configRest.AuthWebAppClientId Add-Type -AssemblyName System.Web $resourceUrl = $WebResource $redirectUrl = "https://cqd.teams.microsoft.com/spd/" $nonce = [guid]::NewGuid().GUID $url = "https://login.microsoftonline.com/common/oauth2/authorize?response_type=token&redirect_uri=" + [System.Web.HttpUtility]::UrlEncode($redirectUrl) + "&client_id=$client_id" + "&prompt=login" + "&nonce=$nonce" + "&resource=" + [System.Web.HttpUtility]::UrlEncode($WebResource) $response = Invoke-WebRequest -Uri $url -Method GET -Headers @{Metadata="true"} -Credential $cred