Skip to content

How to Automate Guest Account UserType Updates in Microsoft Entra with PowerShell

Managing guest user accounts in Microsoft Entra (formerly Azure Active Directory) is a critical aspect of maintaining the security and functionality of your organization’s tenant. Guest accounts often require specific permissions that differ from those of regular users, and sometimes, it becomes necessary to elevate these permissions by changing the account type from Guest to Member. This upgrade can offer more granular control over what resources the guest can access. In this post, we’ll explore a PowerShell script designed to streamline this process, making it efficient and manageable, especially for large organizations.

Why Update Guest UserTypes?

Guest accounts are typically restricted to fewer permissions than full members. By converting a guest account to a member type, you can grant them broader access to resources, improving collaboration with partners, contractors, or vendors who need more in-depth access to your tenant’s resources. This transition is vital for ensuring that your organization’s collaborative efforts are not hindered by permission-related issues.

Introducing the PowerShell Script

The script, named Update-GuestUserTypes.ps1, automates the process of identifying guest accounts within a specific time frame and updating their UserType from Guest to Member. This script not only saves time but also reduces the potential for human error during the update process.

Features

  • Connectivity to Microsoft Entra: The script begins by establishing a connection to Microsoft Entra, ensuring that all subsequent commands are executed within your tenant’s context.
  • Custom Time Frame Input: Users can specify the start and end dates to focus on guest accounts created within a particular period, making the script adaptable to your needs.
  • Display and Selection of Guest Accounts: It lists all identified guest accounts, providing an option to update either a single user or all found guest accounts. This flexibility allows administrators to execute updates with precision.
  • Confirmation Prompts: Before proceeding with any changes, the script seeks confirmation, adding a layer of safety to prevent unintended updates.
  • Export to Text File: After updates, the script exports the details of updated accounts to a text file, offering an easy way to review changes.

Step-by-Step Guide

  1. Ensure Prerequisites: Before running the script, make sure you have the AzureAD PowerShell Module installed and that you have sufficient permissions to modify user accounts in your tenant.
  2. Running the Script: Launch PowerShell as an administrator and execute the Update-GuestUserTypes.ps1 script. Follow the on-screen prompts to connect to your Microsoft Entra tenant and specify the date range for the guest accounts you wish to update.
  3. Selecting Accounts for Update: After the script displays the guest accounts, you can choose to update a specific user or all users at once. The script will then proceed to update the UserType as per your selection.
  4. Reviewing the Changes: Upon completion, the script generates a text file with the details of the updated accounts. This file serves as a log for the changes made during the execution.

Conclusion

This PowerShell script is an invaluable tool for administrators looking to streamline the management of guest user accounts in Microsoft Entra. By automating the process of updating user types, the script not only saves time but also enhances the security and collaboration capabilities of your tenant. Whether you’re dealing with a handful of guest accounts or managing a large-scale tenant with numerous external collaborators, Update-GuestUserTypes.ps1 offers a straightforward and efficient solution to upgrade guest permissions seamlessly.

Github Link to Script Link

Remember, while this script significantly simplifies the process, always ensure you have a backup and understand the implications of changing user types in your environment. Happy scripting!

Sharing is caring!

Published inActive DirectoryAzure Active DirectoryMicrosoft EntraPowerShellSecurity

Be First to Comment

Leave a Reply

Your email address will not be published.