IdentityProtectionTools icon indicating copy to clipboard operation
IdentityProtectionTools copied to clipboard

Errors with Variables and Module - Work around

Open HoneyPotHive opened this issue 3 years ago • 0 comments

Variables kept erroring out saying there was no value assigned to them $Riskyusers and Module not loading/importing properly. Tried:

  • Making it a environment variable
  • Import-Module
  • Tried adding it via directory.
  • I not big brained enough to correct others code.

I was needing something like this for filtering the data around here's what I had to do as a work around if anyone else need it, after trying to get the module to work.

Work around for getting high, medium, and low alerts.

Install-module Microsoft.Graph.Authentication,Microsoft.Graph.Identity.SignIns,Microsoft.Graph


#Connect to Graph and select the right profile for commands to work.
#-----------------------------------------------------------
$apiPermissionScopes = @("IdentityRiskyUser.Read.All", "IdentityRiskyUser.ReadWrite.All")
Connect-Graph -Scopes $apiPermissionScopes **# Login to your Admin account**
Select-MgProfile -name beta 

#Variables form low, medium, to high risky users.
#-----------------------------------------------------------
$low = Get-MgRiskyUser -Filter "RiskLevel eq 'low'" 
$medium = Get-MgRiskyUser -Filter "RiskLevel eq 'medium'"
$high = Get-MgRiskyUser -Filter "RiskLevel eq 'high'" 

#Invoke a dismiss based on UserId.
#-----------------------------------------------------------
Invoke-MgDismissRiskyUser -UserIds <string>

Doc and Resources

Microsoft Graph Microsoft.Graph.Identity.SignIns Get-MgRiskyUser Invoke-MgDismissRiskyUser

HoneyPotHive avatar May 09 '22 22:05 HoneyPotHive