Coder Social home page Coder Social logo

m365-consultant / entraid-mfa-dynamicgroup Goto Github PK

View Code? Open in Web Editor NEW
13.0 3.0 0.0 22 KB

This solution is designed for an Azure Runbook to assign users to two Entra ID (AzureAD) groups based on their MFA capability (capable / non-capable).

License: MIT License

PowerShell 100.00%
azure-ad conditional-access microsoft-entra multifactor-authentication azureautomationrunbookgallery powershellworkflow

entraid-mfa-dynamicgroup's Introduction

*** WORK IN PROGRESS ***

EntraID-MFA-DynamicGroup

This solution is designed for an Azure Runbook to assign users to two Entra ID (AzureAD) groups based on their MFA capability (capable / non-capable).

The initial reason for this script is to address customers who decided to exclude MFA for trusted locations on their conditional access policies, which I strongly discourage. However, I have observed this practice in multiple environments. Unfortunately, they often overlook the issue that arises when a user never connects from outside the trusted locations. In such cases, the user is never prompted to set up MFA. If the account credentials are compromised, attackers can set up MFA themselves because it is the first time MFA is required for that account. The compromised user can still access resources due to the trusted location exclusion.

To mitigate this issue, a potential solution would be to generally block external access for users without MFA (MFA non-capable) or restrict registration of security information from outside. Unfortunately, Dynamic Groups in Entra ID do not provide the possibility to create a rule based on a user's MFA state.

Requirements

Before using the Azure Runbook, you need to set up an automation account with a managed identity.

The managed identity requires the following Graph Permissions:

  • User.Read.All
  • Group.ReadWrite.All
  • UserAuthenticationMethod.Read.All
  • Mail.Send

The script requires the following modules:

  • Microsoft.Graph.Authentication
  • Microsoft.Graph.Groups
  • Microsoft.Graph.Identity.SignIns
  • Microsoft.Graph.Users
  • Microsoft.Graph.Users.Actions

Parameters

There are a few parameters which must be set for a job run:

  • $groupid_capable
    • The Object-ID of a EntraID (AzureAD) group where MFA capable uers's should be assigned
  • $groupid_noncapable
    • The Object-ID of a EntraID (AzureAD) group where MFA NON-capable uers's should be assigned
  • $mailMode -> This controls the mail behavior. Enter the mode you want without using '
    • 'always' - sends a mail on every run
    • 'changes' - sends a mail only if there were any changes
    • 'disabled' - never send a mail
  • $mailSender
    • The mail-alias from which the mail will be send (can be a user-account or a shared-mailbox)
  • $mailRecipients
    • The recipient(s) of the mail (internal or external). If you want more than one recipient, you can separate them with the character ; in between.

Changelog

  • v0.4 Email-Reporting implementation / changing from variables to parameters
    • Implemented a email reporting which requires the permission 'Mail.Send' and the Graph-Module 'Microsoft.Graph.Users.Actions'
    • Changed from variables to parameters, which makes handling within Azure Runbooks easier
  • v0.3 First release
    • First release of this script

entraid-mfa-dynamicgroup's People

Contributors

m365-consultant avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

entraid-mfa-dynamicgroup's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.