powershell script for azure AD group creation

%3CLINGO-SUB%20id%3D%22lingo-sub-1613150%22%20slang%3D%22en-US%22%3Epowershell%20script%20for%20azure%20AD%20group%20creation%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1613150%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20..%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20looking%20for%20a%20help%20in%20making%20a%20script%20to%20create%20a%20group%20in%20Azure%20Active%20Directory.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1613150%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20Active%20Directory%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1618212%22%20slang%3D%22en-US%22%3ERe%3A%20powershell%20script%20for%20azure%20AD%20group%20creation%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1618212%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F715795%22%20target%3D%22_blank%22%3E%40Srini1987%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20used%20to%20be%20more%20complicated%20in%20the%20past%20(calling%20MS%20Graph%20API%20via%20Invoke-RestMethod%20or%20similar)%2C%20but%20now%20with%20AzureAD%20PowerShell%20module%2C%20you%20can%20simply%20use%20a%20single%20cmdlet%20for%20that%20-%20New-AzureADGroup.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMore%20info%20here%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fazuread%2Fnew-azureadgroup%3Fview%3Dazureadps-2.0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fazuread%2Fnew-azureadgroup%3Fview%3Dazureadps-2.0%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20would%20need%20to%20authenticate%20to%20AAD%20first%20using%20Connect-AzureAD%20cmdlet.%20Depending%20on%20whether%20you%20want%20to%20use%20an%20interactive%20logon%20(you%20interacting%20with%20the%20script%20from%20a%20console)%20or%20have%20it%20as%20an%20automated%20background%20task%2C%20you%20would%20need%20to%20read%20more%20details%20about%20it%20here%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2FAzureAD%2FConnect-AzureAD%3Fview%3Dazureadps-2.0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2FAzureAD%2FConnect-AzureAD%3Fview%3Dazureadps-2.0%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Contributor

Hi ..

 

I looking for a help in making a script to create a group in Azure Active Directory.

1 Reply
Highlighted

Hi @Srini1987 ,

 

This used to be more complicated in the past (calling MS Graph API via Invoke-RestMethod or similar), but now with AzureAD PowerShell module, you can simply use a single cmdlet for that - New-AzureADGroup.

 

More info here: https://docs.microsoft.com/en-us/powershell/module/azuread/new-azureadgroup?view=azureadps-2.0

 

You would need to authenticate to AAD first using Connect-AzureAD cmdlet. Depending on whether you want to use an interactive logon (you interacting with the script from a console) or have it as an automated background task, you would need to read more details about it here: https://docs.microsoft.com/en-us/powershell/module/AzureAD/Connect-AzureAD?view=azureadps-2.0