PROACTIVERISK
  • > About
    • Mission | People
    • Capabilities Statement
    • Blog
    • 800 lb Gorilla
    • Press & Events
    • Videos
    • Careers
    • Books & Tools
    • Referral Program
    • Portals > >
      • Client Portal
      • Staff Portal
  • > Assess
    • Framework Audit
    • AI Investigate
    • RED/BLUE TEAM
    • Continuous Testing
    • 365 Tenant Assessment
    • Industrial Controls
    • Digital Evidence
    • Table Top Exercises
  • > Train
    • Talent Acquisition
    • Threat Modeling
    • Virtual and Physcial
  • > Manage
    • Fractional CISO
    • 365 Protect
    • Vendor Risk Management
    • Managed Security Awareness
    • Physical Security
    • Custom Software
    • ContinuityXpert
    • Technology Support
  • > Industry
    • State and Local Gov.
    • Legal and Accounting Firms:
    • Financial Technology
    • Healthcare

GRAY BEARD BLOG

SHARING RANDOM THOUGHTS ON TECH

POWERSHELL

1/19/2023

 
icrosoft PowerShell is a powerful tool that can be used to automate various tasks in Azure, including the creation of users. One way to create multiple users in an Azure tenant is by using a .csv file that contains the necessary information for each user. In this tutorial, we will walk through the steps of using PowerShell to create users in an Azure tenant from a .csv file.
  1. First, open the PowerShell ISE and connect to your Azure tenant by running the command Connect-AzAccount. You will be prompted to enter your Azure credentials.
  2. Next, create a new .csv file that contains the necessary information for the users you want to create. The .csv file should have the following headers: "UserName", "Password", "DisplayName", and "MailNickname". Each row should contain the information for a single user.
  3. Import the .csv file into PowerShell by running the command $users = Import-Csv -Path "path\to\file.csv". Replace "path\to\file.csv" with the actual path to your .csv file.
  4. Loop through each user in the .csv file using the command foreach ($user in $users).
  5. Within the loop, create a new Azure AD user by running the command New-AzADUser -UserPrincipalName $user.UserName -DisplayName $user.DisplayName -MailNickName $user.MailNickname -AccountEnabled $true -Password (ConvertTo-SecureString -String $user.Password -AsPlainText -Force)
  6. End the loop by running }
  7. Run the script and it will create users in your azure tenant.
Note: Make sure that you are running these commands in Azure AD PowerShell module and also that you have the necessary permissions to create users in your Azure tenant.
By following these steps, you can use PowerShell to automate the creation of multiple users in an Azure tenant from a .csv file. This can save a lot of time and effort compared to manually creating each user, especially if you need to create a large number of users.

Comments are closed.

    Categories

    All
    CMMC
    COMMUNITY
    TECHTIP

    Tom Brennan

    This is my blog, there are many like it but this one is mine. Enjoy.

    View my profile on LinkedIn

    BLOG Archives

    May 2025
    February 2025
    January 2025
    November 2024
    August 2024
    June 2024
    May 2024
    April 2024
    February 2024
    January 2024
    December 2023
    November 2023
    September 2023
    August 2023
    March 2023
    February 2023
    January 2023
    December 2022
    November 2022
    August 2022
    April 2022
    August 2021
    March 2021
    January 2021
    August 2020

    RSS Feed

Contact Us
🏢 ​New Jersey Headquarters
290 W Mt. Pleasant Ave, Suite 11309
Livingston, NJ 07039

☎️ 973-298-1160 | GPS Map
Client Portal
ManageIT Remote

​
© COPYRIGHT 2024. ALL RIGHTS RESERVED.
  • > About
    • Mission | People
    • Capabilities Statement
    • Blog
    • 800 lb Gorilla
    • Press & Events
    • Videos
    • Careers
    • Books & Tools
    • Referral Program
    • Portals > >
      • Client Portal
      • Staff Portal
  • > Assess
    • Framework Audit
    • AI Investigate
    • RED/BLUE TEAM
    • Continuous Testing
    • 365 Tenant Assessment
    • Industrial Controls
    • Digital Evidence
    • Table Top Exercises
  • > Train
    • Talent Acquisition
    • Threat Modeling
    • Virtual and Physcial
  • > Manage
    • Fractional CISO
    • 365 Protect
    • Vendor Risk Management
    • Managed Security Awareness
    • Physical Security
    • Custom Software
    • ContinuityXpert
    • Technology Support
  • > Industry
    • State and Local Gov.
    • Legal and Accounting Firms:
    • Financial Technology
    • Healthcare