ESC
Type to search...

Organization.ReadWrite.All

Export JSON
Export CSV
Copy URL
Print
ApplicationDelegated Read/Write All Resources

Allows the app to read and write the organization and related resources, without a signed-in user. Related resources include things like subscribed skus and tenant branding information.

Delegated Access App-Only Access

Permission Details

Application Permission

Read and write organization information

Allows the app to read and write the organization and related resources, without a signed-in user. Related resources include things like subscribed skus and tenant branding information.

Delegated Permission Admin consent required

Read and write organization information

Allows the app to read and write the organization and related resources, on behalf of the signed-in user. Related resources include things like subscribed skus and tenant branding information.

Properties

Property Type Description
id string The unique identifier for an entity. Read-only.
contactInsights object Contains the properties that are configured by an administrator as a tenant-level privacy control whether to identify duplicate contacts among a user's contacts list and suggest the user to merge those contacts to have a cleaner contacts list. List contactInsights returns the settings to display or return contact insights in an organization.
microsoftApplicationDataAccess object
peopleInsights object Contains the properties that are configured by an administrator for the visibility of a list of people relevant and working with a user in Microsoft 365. List peopleInsights returns the settings to display or return people insights in an organization.
itemInsights object Contains the properties that are configured by an administrator for the visibility of Microsoft Graph-derived insights, between a user and other items in Microsoft 365, such as documents or sites. List itemInsights returns the settings to display or return item insights in an organization.

Relationships

Relationship Type Description
branding organizationalBranding Branding for the organization. Nullable.
certificateBasedAuthConfiguration certificateBasedAuthConfiguration collection Navigation property to manage certificate-based authentication configuration.
extensions extension collection The collection of open extensions defined for the organization. Read-only. Nullable.

Graph Methods

Delegated access App-only access
Methods
GET /directory/subscriptions
GET /directory/subscriptions(commerceSubscriptionId='{commerceSubscriptionId}')
GET /directory/subscriptions/{id}
GET /organization
GET /organization/{id}/certificateBasedAuthConfiguration
GET /organization/{id}/certificateBasedAuthConfiguration/{id}
GET /organization/{organization-id}
GET /organization/{organization-id}/branding
GET /organization/{organization-id}/branding/bannerLogo
GET /organization/{organization-id}/branding/customCSS
GET /organization/{organization-id}/branding/favicon
GET /organization/{organization-id}/branding/headerLogo
GET /organization/{organization-id}/branding/localizations
GET /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}
GET /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}/bannerLogo
GET /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}/customCSS
GET /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}/favicon
GET /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}/headerLogo
GET /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}/squareLogo
GET /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}/squareLogoDark
GET /organization/{organization-id}/branding/squareLogo
GET /organization/{organization-id}/branding/squareLogoDark
GET /organization/{organization-id}/certificateBasedAuthConfiguration
GET /organization/{organization-id}/certificateBasedAuthConfiguration/{certificateBasedAuthConfiguration-id}
GET /organization/{organization-id}/extensions
GET /organization/{organization-id}/extensions/{extension-id}
GET /organization/{organization-id}/setMobileDeviceManagementAuthority
GET /organization/{organizationId}
GET /organization/{organizationId}/branding
GET /organization/{organizationId}/branding/localizations
GET /organization/{organizationId}/branding/localizations/{organizationalBrandingLocalizationId}
GET /subscribedSkus
GET /subscribedSkus/{id}
POST /groups/{id}/events
POST /groups/{id}/threads/{id}/posts/{id}/reply
POST /organization
POST /organization/{id}/certificateBasedAuthConfiguration
POST /organization/{organization-id}/branding/localizations
POST /organization/{organization-id}/certificateBasedAuthConfiguration
POST /organization/{organization-id}/checkMemberGroups
POST /organization/{organization-id}/checkMemberObjects
POST /organization/{organization-id}/extensions
POST /organization/{organization-id}/getMemberGroups
POST /organization/{organization-id}/getMemberObjects
POST /organization/{organization-id}/restore
POST /organization/{organization-id}/setMobileDeviceManagementAuthority
POST /organization/{organizationId}/branding/localizations
POST /organization/getAvailableExtensionProperties
POST /organization/validateProperties
POST /users/{id|userPrincipalName}/contacts
POST /users/{id|userPrincipalName}/events
POST /users/{id|userPrincipalName}/messages
POST /users/{id|userPrincipalName}/todo/lists
POST /users/{id|userPrincipalName}/todo/lists/{id}/tasks
PATCH /devices/{Id}/extensions/{extensionId}
PATCH /groups/{id}/events/{id}/extensions/{extensionId}
PATCH /groups/{id}/extensions/{extensionId}
PATCH /groups/{id}/threads/{id}/posts/{id}/extensions/{extensionId}
PATCH /organization/{id}
PATCH /organization/{Id}/extensions/{extensionId}
PATCH /organization/{organization-id}
PATCH /organization/{organization-id}/branding
PATCH /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}
PATCH /organization/{organization-id}/extensions/{extension-id}
PATCH /organization/{organizationId}/branding
PATCH /organization/{organizationId}/branding/localizations/{organizationalBrandingLocalizationId}
PATCH /users/{id|userPrincipalName}/contacts/{id}/extensions/{extensionId}
PATCH /users/{id|userPrincipalName}/events/{id}/extensions/{extensionId}
PATCH /users/{id|userPrincipalName}/extensions/{extensionId}
PATCH /users/{id|userPrincipalName}/messages/{id}/extensions/{extensionId}
PATCH /users/me/todo/lists/{todoTaskListId}/extensions/{extensionId}
PATCH /users/me/todo/lists/{todoTaskListId}/tasks/{taskId}/extensions/{extensionId}
PUT /organization/{organization-id}/branding
PUT /organization/{organization-id}/branding/bannerLogo
PUT /organization/{organization-id}/branding/customCSS
PUT /organization/{organization-id}/branding/favicon
PUT /organization/{organization-id}/branding/headerLogo
PUT /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}
PUT /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}/bannerLogo
PUT /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}/customCSS
PUT /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}/favicon
PUT /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}/headerLogo
PUT /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}/squareLogo
PUT /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}/squareLogoDark
PUT /organization/{organization-id}/branding/squareLogo
PUT /organization/{organization-id}/branding/squareLogoDark
PUT /organization/{organizationId}/branding/localizations/{organizationalBrandingLocalizationId}/{Stream object type such as backgroundImage}
DELETE /devices/{Id}/extensions/{extensionId}
DELETE /groups/{id}/events/{id}/extensions/{extensionId}
DELETE /groups/{id}/extensions/{extensionId}
DELETE /groups/{id}/threads/{id}/posts/{id}/extensions/{extensionId}
DELETE /me/extensions/{extensionId}
DELETE /me/todo/lists/{todoTaskListId}/extensions/{extensionId}
DELETE /me/todo/lists/{todoTaskListId}/tasks/{taskId}/extensions/{extensionId}
DELETE /organization/{id}/certificateBasedAuthConfiguration/{id}
DELETE /organization/{Id}/extensions/{extensionId}
DELETE /organization/{organization-id}
DELETE /organization/{organization-id}/branding
DELETE /organization/{organization-id}/branding/bannerLogo
DELETE /organization/{organization-id}/branding/customCSS
DELETE /organization/{organization-id}/branding/favicon
DELETE /organization/{organization-id}/branding/headerLogo
DELETE /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}
DELETE /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}/bannerLogo
DELETE /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}/customCSS
DELETE /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}/favicon
DELETE /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}/headerLogo
DELETE /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}/squareLogo
DELETE /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}/squareLogoDark
DELETE /organization/{organization-id}/branding/squareLogo
DELETE /organization/{organization-id}/branding/squareLogoDark
DELETE /organization/{organization-id}/certificateBasedAuthConfiguration/{certificateBasedAuthConfiguration-id}
DELETE /organization/{organization-id}/extensions/{extension-id}
DELETE /organization/{organizationId}/branding
DELETE /organization/{organizationId}/branding/localizations/{organizationalBrandingLocalizationId}
DELETE /users/{id|userPrincipalName}/contacts/{id}/extensions/{extensionId}
DELETE /users/{id|userPrincipalName}/events/{id}/extensions/{extensionId}
DELETE /users/{id|userPrincipalName}/extensions/{extensionId}
DELETE /users/{id|userPrincipalName}/messages/{id}/extensions/{extensionId}
DELETE /users/{userId}/todo/lists/{todoTaskListId}/extensions/{extensionId}
DELETE /users/{userId}/todo/lists/{todoTaskListId}/tasks/{taskId}/extensions/{extensionId}
Methods
GET /directory/subscriptions
GET /directory/subscriptions(commerceSubscriptionId='{commerceSubscriptionId}')
GET /directory/subscriptions/{id}
GET /organization
GET /organization/{id}/certificateBasedAuthConfiguration
GET /organization/{id}/certificateBasedAuthConfiguration/{id}
GET /organization/{organization-id}
GET /organization/{organization-id}/branding
GET /organization/{organization-id}/branding/bannerLogo
GET /organization/{organization-id}/branding/customCSS
GET /organization/{organization-id}/branding/favicon
GET /organization/{organization-id}/branding/headerLogo
GET /organization/{organization-id}/branding/localizations
GET /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}
GET /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}/bannerLogo
GET /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}/customCSS
GET /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}/favicon
GET /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}/headerLogo
GET /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}/squareLogo
GET /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}/squareLogoDark
GET /organization/{organization-id}/branding/squareLogo
GET /organization/{organization-id}/branding/squareLogoDark
GET /organization/{organization-id}/branding/themes
GET /organization/{organization-id}/branding/themes/{organizationalBrandingTheme-id}
GET /organization/{organization-id}/branding/themes/{organizationalBrandingTheme-id}/localizations
GET /organization/{organization-id}/branding/themes/{organizationalBrandingTheme-id}/localizations/{organizationalBrandingThemeLocalization-locale}
GET /organization/{organization-id}/branding/themes/{organizationalBrandingTheme-id}/localizations/{organizationalBrandingThemeLocalization-locale}/bannerLogo
GET /organization/{organization-id}/branding/themes/{organizationalBrandingTheme-id}/localizations/{organizationalBrandingThemeLocalization-locale}/customCSS
GET /organization/{organization-id}/branding/themes/{organizationalBrandingTheme-id}/localizations/{organizationalBrandingThemeLocalization-locale}/favicon
GET /organization/{organization-id}/branding/themes/{organizationalBrandingTheme-id}/localizations/{organizationalBrandingThemeLocalization-locale}/headerLogo
GET /organization/{organization-id}/branding/themes/{organizationalBrandingTheme-id}/localizations/{organizationalBrandingThemeLocalization-locale}/squareLogo
GET /organization/{organization-id}/branding/themes/{organizationalBrandingTheme-id}/localizations/{organizationalBrandingThemeLocalization-locale}/squareLogoDark
GET /organization/{organization-id}/certificateBasedAuthConfiguration
GET /organization/{organization-id}/certificateBasedAuthConfiguration/{certificateBasedAuthConfiguration-id}
GET /organization/{organization-id}/extensions
GET /organization/{organization-id}/extensions/{extension-id}
GET /organization/{organization-id}/settings
GET /organization/{organization-id}/settings/microsoftApplicationDataAccess
GET /organization/{organizationId}
GET /organization/{organizationId}/branding
GET /organization/{organizationId}/branding/localizations
GET /organization/{organizationId}/branding/localizations/{organizationalBrandingLocalizationId}
GET /organization/{organizationId}/settings/contactInsights
GET /organization/{organizationId}/settings/microsoftApplicationDataAccess
GET /subscribedSkus
GET /subscribedSkus/{id}
POST /drive/items/{itemId}/children
POST /groups/{userId}/events
POST /groups/{userId}/threads/{threadId}/posts/{postId}/reply
POST /organization
POST /organization/{id}/certificateBasedAuthConfiguration
POST /organization/{organization-id}/branding/localizations
POST /organization/{organization-id}/branding/themes
POST /organization/{organization-id}/branding/themes/{organizationalBrandingTheme-id}/localizations
POST /organization/{organization-id}/certificateBasedAuthConfiguration
POST /organization/{organization-id}/checkMemberGroups
POST /organization/{organization-id}/checkMemberObjects
POST /organization/{organization-id}/extensions
POST /organization/{organization-id}/getMemberGroups
POST /organization/{organization-id}/getMemberObjects
POST /organization/{organization-id}/restore
POST /organization/{organization-id}/setMobileDeviceManagementAuthority
POST /organization/{organization-id}/settings/microsoftApplicationDataAccess
POST /organization/{organizationId}/branding/localizations
POST /organization/getUserOwnedObjects
POST /organization/validateProperties
POST /users/{userId|userPrincipalName}/contacts
POST /users/{userId|userPrincipalName}/events
POST /users/{userId|userPrincipalName}/messages
POST /users/{userId|userPrincipalName}/tasks/lists
POST /users/{userId|userPrincipalName}/tasks/lists/{listId}/tasks
POST /users/{userId|userPrincipalName}/todo/lists
POST /users/{userId|userPrincipalName}/todo/lists/{listId}/tasks
PATCH /administrativeUnits/{administrativeUnitId}/extensions/{extensionId}
PATCH /devices/{deviceId}/extensions/{extensionId}
PATCH /drive/items/{itemId}/extensions/{extensionId}
PATCH /groups/{groupId}/events/{eventId}/extensions/{extensionId}
PATCH /groups/{groupId}/extensions/{extensionId}
PATCH /groups/{groupId}/threads/{threadId}/posts/{postId}/extensions/{extensionId}
PATCH /organization/{id}
PATCH /organization/{organization-id}
PATCH /organization/{organization-id}/branding
PATCH /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}
PATCH /organization/{organization-id}/branding/themes/{organizationalBrandingTheme-id}
PATCH /organization/{organization-id}/branding/themes/{organizationalBrandingTheme-id}/localizations/{organizationalBrandingThemeLocalization-locale}
PATCH /organization/{organization-id}/extensions/{extension-id}
PATCH /organization/{organization-id}/settings
PATCH /organization/{organization-id}/settings/microsoftApplicationDataAccess
PATCH /organization/{organizationId}/branding
PATCH /organization/{organizationId}/branding/localizations/{organizationalBrandingLocalizationId}
PATCH /organization/{organizationId}/extensions/{extensionId}
PATCH /organization/{organizationId}/settings/contactInsights
PATCH /organization/{organizationId}/settings/microsoftApplicationDataAccess
PATCH /sites/{siteId}/extensions/{extensionId}
PATCH /users/{userId|userPrincipalName}/contacts/{contactId}/extensions/{extensionId}
PATCH /users/{userId|userPrincipalName}/events/{eventId}/extensions/{extensionId}
PATCH /users/{userId|userPrincipalName}/extensions/{extensionId}
PATCH /users/{userId|userPrincipalName}/messages/{messageId}/extensions/{extensionId}
PATCH /users/me/tasks/lists/{listId}/extensions/{extensionId}
PATCH /users/me/tasks/lists/{listId}/tasks/{taskId}/extensions/{extensionId}
PATCH /users/me/todo/lists/{listId}/extensions/{extensionId}
PATCH /users/me/todo/lists/{listId}/tasks/{taskId}/extensions/{extensionId}
PUT /organization/{organization-id}/branding
PUT /organization/{organization-id}/branding/bannerLogo
PUT /organization/{organization-id}/branding/customCSS
PUT /organization/{organization-id}/branding/favicon
PUT /organization/{organization-id}/branding/headerLogo
PUT /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}
PUT /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}/bannerLogo
PUT /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}/customCSS
PUT /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}/favicon
PUT /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}/headerLogo
PUT /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}/squareLogo
PUT /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}/squareLogoDark
PUT /organization/{organization-id}/branding/squareLogo
PUT /organization/{organization-id}/branding/squareLogoDark
PUT /organization/{organization-id}/branding/themes/{organizationalBrandingTheme-id}/localizations/{organizationalBrandingThemeLocalization-locale}
PUT /organization/{organization-id}/branding/themes/{organizationalBrandingTheme-id}/localizations/{organizationalBrandingThemeLocalization-locale}/bannerLogo
PUT /organization/{organization-id}/branding/themes/{organizationalBrandingTheme-id}/localizations/{organizationalBrandingThemeLocalization-locale}/customCSS
PUT /organization/{organization-id}/branding/themes/{organizationalBrandingTheme-id}/localizations/{organizationalBrandingThemeLocalization-locale}/favicon
PUT /organization/{organization-id}/branding/themes/{organizationalBrandingTheme-id}/localizations/{organizationalBrandingThemeLocalization-locale}/headerLogo
PUT /organization/{organization-id}/branding/themes/{organizationalBrandingTheme-id}/localizations/{organizationalBrandingThemeLocalization-locale}/squareLogo
PUT /organization/{organization-id}/branding/themes/{organizationalBrandingTheme-id}/localizations/{organizationalBrandingThemeLocalization-locale}/squareLogoDark
PUT /organization/{organizationId}/branding/localizations/{organizationalBrandingLocalizationId}/{Stream object type such as backgroundImage}
DELETE /administrativeUnits/{administrativeUnitId}/extensions/{extensionId}
DELETE /devices/{deviceId}/extensions/{extensionId}
DELETE /drive/items/{itemId}/extensions/{extensionId}
DELETE /groups/{groupId}/events/{eventId}/extensions/{extensionId}
DELETE /groups/{groupId}/extensions/{extensionId}
DELETE /groups/{groupId}/threads/{threadIid}/posts/{postId}/extensions/{extensionId}
DELETE /organization/{id}/certificateBasedAuthConfiguration/{id}
DELETE /organization/{organization-id}
DELETE /organization/{organization-id}/branding
DELETE /organization/{organization-id}/branding/bannerLogo
DELETE /organization/{organization-id}/branding/customCSS
DELETE /organization/{organization-id}/branding/favicon
DELETE /organization/{organization-id}/branding/headerLogo
DELETE /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}
DELETE /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}/bannerLogo
DELETE /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}/customCSS
DELETE /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}/favicon
DELETE /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}/headerLogo
DELETE /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}/squareLogo
DELETE /organization/{organization-id}/branding/localizations/{organizationalBrandingLocalization-id}/squareLogoDark
DELETE /organization/{organization-id}/branding/squareLogo
DELETE /organization/{organization-id}/branding/squareLogoDark
DELETE /organization/{organization-id}/branding/themes/{organizationalBrandingTheme-id}
DELETE /organization/{organization-id}/branding/themes/{organizationalBrandingTheme-id}/localizations/{organizationalBrandingThemeLocalization-locale}
DELETE /organization/{organization-id}/branding/themes/{organizationalBrandingTheme-id}/localizations/{organizationalBrandingThemeLocalization-locale}/bannerLogo
DELETE /organization/{organization-id}/branding/themes/{organizationalBrandingTheme-id}/localizations/{organizationalBrandingThemeLocalization-locale}/customCSS
DELETE /organization/{organization-id}/branding/themes/{organizationalBrandingTheme-id}/localizations/{organizationalBrandingThemeLocalization-locale}/favicon
DELETE /organization/{organization-id}/branding/themes/{organizationalBrandingTheme-id}/localizations/{organizationalBrandingThemeLocalization-locale}/headerLogo
DELETE /organization/{organization-id}/branding/themes/{organizationalBrandingTheme-id}/localizations/{organizationalBrandingThemeLocalization-locale}/squareLogo
DELETE /organization/{organization-id}/branding/themes/{organizationalBrandingTheme-id}/localizations/{organizationalBrandingThemeLocalization-locale}/squareLogoDark
DELETE /organization/{organization-id}/certificateBasedAuthConfiguration/{certificateBasedAuthConfiguration-id}
DELETE /organization/{organization-id}/extensions/{extension-id}
DELETE /organization/{organization-id}/settings
DELETE /organization/{organization-id}/settings/microsoftApplicationDataAccess
DELETE /organization/{organizationId}/branding
DELETE /organization/{organizationId}/branding/localizations/{organizationalBrandingLocalizationId}
DELETE /organization/{organizationId}/extensions/{extensionId}
DELETE /sites/{site-id}/extensions/{extensionId}
DELETE /users/{userId|userPrincipalName}/contacts/{contactId}/extensions/{extensionId}
DELETE /users/{userId|userPrincipalName}/events/{eventId}/extensions/{extensionId}
DELETE /users/{userId|userPrincipalName}/extensions/{extensionId}
DELETE /users/{userIid|userPrincipalName}/messages/{messageId}/extensions/{extensionId}
DELETE /users/me/tasks/lists/{listId}/extensions/{extensionId}
DELETE /users/me/tasks/lists/{listId}/tasks/{taskId}/extensions/{extensionId}
DELETE /users/me/todo/lists/{listId}/extensions/{extensionId}
DELETE /users/me/todo/lists/{listId}/tasks/{taskId}/extensions/{extensionId}

Code Examples

C# / .NET SDK
// Install: dotnet add package Microsoft.Graph
// Install: dotnet add package Azure.Identity
using Microsoft.Graph;
using Azure.Identity;

// Delegated permissions - interactive user sign-in
var scopes = new[] { "Organization.ReadWrite.All" };
var options = new InteractiveBrowserCredentialOptions
{
    ClientId = "YOUR_CLIENT_ID",
    TenantId = "YOUR_TENANT_ID",
    RedirectUri = new Uri("http://localhost")
};
var credential = new InteractiveBrowserCredential(options);
var graphClient = new GraphServiceClient(credential, scopes);

// Example: GET /me
var result = await graphClient.Me.GetAsync();
Console.WriteLine($"User: {result?.DisplayName}");

// Application permissions - daemon/service app
var tenantId = "YOUR_TENANT_ID";
var clientId = "YOUR_CLIENT_ID";
var clientSecret = "YOUR_CLIENT_SECRET";

var credential = new ClientSecretCredential(tenantId, clientId, clientSecret);
var graphClient = new GraphServiceClient(credential);

// Example: GET /users/{user-id}
var users = await graphClient.Users.GetAsync();
foreach (var user in users?.Value ?? [])
{
    Console.WriteLine($"User: {user.DisplayName}");
}
JavaScript / TypeScript
// npm install @azure/msal-browser @microsoft/microsoft-graph-client
import { PublicClientApplication } from "@azure/msal-browser";
import { Client } from "@microsoft/microsoft-graph-client";
import { AuthCodeMSALBrowserAuthenticationProvider } from 
    "@microsoft/microsoft-graph-client/authProviders/authCodeMsalBrowser";

const msalConfig = {
    auth: {
        clientId: "YOUR_CLIENT_ID",
        authority: "https://login.microsoftonline.com/YOUR_TENANT_ID"
    }
};

const pca = new PublicClientApplication(msalConfig);
await pca.initialize();

// Delegated: Login with required scope
const loginResponse = await pca.loginPopup({
    scopes: ["Organization.ReadWrite.All"]
});

const authProvider = new AuthCodeMSALBrowserAuthenticationProvider(pca, {
    account: loginResponse.account,
    scopes: ["Organization.ReadWrite.All"],
    interactionType: "popup"
});

const graphClient = Client.initWithMiddleware({ authProvider });

// Example: GET /me
const result = await graphClient.api("/me").get();
console.log(result);

// Application: Use client credentials (Node.js backend only)
// npm install @azure/identity @microsoft/microsoft-graph-client
import { ClientSecretCredential } from "@azure/identity";
import { TokenCredentialAuthenticationProvider } from 
    "@microsoft/microsoft-graph-client/authProviders/azureTokenCredentials";

const credential = new ClientSecretCredential(
    "YOUR_TENANT_ID",
    "YOUR_CLIENT_ID", 
    "YOUR_CLIENT_SECRET"
);

const authProvider = new TokenCredentialAuthenticationProvider(credential, {
    scopes: ["https://graph.microsoft.com/.default"]
});

const graphClient = Client.initWithMiddleware({ authProvider });
const result = await graphClient.api("/users").get();
console.log(result);
PowerShell
# Install Microsoft Graph PowerShell module
Install-Module Microsoft.Graph -Scope CurrentUser

# Delegated access - interactive sign-in
Connect-MgGraph -Scopes "Organization.ReadWrite.All"

# Verify connection
Get-MgContext | Select-Object Account, TenantId, Scopes

# Example: GET /me
$result = Invoke-MgGraphRequest -Method GET -Uri "https://graph.microsoft.com/v1.0/me"
$result | ConvertTo-Json -Depth 5

# Application access with certificate
$params = @{
    ClientId = "YOUR_CLIENT_ID"
    TenantId = "YOUR_TENANT_ID"
    CertificateThumbprint = "YOUR_CERT_THUMBPRINT"
}
Connect-MgGraph @params

# Or with client secret (not recommended for production)
# Connect-MgGraph -ClientSecretCredential $credential

# Example: GET /users
$result = Invoke-MgGraphRequest -Method GET -Uri "https://graph.microsoft.com/v1.0/users"
$result | ConvertTo-Json -Depth 5

# Always disconnect when done
Disconnect-MgGraph
Python
# pip install msgraph-sdk azure-identity
from azure.identity import InteractiveBrowserCredential, ClientSecretCredential
from msgraph import GraphServiceClient
import asyncio

# Delegated permissions - interactive browser sign-in
credential = InteractiveBrowserCredential(
    client_id="YOUR_CLIENT_ID",
    tenant_id="YOUR_TENANT_ID"
)
scopes = ["Organization.ReadWrite.All"]
client = GraphServiceClient(credential, scopes)

async def get_data():
    # Example: GET /me
    result = await client.me.get()
    print(f"User: {result.display_name}")
    return result

asyncio.run(get_data())

# Application permissions - client credentials
credential = ClientSecretCredential(
    tenant_id="YOUR_TENANT_ID",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET"
)
scopes = ["https://graph.microsoft.com/.default"]
client = GraphServiceClient(credential, scopes)

async def get_users():
    # Example: GET /users
    result = await client.users.get()
    for user in result.value:
        print(f"User: {user.display_name}")
    return result

asyncio.run(get_users())

App Registration

1

Navigate to Azure Portal

Go to App registrations in Microsoft Entra admin center

2

Add API Permission

Select your app → API permissions → Add a permission → Microsoft Graph

3

Select Permission Type

Choose Application permissions or Delegated permissions and search for Organization.ReadWrite.All

4

Grant Admin Consent

Application permissions always require admin consent. Click "Grant admin consent" in the Azure portal.