• Stars
    star
    1,341
  • Rank 35,042 (Top 0.7 %)
  • Language
    PowerShell
  • License
    MIT License
  • Created over 7 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

This repository of PowerShell sample scripts show how to access Intune service resources. They demonstrate this by making HTTPS RESTful API requests to the Microsoft Graph API from PowerShell.
page_type products languages extensions noDependencies
sample
ms-graph
powershell
contentType technologies services createdDate
samples
Microsoft Graph
Intune
4/4/2017 9:41:27 AM
true

Intune Graph Samples

This repository of PowerShell sample scripts show how to access Intune service resources. They demonstrate this by making HTTPS RESTful API requests to the Microsoft Graph API from PowerShell.

Documentation for Intune and Microsoft Graph can be found here Intune Graph Documentation.

These samples demonstrate typical Intune administrator or Microsoft partner actions for managing Intune resources.

The following samples are included in this repository:

  • AdminConsent
  • AndroidEnterprise
  • AppleEnrollment
  • Applications
  • ApplicationSync
  • AppProtectionPolicy
  • Auditing
  • Authentication
  • CertificationAuthority
  • CheckStatus
  • CompanyPortalBranding
  • CompliancePolicy
  • CorporateDeviceEnrollment
  • DeviceConfiguration
  • EnrollmentRestrictions
  • IntuneDataExport
  • LOB_Application
  • ManagedDevices
  • Paging
  • RBAC
  • RemoteActionAudit
  • SoftwareUpdates
  • TermsAndConditions
  • UserPolicyReport

The scripts are licensed "as-is." under the MIT License.

Disclaimer

Some script samples retrieve information from your Intune tenant, and others create, delete or update data in your Intune tenant.  Understand the impact of each sample script prior to running it; samples should be run using a non-production or "test" tenant account. 

Using the Intune Graph API

The Intune Graph API enables access to Intune information programmatically for your tenant, and the API performs the same Intune operations as those available through the Azure Portal.  

Intune provides data into the Microsoft Graph in the same way as other cloud services do, with rich entity information and relationship navigation.  Use Microsoft Graph to combine information from other services and Intune to build rich cross-service applications for IT professionals or end users.     

Prerequisites

Use of these Microsoft Graph API Intune PowerShell samples requires the following:

  • Install the AzureAD PowerShell module by running 'Install-Module AzureAD' or 'Install-Module AzureADPreview' from an elevated PowerShell prompt
  • An Intune tenant which supports the Azure Portal with a production or trial license (https://docs.microsoft.com/en-us/intune-azure/introduction/what-is-microsoft-intune)
  • Using the Microsoft Graph APIs to configure Intune controls and policies requires an Intune license.
  • An account with permissions to administer the Intune Service
  • PowerShell v5.0 on Windows 10 x64 (PowerShell v4.0 is a minimum requirement for the scripts to function correctly)
  • Note: For PowerShell 4.0 you will require the PowershellGet Module for PS 4.0 to enable the usage of the Install-Module functionality
  • First time usage of these scripts requires a Global Administrator of the Tenant to accept the permissions of the application

Getting Started

After the prerequisites are installed or met, perform the following steps to use these scripts:

1. Script usage

  1. Download the contents of the repository to your local Windows machine
  • Extract the files to a local folder (e.g. C:\IntuneGraphSamples)
  • Run PowerShell x64 from the start menu
  • Browse to the directory (e.g. cd C:\IntuneGraphSamples)
  • For each Folder in the local repository you can browse to that directory and then run the script of your choice
  • Example Application script usage:
    • To use the Manage Applications scripts, from C:\IntuneGraphSamples, run "cd .\Applications"
    • Once in the folder run .\Application_MDM_Get.ps1 to get all MDM added applications This sequence of steps can be used for each folder....

2. Authentication with Microsoft Graph

The first time you run these scripts you will be asked to provide an account to authenticate with the service:

Please specify your user principal name for Azure Authentication:

Once you have provided a user principal name a popup will open prompting for your password. After a successful authentication with Azure Active Directory the user token will last for an hour, once the hour expires within the PowerShell session you will be asked to re-authenticate.

If you are running the script for the first time against your tenant a popup will be presented stating:

Microsoft Intune PowerShell needs permission to:

* Sign you in and read your profile
* Read all groups
* Read directory data
* Read and write Microsoft Intune Device Configuration and Policies (preview)
* Read and write Microsoft Intune RBAC settings (preview)
* Perform user-impacting remote actions on Microsoft Intune devices (preview)
* Sign in as you
* Read and write Microsoft Intune devices (preview)
* Read and write all groups
* Read and write Microsoft Intune configuration (preview)
* Read and write Microsoft Intune apps (preview)

Note: If your user account is targeted for device based conditional access your device must be enrolled or compliant to pass authentication.

Contributing

If you'd like to contribute to this sample, see CONTRIBUTING.MD.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Questions and comments

We'd love to get your feedback about the Intune PowerShell sample. You can send your questions and suggestions to us in the Issues section of this repository.

Your feedback is important to us. Connect with us on Stack Overflow. Tag your questions with [MicrosoftGraph] and [intune].

Additional resources

Copyright

Copyright (c) 2017 Microsoft. All rights reserved.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

More Repositories

1

microsoft-graph-docs

Documentation for the Microsoft Graph REST API
PowerShell
1,212
star
2

microsoft-graph-toolkit

Authentication Providers and UI components for Microsoft Graph 🦒
TypeScript
944
star
3

msgraph-sdk-powershell

Powershell SDK for Microsoft Graph
C#
691
star
4

msgraph-sdk-dotnet

Microsoft Graph Client Library for .NET!
C#
688
star
5

msgraph-sdk-javascript

Microsoft Graph client library for JavaScript
TypeScript
664
star
6

msgraph-sdk-php

Microsoft Graph Library for PHP.
PHP
569
star
7

msgraph-sdk-java

Microsoft Graph SDK for Java
Java
374
star
8

msgraph-sdk-python

Python
364
star
9

msgraph-sdk-python-core

Microsoft Graph client library for Python
Python
261
star
10

microsoftgraph-postman-collections

253
star
11

msgraph-sdk-go

Microsoft Graph SDK for Go
Go
235
star
12

microsoft-graph-explorer-v4

React/Redux version of Graph Explorer used to learn the Microsoft Graph Api
TypeScript
212
star
13

security-api-solutions

Microsoft Graph Security API applications and services.
Jupyter Notebook
208
star
14

microsoft-graph-comms-samples

Microsoft Graph Communications Samples
208
star
15

aspnet-snippets-sample

A repository of code snippets that use Microsoft Graph to perform common tasks such as sending email, managing groups, and other activities from an ASP.NET Core MVC app. This sample uses the Microsoft Graph .NET Client Library to work with data, and the Microsoft Identity Web Library for authentication on the Microsoft identity platform v2.0 endpoint.
C#
177
star
16

msgraph-sample-nodeexpressapp

This sample demonstrates how to use the Microsoft Graph JavaScript SDK to access data in Office 365 from Node.js Express apps.
JavaScript
167
star
17

msgraph-sdk-dotnet-core

The core Microsoft Graph client library for .Net. (Microsoft.Graph.Core)
C#
150
star
18

msgraph-sample-phpapp

This sample demonstrates how to use the Microsoft Graph .NET SDK to access data in Office 365 from PHP web apps.
PHP
147
star
19

nodejs-webhooks-sample

Create Microsoft Graph webhook subscriptions for a Node.js app, so that it can receive notifications of changes in a user’s Microsoft account data.
JavaScript
139
star
20

python-sample-auth

Please see https://github.com/microsoftgraph/msgraph-training-pythondjangoapp for a Python sample.
Python
136
star
21

microsoft-graph-explorer

We've moved! You can contribute to our new repository here
TypeScript
136
star
22

msgraph-sample-pythondjangoapp

This sample demonstrates how to use the Microsoft Graph .NET SDK to access data in Office 365 from Python web apps.
Python
130
star
23

msgraph-sample-reactspa

This sample demonstrates how to use the Microsoft Graph JavaScript SDK to access data in Office 365 from React browser apps.
TypeScript
125
star
24

aspnetcore-connect-sample

[ARCHIVED] This ASP.NET Core MVC sample shows how to connect to Microsoft Graph using delegated permissions and the Azure AD v2.0 (MSAL) endpoint.
C#
123
star
25

aspnetcore-webhooks-sample

This sample shows how to subscribe for Microsoft Graph webhooks using application (app-only) permissions and the Azure AD endpoint.
C#
122
star
26

msgraph-training-dotnet

Microsoft Graph Training Module - Build .NET apps with Microsoft Graph
C#
117
star
27

msgraph-typescript-typings

Microsoft Graph TypeScript Type Definitions
PowerShell
117
star
28

csharp-teams-sample-graph

[ARCHIVED] Sample apps (C# and node) for accessing Microsoft Teams data via the Microsoft Graph
JavaScript
115
star
29

python3-connect-rest-sample

[ARCHIVED] This sample shows how to connect your Python web app to Office 365 using Microsoft Graph to send an email.
Python
106
star
30

msgraph-sdk-ruby

Microsoft Graph Ruby client library for v1 APIs
Ruby
103
star
31

nodejs-connect-rest-sample

[ARCHIVED] Use Microsoft Graph to access a user’s Microsoft account data from within a Node.js web application. This sample sends REST calls directly to the Microsoft Graph endpoint, and authenticates with the Azure AD v2.0 endpoint to support Microsoft Accounts and work or school accounts.
JavaScript
100
star
32

msgraph-metadata

Microsoft Graph metadata captured and used for generating client library code files.
XSLT
100
star
33

group-membership-management

Group Membership Management (GMM) is a service that dynamically manages the membership of AAD Groups. Groups managed by GMM can have their membership defined using existing AAD Groups and/or custom membership sources.
C#
97
star
34

msgraph-training-aspnetmvcapp

Microsoft Graph Training Module - Build MVC apps with Microsoft Graph
96
star
35

msgraph-cli

CLI tool for Microsoft Graph based on .NET
C#
94
star
36

msgraph-beta-sdk-dotnet

The Microsoft Graph Client Beta Library for .NET supports the Microsoft Graph /beta endpoint. (preview)
C#
92
star
37

dotnetcore-console-sample

.Net Core console application for calling Microsoft Graph. Sample built from scratch.
C#
89
star
38

MSGraph-SDK-Code-Generator

MSGraph SDK Code Generator
C#
88
star
39

microsoft-graph-devx-api

Services API for Graph Explorer
C#
88
star
40

msgraph-sample-rubyrailsapp

This sample demonstrates how to use the Microsoft Graph REST API to access data in Office 365 from Ruby on Rails apps.
Ruby
88
star
41

30DaysMSGraph-TryItOut

This repo contains the Try It Out samples from the 30 Days of Microsoft Graph blog series (https://aka.ms/30DaysMSGraph).
C#
79
star
42

python-security-rest-sample

This sample shows how to connect your Python web app to the Security API using Microsoft Graph.
HTML
79
star
43

php-connect-rest-sample

[ARCHIVED] Use Microsoft Graph to access a user’s Microsoft account data from within a php web application. This sample gets OAuth tokens from the Azure AD v2.0 endpoint and uses REST calls directly to Microsoft Graph.
PHP
78
star
44

msgraph-sdk-dotnet-auth

Archived - use the TokenCredential classes provided by Azure.Identity. https://docs.microsoft.com/en-us/dotnet/api/overview/azure/identity-readme
C#
78
star
45

graphql-demo

[ARCHIVED] GraphQL for Microsoft Graph
JavaScript
77
star
46

msgraph-sdk-design

Requirements and design documents for Microsoft Graph SDKs
SCSS
74
star
47

msgraph-sample-aspnet-core

This sample demonstrates how to use the Microsoft Graph .NET SDK to access data in Office 365 from ASP.NET Core apps.
C#
67
star
48

python-sample-console-app

Please see https://github.com/microsoftgraph/msgraph-training-pythondjangoapp for a Python sample.
Python
66
star
49

contoso-airlines-teams-sample

JavaScript
65
star
50

aspnet-connect-rest-sample

[ARCHIVED] This ASP.NET MVC sample shows how to connect to Microsoft Graph and use the API to send an email.
C#
63
star
51

entra-powershell

Microsoft Entra PowerShell
PowerShell
63
star
52

msgraph-sample-angularspa

This sample demonstrates how to use the Microsoft Graph JavaScript SDK to access data in Office 365 from Angular single-page applications.
TypeScript
63
star
53

msgraph-training-python

Completed project for Build Python apps with Microsoft Graph
Python
61
star
54

aspnet-security-api-sample

This sample shows how to connect your ASP .Net web app to the Security API using Microsoft Graph SDK.
JavaScript
59
star
55

msgraph-community-samples

Repo for community contributed samples
56
star
56

msgraph-training-java

Microsoft Graph Training Module - Build Java apps with Microsoft Graph
Java
55
star
57

dataconnect-solutions

Microsoft Graph Data Connect enables scaled access to Microsoft 365 data with fine grained consent model, integrated with compliance and governance, to enable analytics and big data applications on the largest productivity platform.
Jupyter Notebook
54
star
58

aspnet-connect-sample

[ARCHIVED] This walkthrough shows you how to use the Office 365 Connected Services in Visual Studio 2017.
C#
54
star
59

msgraph-sdk-java-core

Microsoft Graph SDK for Java - Core Library
Java
53
star
60

msgraph-training-changenotifications

52
star
61

php-connect-sample

[ARCHIVED] Use Microsoft Graph to access a user’s Microsoft account data from within a PHP web application. This sample gets OAuth tokens from the Azure AD v2.0 endpoint and connects it to the Microsoft Graph SDK for PHP.
PHP
52
star
62

msgraph-sdk-android

Microsoft Graph SDK for Android! https://graph.microsoft.io
Java
51
star
63

microsoft-graph-docs-contrib

Documentation for the Microsoft Graph REST API
PowerShell
50
star
64

msgraph-training-authentication

[ARCHIVED] Microsoft Graph Training Module - Authentication
49
star
65

angular-connect-rest-sample

[ARCHIVED] Use Microsoft Graph to access a user’s Microsoft account data from within an AngularJS web application. This sample uses REST calls directly to the Microsoft Graph endpoint and authenticates users with Microsoft Accounts or work or school Office 365 accounts.
JavaScript
48
star
66

msgraph-sample-azurefunction-csharp

This sample demonstrates how to use the Microsoft Graph .NET SDK to access data in Office 365 from Azure Functions.
C#
47
star
67

nodejs-apponlytoken-rest-sample

[ARCHIVED] This sample shows how to connect a service or daemon app (written in Node.js) to the Microsoft Graph API.
JavaScript
47
star
68

msgraph-cli-archived

The Microsoft Graph CLI repository has moved. This repository is now an archive.
Python
44
star
69

msgraph-sample-react-native

This sample demonstrates how to use the Microsoft Graph JavaScript SDK to access data in Office 365 from React Native mobile apps.
TypeScript
44
star
70

aspnet-webhooks-rest-sample

Webhooks in Microsoft Graph notify your web application about changes in user data. You can create a webhook subscription to get notified about changes in user's data. This sample uses the Azure AD endpoint to obtain an access token for work or school accounts.
JavaScript
42
star
71

msgraph-search-connector-sample

This .NET Core application shows how to use the Microsoft Graph indexing API to create a connection to the Microsoft Search service and index custom items.
C#
41
star
72

java-spring-webhooks-sample

Receive change notifications with data with the Microsoft Graph
Java
39
star
73

msgraph-bicep-types

Repo contains Microsoft Graph resource types to integrate with bicep templates.
TypeScript
39
star
74

xamarin-csharp-propertymanager-sample

[ARCHIVED] Demonstrates how to use the Microsoft Graph as the only back-end component for a complete property management solution.
C#
38
star
75

msgraph-sample-android

This sample demonstrates how to use the Microsoft Graph Java SDK to access data in Office 365 from native mobile Android applications.
Java
38
star
76

msgraph-sdk-objc

Microsoft Graph SDK for Objective-C
Objective-C
37
star
77

console-csharp-connect-sample

[ARCHIVED] This sample shows how to connect a Windows console application to a Microsoft work or school (Azure Active Directory) or personal (Microsoft) account using the Microsoft Graph API to send an email.
C#
36
star
78

msgraph-sample-spfx

This sample demonstrates how to use the Microsoft Graph JavaScript SDK to access data in Office 365 from SharePoint Framework (SPFX) applications.
JavaScript
35
star
79

angular2-connect-rest-sample

[ARCHIVED] To see a current sample that demonstrates the concepts explained here, visit https://github.com/microsoftgraph/angular4-connect-sample
TypeScript
35
star
80

msgraph-sdk-java-auth

Authentication Providers for Microsoft Graph Java SDK
Java
34
star
81

ruby-connect-rest-sample

[ARCHIVED] Use Microsoft Graph to access a user’s Microsoft account resources from within a Ruby on Rails web application. This sample uses REST calls directly to Microsoft Graph, and uses the Azure AD v2.0 endpoint for authentication of users' work or school Office 365 accounts.
Ruby
33
star
82

meetings-capture-sample

A Microsoft Teams solution that helps teams capture meeting minute notes inside individual channels
HTML
33
star
83

msgraph-sample-blazor-clientside

This sample demonstrates how to use the Microsoft Graph .NET SDK to access data in Office 365 from Blazor WebAssembly apps.
HTML
32
star
84

msgraph-sdk-dotnet-contrib

Community contributed extensions to the Microsoft Graph .NET SDK service library, to support APIs that have not yet made it into Microsoft Graph
C#
32
star
85

msgraph-sample-maui

This sample demonstrates how to use the Microsoft Graph .NET SDK to access data in Office 365 from .NET MAUI apps.
C#
31
star
86

msgraph-sample-uwp

This sample demonstrates how to use the Microsoft Graph .NET SDK to access data in Office 365 from UWP apps.
C#
30
star
87

msgraph-samples-dashboard

Dashboard for msgraph samples
C#
30
star
88

contoso-airlines-azure-functions-sample

[ARCHIVED]
C#
29
star
89

botframework-csharp-excelbot-rest-sample

[ARCHIVED] Excel Bot is a bot built with the Microsoft Bot Framework that demonstrates how to use Excel with the Microsoft Graph API
C#
29
star
90

msgraph-training-building-apps

[ARCHIVED] Microsoft Graph Training Module - Building Apps
28
star
91

uwp-csharp-connect-sample

[ARCHIVED] This sample shows how to connect your Windows 10 Universal app to Office 365 using the Microsoft Graph .NET client library to send an email.
C#
28
star
92

msgraph-beta-sdk-python

Python
27
star
93

msgraph-training-powerautomate

Microsoft Graph Training Module - Create a Microsoft Graph JSON Batch Custom Connector for Microsoft Power Automate & Azure Logic Apps
26
star
94

python-sample-send-mail

[ARCHIVED] send email from Python via Microsoft Graph
Python
26
star
95

uwp-csharp-snippets-sample

[ARCHIVED] This sample shows how to use the Microsoft Graph SDK to send email, manage groups, and perform other activities with Office 365 data.
C#
25
star
96

msgraph-sdk-ios

[ARCHIVED] Microsoft Graph SDK for iOS
Objective-C
24
star
97

msgraph-training-dataconnect

24
star
98

react-officeuifabric-sample

[ARCHIVED] This sample demonstrates how to populate Office UI Fabric React components with data retrieved from Microsoft Graph.
JavaScript
24
star
99

msgraph-beta-sdk-java

Microsoft Graph Beta Java SDK
Java
24
star
100

msgraph-sample-javascriptspa

This sample demonstrates how to use the Microsoft Graph JavaScript SDK to access data in Office 365 from JavaScript browser apps.
JavaScript
24
star