Forum Discussion
Powershell Entra and General Forum Layout Questions
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