You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
18
-
19
-
Documentation for Intune and Microsoft Graph can be found here [Intune Graph Documentation](https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/resources/intune_graph_overview).
20
-
21
-
These samples demonstrate typical Intune administrator or Microsoft partner actions for managing Intune resources.
22
-
23
-
The following samples are included in this repository:
24
-
- AdminConsent
25
-
- AndroidEnterprise
26
-
- AppleEnrollment
27
-
- Applications
28
-
- ApplicationSync
29
-
- AppProtectionPolicy
30
-
- Auditing
31
-
- Authentication
32
-
- CertificationAuthority
33
-
- CheckStatus
34
-
- CompanyPortalBranding
35
-
- CompliancePolicy
36
-
- CorporateDeviceEnrollment
37
-
- DeviceConfiguration
38
-
- EnrollmentRestrictions
39
-
- IntuneDataExport
40
-
- LOB_Application
41
-
- ManagedDevices
42
-
- Paging
43
-
- RBAC
44
-
- RemoteActionAudit
45
-
- SoftwareUpdates
46
-
- TermsAndConditions
47
-
- UserPolicyReport
48
-
49
-
The scripts are licensed "as-is." under the MIT License.
50
-
51
-
#### Disclaimer
52
-
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.
53
-
54
-
## Using the Intune Graph API
55
-
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.
56
-
57
-
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.
58
-
59
-
## Prerequisites
60
-
Use of these Microsoft Graph API Intune PowerShell samples requires the following:
61
-
* Install the AzureAD PowerShell module by running 'Install-Module AzureAD' or 'Install-Module AzureADPreview' from an elevated PowerShell prompt
62
-
* 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)
63
-
* Using the Microsoft Graph APIs to configure Intune controls and policies requires an Intune license.
64
-
* An account with permissions to administer the Intune Service
65
-
* PowerShell v5.0 on Windows 10 x64 (PowerShell v4.0 is a minimum requirement for the scripts to function correctly)
66
-
* Note: For PowerShell 4.0 you will require the [PowershellGet Module for PS 4.0](https://www.microsoft.com/en-us/download/details.aspx?id=51451) to enable the usage of the Install-Module functionality
67
-
* First time usage of these scripts requires a Global Administrator of the Tenant to accept the permissions of the application
68
-
69
-
## Getting Started
70
-
After the prerequisites are installed or met, perform the following steps to use these scripts:
71
-
72
-
#### 1. Script usage
73
-
74
-
1. Download the contents of the repository to your local Windows machine
75
-
* Extract the files to a local folder (e.g. C:\IntuneGraphSamples)
76
-
* Run PowerShell x64 from the start menu
77
-
* Browse to the directory (e.g. cd C:\IntuneGraphSamples)
78
-
* For each Folder in the local repository you can browse to that directory and then run the script of your choice
79
-
* Example Application script usage:
80
-
* To use the Manage Applications scripts, from C:\IntuneGraphSamples, run "cd .\Applications\"
81
-
* Once in the folder run .\Application_MDM_Get.ps1 to get all MDM added applications
82
-
This sequence of steps can be used for each folder....
83
-
84
-
#### 2. Authentication with Microsoft Graph
85
-
The first time you run these scripts you will be asked to provide an account to authenticate with the service:
86
-
```
87
-
Please specify your user principal name for Azure Authentication:
88
-
```
89
-
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.
90
-
91
-
If you are running the script for the first time against your tenant a popup will be presented stating:
92
-
93
-
```
94
-
Microsoft Intune PowerShell needs permission to:
95
-
96
-
* Sign you in and read your profile
97
-
* Read all groups
98
-
* Read directory data
99
-
* Read and write Microsoft Intune Device Configuration and Policies (preview)
100
-
* Read and write Microsoft Intune RBAC settings (preview)
101
-
* Perform user-impacting remote actions on Microsoft Intune devices (preview)
102
-
* Sign in as you
103
-
* Read and write Microsoft Intune devices (preview)
104
-
* Read and write all groups
105
-
* Read and write Microsoft Intune configuration (preview)
106
-
* Read and write Microsoft Intune apps (preview)
107
-
```
108
-
109
-
Note: If your user account is targeted for device based conditional access your device must be enrolled or compliant to pass authentication.
110
-
111
-
## Contributing
112
-
113
-
If you'd like to contribute to this sample, see CONTRIBUTING.MD.
114
-
115
-
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.
116
-
117
-
## Questions and comments
118
-
119
-
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.
120
-
121
-
Your feedback is important to us. Connect with us on Stack Overflow. Tag your questions with [MicrosoftGraph] and [intune].
122
-
123
-
124
-
## Additional resources
125
-
*[Microsoft Graph API documentation](https://developer.microsoft.com/en-us/graph/docs)
Copyright (c) 2017 Microsoft. All rights reserved.
132
-
133
-
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.
15
+
# Intune Graph Samples
16
+
17
+
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.
18
+
19
+
Documentation for Intune and Microsoft Graph can be found here [Intune Graph Documentation](https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/resources/intune_graph_overview).
20
+
21
+
These samples demonstrate typical Intune administrator or Microsoft partner actions for managing Intune resources.
22
+
23
+
The following samples are included in this repository:
24
+
- AdminConsent
25
+
- AndroidEnterprise
26
+
- AppleEnrollment
27
+
- Applications
28
+
- ApplicationSync
29
+
- AppProtectionPolicy
30
+
- Auditing
31
+
- Authentication
32
+
- CertificationAuthority
33
+
- CheckStatus
34
+
- CompanyPortalBranding
35
+
- CompliancePolicy
36
+
- CorporateDeviceEnrollment
37
+
- DeviceConfiguration
38
+
- EnrollmentRestrictions
39
+
- IntuneDataExport
40
+
- LOB_Application
41
+
- ManagedDevices
42
+
- Paging
43
+
- RBAC
44
+
- RemoteActionAudit
45
+
- SoftwareUpdates
46
+
- TermsAndConditions
47
+
- UserPolicyReport
48
+
49
+
The scripts are licensed "as-is." under the MIT License.
50
+
51
+
#### Disclaimer
52
+
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.
53
+
54
+
## Using the Intune Graph API
55
+
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.
56
+
57
+
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.
58
+
59
+
## Prerequisites
60
+
Use of these Microsoft Graph API Intune PowerShell samples requires the following:
61
+
* Install the AzureAD PowerShell module by running 'Install-Module AzureAD' or 'Install-Module AzureADPreview' from an elevated PowerShell prompt
62
+
* 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)
63
+
* Using the Microsoft Graph APIs to configure Intune controls and policies requires an Intune license.
64
+
* An account with permissions to administer the Intune Service
65
+
* PowerShell v5.0 on Windows 10 x64 (PowerShell v4.0 is a minimum requirement for the scripts to function correctly)
66
+
* Note: For PowerShell 4.0 you will require the [PowershellGet Module for PS 4.0](https://www.microsoft.com/en-us/download/details.aspx?id=51451) to enable the usage of the Install-Module functionality
67
+
* First time usage of these scripts requires a Global Administrator of the Tenant to accept the permissions of the application
68
+
69
+
## Getting Started
70
+
After the prerequisites are installed or met, perform the following steps to use these scripts:
71
+
72
+
#### 1. Script usage
73
+
74
+
1. Download the contents of the repository to your local Windows machine
75
+
* Extract the files to a local folder (e.g. C:\IntuneGraphSamples)
76
+
* Run PowerShell x64 from the start menu
77
+
* Browse to the directory (e.g. cd C:\IntuneGraphSamples)
78
+
* For each Folder in the local repository you can browse to that directory and then run the script of your choice
79
+
* Example Application script usage:
80
+
* To use the Manage Applications scripts, from C:\IntuneGraphSamples, run "cd .\Applications\"
81
+
* Once in the folder run .\Application_MDM_Get.ps1 to get all MDM added applications
82
+
This sequence of steps can be used for each folder....
83
+
84
+
#### 2. Authentication with Microsoft Graph
85
+
The first time you run these scripts you will be asked to provide an account to authenticate with the service:
86
+
```
87
+
Please specify your user principal name for Azure Authentication:
88
+
```
89
+
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.
90
+
91
+
If you are running the script for the first time against your tenant a popup will be presented stating:
92
+
93
+
```
94
+
Microsoft Intune PowerShell needs permission to:
95
+
96
+
* Sign you in and read your profile
97
+
* Read all groups
98
+
* Read directory data
99
+
* Read and write Microsoft Intune Device Configuration and Policies (preview)
100
+
* Read and write Microsoft Intune RBAC settings (preview)
101
+
* Perform user-impacting remote actions on Microsoft Intune devices (preview)
102
+
* Sign in as you
103
+
* Read and write Microsoft Intune devices (preview)
104
+
* Read and write all groups
105
+
* Read and write Microsoft Intune configuration (preview)
106
+
* Read and write Microsoft Intune apps (preview)
107
+
```
108
+
109
+
Note: If your user account is targeted for device based conditional access your device must be enrolled or compliant to pass authentication.
110
+
111
+
## Contributing
112
+
113
+
If you'd like to contribute to this sample, see CONTRIBUTING.MD.
114
+
115
+
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.
116
+
117
+
## Questions and comments
118
+
119
+
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.
120
+
121
+
Your feedback is important to us. Connect with us on Stack Overflow. Tag your questions with [MicrosoftGraph] and [intune].
122
+
123
+
124
+
## Additional resources
125
+
*[Microsoft Graph API documentation](https://developer.microsoft.com/en-us/graph/docs)
Copyright (c) 2017 Microsoft. All rights reserved.
132
+
133
+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.
0 commit comments