A cloud-based identity and access management service for securing user authentication and resource access
It seems It is working now and thank so much for your help and for your prompt replies ..
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am Looking for an Script where i can create 500 Security Groups by Bulk Import Power shell cmdlet and Add Group Owners in Azure AD at the same time .
Please help !!!
A cloud-based identity and access management service for securing user authentication and resource access
It seems It is working now and thank so much for your help and for your prompt replies ..
Still No Luck ,Got this Error ...
Get-AzureADUser : Cannot bind argument to parameter 'ObjectId' because it is an empty string.
At line:2 char:44
New-AzureADGroup : Cannot bind argument to parameter 'DisplayName' because it is an empty string.
At line:3 char:44
Add-AzureADGroupOwner : Error occurred while executing AddGroupOwner
Code: Request_BadRequest
Message: One or more added object references already exist for the following modified properties: 'owners'.
RequestId: e2945e74-a689-4209-b8ea-2110bb370b37
DateTimeStamp: Sun, 18 Sep 2022 13:44:28 GMT
HttpStatusCode: BadRequest
HttpStatusDescription: Bad Request
HttpResponseStatus: Completed
At line:4 char:2
Get-AzureADUser : Cannot bind argument to parameter 'ObjectId' because it is an empty string.
At line:2 char:44
New-AzureADGroup : Cannot bind argument to parameter 'DisplayName' because it is an empty string.
At line:3 char:44
Add-AzureADGroupOwner : Error occurred while executing AddGroupOwner
Code: Request_BadRequest
Message: One or more added object references already exist for the following modified properties: 'owners'.
RequestId: 82b8d083-4ebd-44b5-b964-470111693e20
DateTimeStamp: Sun, 18 Sep 2022 13:44:28 GMT
HttpStatusCode: BadRequest
HttpStatusDescription: Bad Request
HttpResponseStatus: Completed
At line:4 char:2
There is a minor mistake in the script. Sorry!
Please try this:
Import-Csv -Path "c:\temp\GroupsC.csv" | ForEach-Object {
$ownerUserObj = Get-AzureADUser -ObjectId $_.GroupOwner
$newGroup = New-AzureADGroup -DisplayName $_.GroupName -SecurityEnabled $true -MailEnabled $false -MailNickName "NotSet"
Add-AzureADGroupOwner -ObjectId $newGroup.ObjectId -RefObjectId $ownerUserObj.ObjectId
}
----------
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
Regards
Andreas Baumgarten
Hi Mourya,
Thanks for reaching out to Microsoft Q&A.
Please refer the below links, these has directions and steps.
EDIT
Please ignore the links above as it is related to Azure AD on-prem, I suggest you to refer the link posted by @Andreas Baumgarten
Please Upvote and Accept as answer if the reply was helpful.
Hi @Mourya, Aditya ,
maybe this helps to get started: https://morgantechspace.com/2021/12/create-security-group-and-add-members-in-azure-ad-using-powershell.html
Do you have a CSV file with the names of the new AD groups and the related AD user (owner)?
----------
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
Regards
Andreas Baumgarten