I’m have some groups on azure, which I’m retriving with Get-AzADGroup like so:
Get-AzADGroup -Filter "startsWith(DisplayName, ‘groupname’)"
which yields the displayname, the id, the mailnickname and the discription..
What I want to do is to get the ID only and put it into a variable. How do I do this?
2
Answers
To return only specific properties, you can pipe the results into
Select-Object
and specify which propertiesAlternatively, you can store the entire results in the variable, and use dot-notation to get a specific property
😆 I spent all day in Graph doing this very thing.
Eight hours and four lines of code. I love my work.
If it were me, I would try,
(Get-AzADGroup -Filter "startsWith(DisplayName, 'groupname')").ID