Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New command: m365 graph directoryextension add. Closes #6316 #6327

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const dictionary = [
'definition',
'dev',
'details',
'directory',
'eligibility',
'enterprise',
'entra',
Expand Down
123 changes: 123 additions & 0 deletions docs/docs/cmd/graph/directoryextension/directoryextension-add.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
import Global from '/docs/cmd/_global.mdx';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# graph directoryextension add

Create a new directory extension

## Usage

```sh
m365 graph directoryextension add [options]
```

## Options

```md definition-list
`-n, --name <name>`
: The name of the directory extension.

`--appId [appId]`
: Application (client) ID of the Entra application where the directory extension is registered. Specify either `appId`, `appObjectId` or `appName`, but not multiple.

`--appObjectId [appObjectId]`
: Object ID of the Entra application where the directory extension is registered. Specify either `appId`, `appObjectId` or `appName`, but not multiple.

`--appName [appName]`
: The name of Entra application where the directory extension is registered. Specify either `appId`, `appObjectId` or `appName`, but not multiple.

`--dataType <dataType>`
: The data type of the value the extension property can hold. Possible values are: `Binary`, `Boolean`, `DateTime`, `Integer`, `LargeInteger` and `String`.

`targetObjects <targetObjects>`
: Comma-separated list of Microsoft Graph resources that can use the extension. Possible values are: `User`, `Group`, `Application`, `AdministrativeUnit`, `Device` and `Organization`.

`--isMultiValued`
: Defines the directory extension as a multi-valued property.
```

<Global />

## Examples

Create a new directory extension of string type defined for user resource.

```sh
m365 graph directoryextension add --name gitHubWorkAccountName --appName ContosoApp --targetObjects User --dataType String
```

Create a new multi-valued directory extension of integer type defined for device and application resource

```sh
m365 graph directoryextension add --name departmentIds --appId 1caf7dcd-7e83-4c3a-94f7-932a1299c844 --targetObjects 'Application,Device' --dataType Integer --isMultiValued
```

## Response

<Tabs>
<TabItem value="JSON">

```json
{
"id": "522817ae-5c95-4243-96c1-f85231fcbc1f",
"deletedDateTime": null,
"appDisplayName": "ContosoApp",
"dataType": "String",
"isMultiValued": false,
"isSyncedFromOnPremises": false,
"name": "extension_105be60b603845fea385e58772d9d630_githubworkaccount",
"targetObjects": [
"User"
]
}
```

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

```text
appDisplayName : ContosoApp
dataType : String
deletedDateTime : null
id : 01e77f60-3dde-4fa3-825b-cac8048994a8
isMultiValued : false
isSyncedFromOnPremises: false
name : extension_105be60b603845fea385e58772d9d630_githubworkaccount
targetObjects : ["User"]
```

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

```csv
id,deletedDateTime,appDisplayName,dataType,isMultiValued,isSyncedFromOnPremises,name
b0937b01-49ce-45c7-a52a-727954f092ea,,ContosoApp,String,,,extension_105be60b603845fea385e58772d9d630_githubworkaccount
```

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

```md
# graph directoryextension add --debug "false" --verbose "false" --name "githubworkaccount" --appName "ContosoApp" --dataType "String" --targetObjects "User"

Date: 9/8/2024

## extension_105be60b603845fea385e58772d9d630_githubworkaccount (cec3c38e-3f4a-4ca8-9523-afa47016f51b)

Property | Value|
---------|-------|
id | cec3c38e-3f4a-4ca8-9523-afa47016f51b
appDisplayName | ContosoApp
dataType | String
isMultiValued | false
isSyncedFromOnPremises | false
name | extension\_105be60b603845fea385e58772d9d630\_githubworkaccount
```

</TabItem>
</Tabs>

## More information

- Directory extensions: https://learn.microsoft.com/graph/extensibility-overview#directory-microsoft-entra-id-extensions
9 changes: 9 additions & 0 deletions docs/src/config/sidebars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1023,6 +1023,15 @@ const sidebars: SidebarsConfig = {
}
]
},
{
directoryextension: [
{
type: 'doc',
label: 'directoryextension add',
id: 'cmd/graph/directoryextension/directoryextension-add'
}
]
},
{
schemaextension: [
{
Expand Down
1 change: 1 addition & 0 deletions src/m365/graph/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const prefix: string = 'graph';

export default {
CHANGELOG_LIST: `${prefix} changelog list`,
DIRECTORYEXTENSION_ADD: `${prefix} directoryextension add`,
SCHEMAEXTENSION_ADD: `${prefix} schemaextension add`,
SCHEMAEXTENSION_GET: `${prefix} schemaextension get`,
SCHEMAEXTENSION_LIST: `${prefix} schemaextension list`,
Expand Down
Loading
Loading