Forum Discussion

midiman810new's avatar
midiman810new
Brass Contributor
Apr 09, 2026

Powershell Entra and General Forum Layout Questions

Hello, 

I am returning to PowerShell, and it seems a lot has changed. 

I need to create some Security Groups in MS Entra and would like to know the best way to do so. 
I have a .csv file for the groups. 

 

Also, what is the best way to display the topic titles as a list in this forum? 

At this moment, I have to go scroll through pages of posts, and it's not easy. I used to like the old formats that let you see all the thread titles. 


Thanks 

1 Reply

  • for the first question we may have an answer but for the second one you need to scroll 

    first one it is recommended to use if you are just touching EntraID use Microsoft.Entra module
    but if you want to touch multiple systems like entra, SharePoint, teams etc. use Microsoft.Graph module


    if i assume this is just for EntraID 

    first install module 

     

    Install-Module Microsoft.Entra -Scope CurrentUser

     

    then you may need something similar to the following 

    if you have columns like 

     

    DisplayName,Description,MailNick,Owner

     

    Connect-Entra -Scopes 'Group.ReadWrite.All','Group.Create','User.Read.All'

     

    $groups = Import-Csv -Path 'Groups.csv'

     

    foreach ($g in $groups) {

    $newGroup = New-EntraGroup `

    -DisplayName $g.DisplayName `

    -Description $g.Description `

    -MailNick $g.MailNickname `

    -MailEnabled $false `

    -SecurityEnabled $true

     

    Write-Host "Created: $($newGroup.DisplayName)" -ForegroundColor Green

     

    if ($g.Owner) {

    $owner = Get-EntraUser -UserId $g.Owner

    Add-EntraGroupOwner -GroupId $newGroup.Id -OwnerId $owner.Id

    }

    }

     

    Disconnect-Entra