Home > Blockchain >  Create Group in Azure AD creating a group which is already exists in AzureAD using Graph API
Create Group in Azure AD creating a group which is already exists in AzureAD using Graph API

Time:08-10

I am trying to create group in Azure AD using graph APIs. I am not sure why duplicate entry is getting added for Group, Expected is Only one entry for Group should be present and if we try to add new entry for group which is already exist it should throw some error for duplicate element but its not happening. 2 entries for group is getting created with different Object Id. Can someone please suggest on this?

CodePudding user response:

Please note that, Azure AD groups don't have UPNs like Azure AD users. They allow duplicate display names whereas ObjectID of those groups remain unique.

If you want it to throw error for duplicate values, you can make use of mailNickname attribute that doesn't support creation of groups if the value already exists.

I tried to reproduce the same in my environment and got the below results:

I created one Azure AD group with below properties via Graph API:

POST https://graph.microsoft.com/v1.0/groups
{
"description": "Sri",
"displayName": "Sri",
"groupTypes": [
"Unified"
],
"mailEnabled": true,
"mailNickname": "sri",
"securityEnabled": false
}

enter image description here

When I tried to create another Azure AD group with same properties, I got the error like below:

enter image description here

When I tried to create another Azure AD group with same DisplayName and different mailNickname , I was able to create Azure AD group successfully like below:

enter image description here

AFAIK, it's not possible to get error while creating groups with duplicate display names.

  • Related