Skip to main content

entra group add

Creates a Microsoft Entra group

Usage

m365 entra group add [options]

Alias

m365 aad group add [options]

Options

-n, --displayName <displayName>

The name for the group. The maximum length is 256 characters.

-d, --description [description]

The description for the group.

-t, --type <type>

The group type. Valid values: microsoft365 or security.

-m, --mailNickname [mailNickname]

The mail alias for the group (part before the @). Maximum length is 64 characters.

--ownerIds [ownerIds]

Comma-separated list of IDs of Microsoft Entra ID users that will be group owners. Specify either ownerIds or ownerUserNames, but not both.

--ownerUserNames [ownerUserNames]

Comma-separated list of UPNs of Microsoft Entra ID users that will be group owners. Specify either ownerIds or ownerUserNames, but not both.

--memberIds [memberIds]

Comma-separated list of IDs of Microsoft Entra ID users that will be group members. Specify either memberIds or memberUserNames, but not both.

--memberUserNames [memberUserNames]

Comma-separated list of UPNs of Microsoft Entra ID users that will be group members. Specify either memberIds or memberUserNames, but not both.

--visibility [visibility]

Specifies the group join policy and group content visibility for Microsoft 365 groups. Possible values are: Private, Public, or HiddenMembership. Defaults to Public. Specify only when creating a group of type microsoft365.

-h, --help [help]

Output usage information. Optionally, specify which section of command's help you want to see. Allowed values are options, examples, remarks, response, full. Default is options.

--query [query]

JMESPath query string. See http://jmespath.org/ for more information and examples.

-o, --output [output]

Output type. json, text, csv, md, none. Default json.

--verbose

Runs command with verbose logging.

--debug

Runs command with debug logging.

Remarks

info

The visibility option affects the behavior of the group.

With the Public visibility:

  • Anyone can join the group without needing owner permission.
  • Anyone can view the attributes of the group.
  • Anyone can see the members of the group.

With the Private visibilty:

  • Owner permission is needed to join the group.
  • Anyone can view the attributes of the group.
  • Anyone can see the members of the group.

With the HiddenMembership visibility:

  • Owner permission is needed to join the group.
  • Guest users cannot view the attributes of the group.
  • Non-members cannot see the members of the group. This setting doesn't affect visibility of group owners.
  • Administrators (global, company, user, and helpdesk) can view the membership of the group.
  • The group appears in the global address book (GAL).
note

The HiddenMembership visibility can be set only for Microsoft 365 groups when the groups are created. It can't be updated later.

This command allows using unknown options. For a comprehensive list of group properties, please refer to the Graph documentation page.

If the specified option is not found, you will receive a Resource 'xyz' does not exist or one of its queried reference-property objects are not present. error.

Examples

Create a security group without any owners or members

m365 entra group add --displayName Developers --type security

Create a private Microsoft 365 group with owners and members and a custom mail address

m365 entra group add --displayName Developers --type microsoft365 --mailNickname devs --ownerUserNames john.doe@contoso.com --memberUserNames "john.doe@contoso.com,adele.vance@contoso.com" --visibility Private

Create a public Microsoft 365 group without any owners or members

m365 entra group add --displayName Developers --type microsoft365 --description "This group is for all developers in the company." --visibility Public

Response

{
"id": "ae0e8388-cd70-427f-9503-c57498ee3337",
"deletedDateTime": null,
"classification": null,
"createdDateTime": "2024-01-10T11:33:18Z",
"creationOptions": [],
"description": "This group is for all developers in the company.",
"displayName": "Developers",
"expirationDateTime": null,
"groupTypes": [
"Unified"
],
"isAssignableToRole": null,
"mail": "devs@contoso.com",
"mailEnabled": true,
"mailNickname": "devs",
"membershipRule": null,
"membershipRuleProcessingState": null,
"onPremisesDomainName": null,
"onPremisesLastSyncDateTime": null,
"onPremisesNetBiosName": null,
"onPremisesSamAccountName": null,
"onPremisesSecurityIdentifier": null,
"onPremisesSyncEnabled": null,
"preferredDataLocation": null,
"preferredLanguage": null,
"proxyAddresses": [
"SMTP:devs@contoso.com"
],
"renewedDateTime": "2024-01-10T11:33:18Z",
"resourceBehaviorOptions": [],
"resourceProvisioningOptions": [],
"securityEnabled": true,
"securityIdentifier": "S-1-12-1-2920186760-1115671920-1959068565-926150296",
"theme": null,
"visibility": "Public",
"onPremisesProvisioningErrors": [],
"serviceProvisioningErrors": []
}
CTRL + M