import Global from '../../_global.mdx';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# entra group list

Lists Entra groups

## Usage

```sh
m365 entra group list [options]
```

## Options

```md definition-list
`--type [type]`
: Filter the results to only groups of a given type. Allowed values: `microsoft365`, `security`, `distribution`, `mailEnabledSecurity`. By default, all groups are listed.

`-p, --properties [properties]`
: Comma-separated list of properties to retrieve.
```

<Global />

## Remarks

Using the `--properties` option, you can specify a comma-separated list of group properties to retrieve from the Microsoft Graph. If you don't specify any properties, the command will output the default properties returned by Graph.

## Permissions
<Tabs>
  <TabItem value="Delegated">

  | Resource        | Permissions    |
  |-----------------|----------------|
  | Microsoft Graph | Group.Read.All |

  </TabItem>
  <TabItem value="Application">

  | Resource        | Permissions    |
  |-----------------|----------------|
  | Microsoft Graph | Group.Read.All |

  </TabItem>
</Tabs>

## Examples

Lists all groups defined in Entra ID.

```sh
m365 entra group list
```

List all security groups defined in Entra ID with specified properties.

```sh
m365 entra group list --type security --properties "mail,displayName"
```

## Response

<Tabs>
  <TabItem value="JSON">

  ```json
  [
    {
      "id": "04e9637c-79d4-4c45-80fb-56fe35f84cf2",
      "deletedDateTime": null,
      "classification": null,
      "createdDateTime": "2019-04-22T09:24:11Z",
      "creationOptions": [
        "HubSiteId:00000000-0000-0000-0000-000000000000",
        "ProvisionGroupHomepage"
      ],
      "description": null,
      "displayName": "Human Resources",
      "expirationDateTime": null,
      "groupTypes": [
        "Unified"
      ],
      "isAssignableToRole": null,
      "mail": "PNP-Contosohr@contoso.onmicrosoft.com",
      "mailEnabled": true,
      "mailNickname": "PNP-Contosohr",
      "membershipRule": null,
      "membershipRuleProcessingState": null,
      "onPremisesDomainName": null,
      "onPremisesLastSyncDateTime": null,
      "onPremisesNetBiosName": null,
      "onPremisesSamAccountName": null,
      "onPremisesSecurityIdentifier": null,
      "onPremisesSyncEnabled": null,
      "preferredDataLocation": null,
      "preferredLanguage": null,
      "proxyAddresses": [
        "SMTP:PNP-Contosohr@contoso.onmicrosoft.com",
        "SPO:SPO_c9c080ff-bc85-4f49-9ec2-0a683b15bd19@SPO_1e852b49-bf4b-4ba5-bcd4-a8c4706c8ed4"
      ],
      "renewedDateTime": "2019-04-22T09:24:11Z",
      "resourceBehaviorOptions": [],
      "resourceProvisioningOptions": [],
      "securityEnabled": false,
      "securityIdentifier": "S-1-12-1-82404220-1279621588-4267113344-4065130549",
      "theme": null,
      "visibility": "Private",
      "onPremisesProvisioningErrors": []
    }
  ]
  ```

  </TabItem>
  <TabItem value="Text">

  ```text
  id                                    displayName                     groupType
  ------------------------------------  ------------------------------  ---------------------
  04e9637c-79d4-4c45-80fb-56fe35f84cf2  Human Resources                 Microsoft 365
  ```

  </TabItem>
  <TabItem value="CSV">

  ```csv
  id,createdDateTime,displayName,mail,mailEnabled,mailNickname,renewedDateTime,securityEnabled,securityIdentifier,visibility
  04e9637c-79d4-4c45-80fb-56fe35f84cf2,2019-04-22T09:24:11Z,Human Resources,PNP-Contosohr@contoso.onmicrosoft.com,1,PNP-Contosohr,2019-04-22T09:24:11Z,,S-1-12-1-82404220-1279621588-4267113344-4065130549,Private
  ```

  </TabItem>
  <TabItem value="Markdown">

  ```md
  # entra group list

  Date: 2023-06-01

  ## Human Resources (04e9637c-79d4-4c45-80fb-56fe35f84cf2)

  Property | Value
  ---------|-------
  id | 04e9637c-79d4-4c45-80fb-56fe35f84cf2
  createdDateTime | 2019-04-22T09:24:11Z
  displayName | Human Resources
  mail | PNP-Contosohr@contoso.onmicrosoft.com
  mailEnabled | true
  mailNickname | PNP-Contosohr
  renewedDateTime | 2019-04-22T09:24:11Z
  securityEnabled | false
  securityIdentifier | S-1-12-1-82404220-1279621588-4267113344-4065130549
  visibility | Private
  ```

  </TabItem>
</Tabs>