question

SindhushreeKP-5250 avatar image
0 Votes"
SindhushreeKP-5250 asked ShivaniRai-MSFT-7217 commented

Add groupmember to security group - Error 400 Bad Request

Hi,

I followed the doc here - https://docs.microsoft.com/en-us/graph/api/group-post-members?view=graph-rest-1.0&tabs=http and written powershell script to add group member using rest API's for one of my automations. But its throwing 400 status code - Bad request.
I have passed right group ID and User ID, content type as per doc. There is no duplicates in the Group, still not working. Tried to convert Json still no luck.
Asked question here as well - https://stackoverflow.com/questions/72185051/invoke-restmethod-the-remote-server-returned-an-error-400-bad-request-azur

Kindly help me out to fix this

microsoft-graph-groups
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

ShivaniRai-MSFT-7217 avatar image
0 Votes"
ShivaniRai-MSFT-7217 answered ShivaniRai-MSFT-7217 commented

Hi @SindhushreeKP-5250,

According to this documentation 400 Bad Request response code comes when the user is already a member of the group. And I can replicate the same.
But as you mentioned the user is not the duplicated one then I would advise you to raise a support case with Microsoft Graph, a Support Engineer will be able to assist you better. You can raise support ticket from http://aad.portal.azure.com/ or https://admin.microsoft.com/#/support/requests.

Just a thought Is it an ad synced group?

Hope this helps.

If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.

· 2
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.

Yes, it is AD synced group. Is that an issue here?

0 Votes 0 ·

@SindhushreeKP-5250,
If the group is synced from on premises Windows AD they cannot be managed in Azure AD. They must be managed on-prem with tools like the Active Directory Users and Computers. Changes made there will sync up to Azure AD with Azure AD Connect.
Since you can not manage AD synced groups, graph will not be able to update group membership.
Refer to this documentation https://docs.microsoft.com/en-us/microsoft-365/community/all-about-groups#who-can-manage-azure-ad-security-groups

If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.

1 Vote 1 ·