/
Microsoft_Graph_API_urls.ps1
113 lines (81 loc) · 3.44 KB
/
Microsoft_Graph_API_urls.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# Microsoft Graph API related tips and tricks
#
# You can use these url examples in Graph Explorer: https://developer.microsoft.com/en-us/graph/graph-explorer
# or with Powershell Cmdlet: Invoke-MSGraphRequest -Url $url -HttpMethod 'GET'
#
# Petri.Paavola@yodamiitti.fi
Write-Host "Do NOT run me!" -ForegroundColor Red; Pause; Exit 0
# Web links
# Graph Explorer: https://developer.microsoft.com/en-us/graph/graph-explorer
# Documentation: https://docs.microsoft.com/en-us/graph/
# Graph API beta reference: https://docs.microsoft.com/en-us/graph/api/overview?toc=./ref/toc.json&view=graph-rest-beta
# Managed Device docs: https://docs.microsoft.com/en-us/graph/api/intune-devices-manageddevice-get?view=graph-rest-beta
#####################
# AzureAD
# This gets AzureAD Devices which are different than Intune Managed Devices!
GET
https://graph.microsoft.com/beta/devices
# AzureAD Users
GET
https://graph.microsoft.com/beta/users
# Use Select to get only specified attributes
GET
https://graph.microsoft.com/beta/users?$select=mail,givenName,surname
# Find user by email address
GET
https://graph.microsoft.com/beta/users?$filter=mail eq 'firstname.lastname@yodamiitti.fi'
# AzureAD Groups
GET
https://graph.microsoft.com/beta/groups
# AzureAD Group by displayName
GET
https://graph.microsoft.com/beta/groups?$filter=displayName eq 'Test FOOBAR'
# AzureAD Group by displayName starting with DynDev
GET
https://graph.microsoft.com/beta/groups?$filter=startswith(displayName,'DynDev')
# AzureAD Group by displayName starting with DynDev and show only displayname
GET
https://graph.microsoft.com/beta/groups?$filter=startswith(displayName,'DynDev')&$select=displayName
#####################
# Intune Managed Devices
# This gets Intune Managed Devices
GET
https://graph.microsoft.com/beta/devicemanagement/manageddevices
# User filtering to narrow down search results
# Search Intune Device by deviceName
GET
https://graph.microsoft.com/beta/devicemanagement/manageddevices?$filter=deviceName eq 'etunimi.sukunimi_AndroidForWork_9/19/2019_12:10 PM'
# Search Intune Device by deviceName
GET
https://graph.microsoft.com/beta/devicemanagement/manageddevices?$filter=deviceName eq 'HPZBOOKSTUDIO'
# Search Intune Device by deviceName starting with
GET
https://graph.microsoft.com/beta/devicemanagement/manageddevices?$filter=startswith(deviceName,'Win10')
# Get Intune Managed Devices and use Select to get only specified attributes
GET
https://graph.microsoft.com/beta/devicemanagement/manageddevices?$select=deviceName,id
# Send custom notification to Intune Managed Device
# Use device id here
POST
https://graph.microsoft.com/beta/deviceManagement/managedDevices('034edbcd-a295-4124-829a-e15b50bd003a')/sendCustomNotificationToCompanyPortal
{
"notificationTitle":"Title",
"notificationBody":"Body text"
}
#####################
# Intune Apps
# Get Apps - notice we don't get Win32LobApps (intunewin) because we are using v1.0 schema
GET
https://graph.microsoft.com/v1.0/deviceAppManagement/mobileApps
# Get Apps using beta schema to get Win32LobApps also (intunewin)
GET
https://graph.microsoft.com/beta/deviceAppManagement/mobileApps
# Normally we don't get App Assignments so we have to expand our query with expand to Assignments also
GET
https://graph.microsoft.com/beta/deviceAppManagement/mobileApps?$expand=assignments
#####################
# Autopilot
# Get Autopilot devices
GET
https://graph.microsoft.com/beta/deviceManagement/windowsAutopilotDeviceIdentities
#####################