简体   繁体   中英

Microsoft Graph API query parameters via powershell not recognized

I've registered an app using the Azure AD portal which I am successfully accessing using invoke-webrequest from a Powershell script. The app tries to list signins but is returning up to the limit of 1000 signin objects. When I try to use query parameters to restrict the fields and amount of data returned, the web request returns an error saying that the AllowedQueryOptions and EnableQueryAttributes need to be updated for the parameters used, eg. select, top, skip. I've tried v1.0 and beta APIs without success.

Is there a way to manipulate these options via powershell so that the query parameters are recognized? I've seen some references to OAuth and ASP.NET Core to do this. Is powershell the "right" way to automate signin retrieval? Will this functionality to manipulate query options ever come to powershell?

Cheers, -Emanuel

As you mentioned in comments, if it is unnecessary for you to use graph api, I think use Powershell command is an option for your reference.

You can use this command in your Powershell:

Get-AzureADAuditSignInLogs

If you want to use query parameters to restrict the fields and amount of data returned, you can refer to the sample as below:

Get-AzureADAuditSignInLogs -Top 5 | Select-Object -Property Id, UserDisplayName

Hope it helps~

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM