briandelmsft / SentinelAutomationModules

The Microsoft Sentinel Triage AssistanT (STAT) enables easy to create incident triage automation in Microsoft Sentinel
MIT License
201 stars 55 forks source link

[BUG] Permission Script timeout #454

Closed itsjusthaif closed 4 weeks ago

itsjusthaif commented 1 month ago

Describe the bug The Out-Null parameter found in lines 79, 86, 88 causes an issue where the prompt to sign in does not show up. By running the script with that parameter in place, we get a "Authentication timed out after 120 seconds due to inactivity. Please try again." message. I believe this is cause, the authentication prompt is sent to "NULL" and we never see it in the foreground.

We removed the OUT-NULL parameter and the pipe, the script ran OK and provided us with the login URL and TOTP.

Module Name Name of the STAT Module containing the bug (if known) GrantPermission.ps1 script.

To Reproduce Steps to reproduce the behavior:

  1. Lauch Azure CLI
  2. CUpload the default script with tenancy and subscription details and execute
  3. You will notice it errors out due to timeout.

Expected behavior Expected for the script to apply all the permissions listed

Screenshots ![Uploading image.png…]()

Additional context Remove the OUT-NULL parameter and the script runs fine.

piaudonn commented 1 month ago

Interesting, I removed it for this reason for Connect-MgGraph on line 77. But never ran into the issue with Connect-AzAccount. I suppose I was already authenticated in my tests... I'll check again my env and correct it. Thanks @itsjusthaif for the issue submission!

piaudonn commented 1 month ago
image

It actually works for me still, even with the Out-Null. @briandelmsft do you get similar behavior? I am fine with removing the Out-Null here, but I am curious to see what makes the issue not consistent as the whole point of using Azure CLI was to get that level of consistency...

briandelmsft commented 1 month ago

@piaudonn no issues as is on my end, I get both device code prompts and all the permissions get granted without error

piaudonn commented 1 month ago

@itsjusthaif can you share a screenshot?