Forum Discussion

therealkristaps's avatar
therealkristaps
Copper Contributor
Jun 17, 2021

Multiple values to -ObjectId ?

Hello world,

 

I am little bit concerned about whether I can add multiple values to -ObjectId as in the example below? I need to test this in production, but I am a bit unsure. Here's a part of the code:

 

Connect-AzAccount -Credential $ADDcredentials -Subscription '*****-*****-*****-*****'
$ADDmembers = Get-AzADGroupMember -ObjectId "*****-*****-*****-*****"
return $ADDmembers
 
The question is if I can add multiple values somehow to object ID?
 
Thanks a lot in advance.

2 Replies

  • Schnittlauch's avatar
    Schnittlauch
    Steel Contributor
    Hi therealkristaps ,

    Welcome to the MTC!
    I would try it with foreach. Just put the values in a csv.

    I have never try it. Anything like this:

    Foreach ($testobject in $ImportOfObjectIDs) {Get-AzADGroupMember -ObjectId "$testobject")

    Try it yourself, if you don't reach more, write a small comment.

    Schnittlauch

Resources