Forum Discussion
oskarkuus
Jan 28, 2023Brass Contributor
Powershell script that add newly created group to an administrative unit
I have this script. # Import the AzureAD PowerShell module
Import-Module AzureAD
# Connect to Azure AD
Connect-AzureAD
# Define the path to the CSV file
$filePath = "groupimport1.csv"
# Defin...
- Jan 29, 2023
Hello oskarkuus,
You need to use Add-AzureADAdministrativeUnitMember
from AzureADPreview module.
In order to complete your script you would include something similar into your foreach:
Add-AzureADAdministrativeUnitMember -ObjectId $auID -RefObjectId $groupIdHope that helps.
AndySvints
Jan 29, 2023Steel Contributor
Hello oskarkuus,
You need to use Add-AzureADAdministrativeUnitMember
from AzureADPreview module.
In order to complete your script you would include something similar into your foreach:
Add-AzureADAdministrativeUnitMember -ObjectId $auID -RefObjectId $groupId
Hope that helps.