# Azure AD security groups

**URL:** <https://forums.powershell.org/t/azure-ad-security-groups/24518>\
**Category:** PowerShell Help\
**Created:** [July 31, 2024, 3:58pm UTC](https://forums.powershell.org/t/azure-ad-security-groups/24518 "2024-07-31T15:58:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![keyur\_1991](https://avatars.discourse-cdn.com/v4/letter/k/d2c977/32.png) [@keyur\_1991](https://forums.powershell.org/u/keyur_1991)\
**Post date:** [July 31, 2024, 3:58pm UTC](https://forums.powershell.org/t/azure-ad-security-groups/24518/1 "2024-07-31T15:58:05Z")

</div>

Hello Everyone

- I am keep getting requests to change AAD group owner and I tried using PowerShell but not able to change with any of modules - I tried Azad and mgGraph
- can you please help with this
- thanks

---

<div class="post-metadata">

**Author:** ![matt-bloomfield](https://avatars.discourse-cdn.com/v4/letter/m/dec6dc/32.png) [@matt-bloomfield](https://forums.powershell.org/u/matt-bloomfield)\
**Post date:** [July 31, 2024, 5:42pm UTC](https://forums.powershell.org/t/azure-ad-security-groups/24518/2 "2024-07-31T17:42:48Z")

</div>

Hi, welcome to the forum 👋

Difficult to know what the problem is as you’ve not posted any code or error messages. However, using Graph, the basic command to add a group owner is:

```PowerShell
New-MgGroupOwner -GroupId <group id> -DirectoryObjectId <user id>

```

If you do decide to share code, please make sure to use the \</\> button to format it correctly. If you cannot see the \</\> button it will be hiding under the gear icon.

---

<div class="post-metadata">

**Author:** ![keyur\_1991](https://avatars.discourse-cdn.com/v4/letter/k/d2c977/32.png) [@keyur\_1991](https://forums.powershell.org/u/keyur_1991)\
**Post date:** [August 1, 2024, 2:29pm UTC](https://forums.powershell.org/t/azure-ad-security-groups/24518/3 "2024-08-01T14:29:13Z")

</div>

Thank you so much  
i am getting this error - pfa

 ![Screenshot 2024-08-01 at 10.27.09 AM](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/2X/4/40b35404f44f1aafe026d47060423bd47037e316.jpeg)

---

<div class="post-metadata">

**Author:** ![matt-bloomfield](https://avatars.discourse-cdn.com/v4/letter/m/dec6dc/32.png) [@matt-bloomfield](https://forums.powershell.org/u/matt-bloomfield)\
**Post date:** [August 1, 2024, 2:46pm UTC](https://forums.powershell.org/t/azure-ad-security-groups/24518/4 "2024-08-01T14:46:39Z")

</div>

You need to use either `$groupID.Id` for the parameter or

```auto
Select-Object -ExpandProperty Id

```

when you query the group.

---

<div class="post-metadata">

**Author:** ![keyur\_1991](https://avatars.discourse-cdn.com/v4/letter/k/d2c977/32.png) [@keyur\_1991](https://forums.powershell.org/u/keyur_1991)\
**Post date:** [August 1, 2024, 3:03pm UTC](https://forums.powershell.org/t/azure-ad-security-groups/24518/5 "2024-08-01T15:03:52Z")

</div>

Thank you so much - its working now

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/1X/385e4f9fe133561ad30a814262fe0e0ae6bc3ef0.png) [@system](https://forums.powershell.org/u/system)\
**Post date:** [August 31, 2024, 3:04pm UTC](https://forums.powershell.org/t/azure-ad-security-groups/24518/6 "2024-08-31T15:04:53Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
