22 lines
830 B
Python
22 lines
830 B
Python
# Code snippets are only available for the latest version. Current version is 1.x
|
|
# pip install msgraph-sdk
|
|
# New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
|
|
from msgraph import GraphServiceClient
|
|
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
|
|
|
|
scopes = ['User.Read']
|
|
|
|
# Multi-tenant apps can use "common",
|
|
# single-tenant apps must use the tenant ID from the Azure portal
|
|
tenant_id = 'caee3499-03f8-4175-9fa8-a935248d0ece'
|
|
|
|
# Values from app registration
|
|
client_id = '3a08b279-1fc3-419f-a77e-31f12a0f65f7'
|
|
|
|
# azure.identity
|
|
credential = DeviceCodeCredential(
|
|
tenant_id=tenant_id,
|
|
client_id=client_id)
|
|
|
|
graph_client = GraphServiceClient(credential, scopes)
|