How to Update Detection Method for a Win32 App Using Microsoft Graph?

0
15
Asked By TechWhiz123 On

Hey everyone! I'm trying to update the detection method for a Win32 app using the Microsoft Graph API. I understand that the stable version doesn't support this feature, but the beta version does. As an Intune admin, I can manually update the detection method, and I've written a PowerShell script to automate this process. However, I'm running into a "400 Bad Request" error when I try to send an update request. Here's a quick overview of my script and the error I'm getting. Any insights or suggestions on how to resolve this issue would be greatly appreciated!

2 Answers

Answered By CodeNinja88 On

It looks like the Invoke-MgGraph cmdlet operates independently and may not use the session created by Connect-MgGraph. I suggest testing by directly including an authentication token in your request. Have you looked into how to do that?

ScriptGuru99 -

I've encountered similar issues in the past. If you have details on how to retrieve the auth token, sharing that would be super helpful!

Answered By PowerShellPro45 On

Additionally, make sure to include the rule type in your payload. Here’s a tweaked example of how you could structure your script detection:

```powershell
$scriptDetection = @{
"@odata.type" = "#microsoft.graph.win32LobAppPowerShellScriptRule"
ruleType = "detection"
detectionType = "script"
scriptContent = $encodedScript
runAs32Bit = $true
enforceSignatureCheck = $false
}
```
This might resolve the validation failure you're encountering!

TechWhiz123 -

Thanks for the suggestion! I tried incorporating the rule type, but I'm still getting a similar "400 Bad Request" error. It’s frustrating!

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.