# Update User — Microsoft Entra ID

> Updates an existing user in Microsoft Entra ID. See the documentation

- Key: `microsoft_entra_id-update-user`
- Type: Action (Write)
- Version: 0.0.8
- App: Microsoft Entra ID (`microsoft_entra_id`) — https://pipedream.com/apps/microsoft-entra-id.md
- This page (HTML): https://pipedream.com/apps/microsoft-entra-id/actions/update-user
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/microsoft_entra_id/actions/update-user/update-user.mjs

## Description

Updates an existing user in Microsoft Entra ID. [See the documentation](https://learn.microsoft.com/en-us/graph/api/user-update?view=graph-rest-1.0&tabs=http)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `userId` | `string` | Yes | Identifier of a user Options are loaded from the connected account. |
| `displayName` | `string` | No | The name to display in the address book for the user. |
| `mail` | `string` | No | The SMTP address for the user, for example, jeff@contoso.onmicrosoft.com. |
| `mailNickname` | `string` | No | The mail alias for the user. |
| `accountEnabled` | `boolean` | No | true if the account is enabled; otherwise, false. |
| `streetAddress` | `string` | No | The street address of the user's place of business. |
| `city` | `string` | No | The city in which the user is located. |
| `state` | `string` | No | The state or province in the user's address. |
| `postalCode` | `string` | No | The postal code for the user's postal address. The postal code is specific to the user's country/region. In the United States of America, this attribute contains the ZIP code. |
| `country` | `string` | No | The country/region in which the user is located; for example, US or UK. |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "microsoft_entra_id",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "microsoft_entra_id-update-user",
  arguments: {
    userId: "User",
    displayName: "Display Name",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "microsoft_entra_id-update-user",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    microsoft_entra_id: { authProvisionId: "apn_xxxxxxx" },
    userId: "User",
    displayName: "Display Name",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "microsoft_entra_id-update-user",
    "configured_props": {
      "microsoft_entra_id": { "authProvisionId": "apn_xxxxxxx" },
      "userId": "User",
      "displayName": "Display Name"
    }
  }'
```

---

- App: https://pipedream.com/apps/microsoft-entra-id.md · All apps: https://pipedream.com/apps
