question

TanojMahishkar-8628 avatar image
0 Votes"
TanojMahishkar-8628 asked alfredorevilla-msft edited

How to add Webhook Automation account to Multiple Azure AD Groups using powershell?

Hi,

we have an Automation account which we use for Azure runbooks , if we add this account to Azure AD group then only the runbook will be able to add the devices etc to that AAD Group

now we have over 100 of such AAD Groups, is there a powershell script which helps us to add this Automation account to all the AAD Groups from a text file ?

azure-active-directory
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

alfredorevilla-msft avatar image
0 Votes"
alfredorevilla-msft answered alfredorevilla-msft edited

Hello @tanojmahishkar-8628, supposing your text file is groups.txt and contains the object ids for all the groups:

(cat .\groups.txt)|foreach { Add-AzureADGroupMember -ObjectId $_ -RefObjectId <AZURE AUTOMATION ACCOUNT SERVICE PRINCIPAL OBJECT ID> }


Let us know if this answer was helpful to you. If so, please remember to accept it so that others in the community with similar questions can more easily find a solution.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.