-
-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invoke-MGGraphRequest 400 Bad Request #11
Comments
Looks like it is failing when grabbing the existing devices, might be worth checking the permissions on your app reg |
Thank you will check this out, the app have been working for months so not sure why it needs new permissions. But i will look into this tomorrow.
…________________________________
From: Andrew Taylor ***@***.***>
Sent: Monday, December 11, 2023 5:46:36 PM
To: andrew-s-taylor/WindowsAutopilotInfo ***@***.***>
Cc: Jimmy Winberg ***@***.***>; Author ***@***.***>
Subject: Re: [andrew-s-taylor/WindowsAutopilotInfo] Invoke-MGGraphRequest 400 Bad Request (Issue #11)
Looks like it is failing when grabbing the existing devices, might be worth checking the permissions on your app reg
—
Reply to this email directly, view it on GitHub<#11 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AHHIZOYZ2C75HT4P5VU2ZZLYI42GZAVCNFSM6AAAAABAQB3752VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJQGQ3DGMJZGM>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Just tried giving it even more permissions, same issue.
Device.ReadWrite.All
DeviceManagementConfiguration.ReadWrite.All
DeviceManagementManagedDevices.PrivilegedOperations.All
DeviceManagementManagedDevices.ReadWrite.All
DeviceManagementServiceConfig.ReadWrite.All
Not sure what permission I'm missing here
…________________________________
Från: Andrew Taylor ***@***.***>
Skickat: den 11 december 2023 17:46
Till: andrew-s-taylor/WindowsAutopilotInfo ***@***.***>
Kopia: Jimmy Winberg ***@***.***>; Author ***@***.***>
Ämne: Re: [andrew-s-taylor/WindowsAutopilotInfo] Invoke-MGGraphRequest 400 Bad Request (Issue #11)
Looks like it is failing when grabbing the existing devices, might be worth checking the permissions on your app reg
—
Reply to this email directly, view it on GitHub<#11 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AHHIZOYZ2C75HT4P5VU2ZZLYI42GZAVCNFSM6AAAAABAQB3752VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJQGQ3DGMJZGM>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Can you try v4.0.4 which I have just uploaded and see if that works? Looks like something has broken in the latest Graph SDK |
Working perfectly now.
Super fast fix, tank you Andrew
…________________________________
Från: Andrew Taylor ***@***.***>
Skickat: den 11 december 2023 18:47
Till: andrew-s-taylor/WindowsAutopilotInfo ***@***.***>
Kopia: Jimmy Winberg ***@***.***>; Author ***@***.***>
Ämne: Re: [andrew-s-taylor/WindowsAutopilotInfo] Invoke-MGGraphRequest 400 Bad Request (Issue #11)
Can you try v4.0.4 which I have just uploaded and see if that works? Looks like something has broken in the latest Graph SDK
—
Reply to this email directly, view it on GitHub<#11 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AHHIZO5B6P7CEE57KJXLUYLYI5BMLAVCNFSM6AAAAABAQB3752VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJQGU3TIOJZGU>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Where can I find v4.0.4? Last I can see if 4.0.3. |
Should be there now |
Thanks I found it on ps gallery but tried the one on github as well. Unfortunately for me the error remains. Connected to Intune tenant TENANTID using app-based authentication (Azure AD authentication not supported)
|
I'm trying to work out what has broken in 2.0.11 of the auth module. |
Assuming you mean v2.10.0 of microsoft.graph.authentication, I tried forcing that version and the error remains. |
Can you try 2.9.1, it definitely works on that version. Something has broken in pagination after that |
2.9.1 isnt erroring out immediately but it is taking a lot longer on the 'loading all objects' step than it used to. We have 100k+ devices so Ill give it time. As of last week I had successfully used v3.0.5 of the community script and it must have been using 2.10.0 of graph auth. |
I see that the new scripts added delete/update features but appears to require pulling the entirety of our device list. Given the amount of devices we have, this probably will not be good for our use time wise. Fortunately, reverting to v3.0.5 of the script and specifying 2.10.0 of the graph auth gets us working again. Ill revisit at a later date to see about updating to the new version. Thanks for the awesomeness! |
I've added a "-newdevice" parameter to 4.0.5 which will skip that bit and should speed it up. Forced a lower auth module as well |
This should be resolved in the new 2.11.1 graph authentication module |
Running: Get-WindowsAutopilotInfoCommunity -Online -TenantId $tenantId -AppId $appId -AppSecret $StoredSecret -GroupTag $GroupTagValue
Invoke-MGGraphRequest : GET https://graph.microsoft.com/beta/devices%3F%24skiptoken%XXXXXXXXX
HTTP/1.1 400 Bad Request
Transfer-Encoding: chunked
Vary: Accept-Encoding
Strict-Transport-Security: max-age=31536000
request-id: XXXXXXX
client-request-id: XXXXXXXXX
x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"West Europe","Slice":"E","Ring":"5","ScaleUnit":"001","RoleInstance":"AM4PEPF0001511F"}}
Date: Mon, 11 Dec 2023 16:27:42 GMT
Content-Encoding: gzip
Content-Type: application/json
{"error":{"code":"BadRequest","message":"Resource not found for the segment 'devices?$skiptoken=XXXXXXXXXXXXX'.","innerError":{"date":"2023-12-11T16:27:43","request-id":"XXXXXXXXXX","client-request
-id":"XXXXXXXXXXXX"}}}
At C:\Program Files\WindowsPowerShell\Scripts\get-windowsautopilotinfocommunity.ps1:1933 char:35
}:HttpRequestMessage) [Invoke-MgGraphRequest], HttpResponseException
Adding New Device serial XXXXXXXX
Waiting for 1 of 1 to be imported
The text was updated successfully, but these errors were encountered: