Loading...

MS Graph and Intune - A quick way to find the Graph equivalent from the Intune portal

In this post I will show you a quick way to find the resource graph equivalent to an action from the Intune portal


Context

See below what to we want:

- Execute an action from the Intune portal (change ame, action on device...)

- Automate this action

- Use Graph to do this

- Find the Graph equivalent of the Intune portal action  

 

The solution

In this solution, we will proceed as below:

1. Go to the Intune portal

2. Open the Developer mode with F12

3. Run the specific action from the Intune portal

4. Stop recording network log button in developer mode

5. Check the debeloper mode Network tab

6. Access to the Graph URL use for this action


Solution in action

We will try to find the appropriate Graph URL path for the below things:

- List all devices

- Change device name

- Action restart device

- List Group Policy details


List all devices

1. Go to Devices

2. Open the developer mode with F12

3. Go to the Network tab

4. Go to All devices

5. Click on the Stop recording network log

6. On the developer mode, the resource is displayed

7. Here it's managedDevices

8. Click on it

9. The resource path to use is displayed

10. The method to use is GET

11. A right-click on the resource allows you to copy it as PowerShell.



Change device name

1. Go to Devices

2. Go to All devices

3. Select a device

4. Open the developer mode with F12

5. Go to the Network tab

6. Click on the ...

7. Click on Rename device

8. Type a new name like POSTE-TEST

9. Click on Rename

10. Click on the Stop recording network log

11. On the developer mode, the resource is displayed

12. Here it's setDeviceName

13. Click on it

14. The resource path to use is displayed

15. The method to use is POST

16. Go at the bottom of the Network tab

17. Go to the Request Payload part

18. We have the below JSON payload:

19. This one will be used to rename the device

20. We will need it in JSON format to rename a device


Action restart device

1. Go to Devices

2. Go to All devices

3. select a device

4. Open the developer mode with F12

5. Go to the Network tab

6. Click on the ...

7. Click on Restart

8. Click on the Stop recording network log

9. On the developer mode, the resource is displayed

10. Here it's rebootNow

11. Click on it

12. The resource path to use is displayed

13. The method to use is POST


List Group Policy details

1. Go to Devices

2. Go to Group Policy analytics

3. Open the developer mode with F12

4. Go to the Network tab

5. Click on a report

6. Click on the Stop recording network log 

7. On the developer mode, the resource is displayed

8. Here it's groupPolicyMigrationReports

9. Click on it

10. The resource path to use is displayed

11. The method to use is mentioned and is GET


Graph X-Ray

What is it ?

Graph X-Ray is a great tool allowing you to understand how to use Graph to do something from the Intune/Azure portal.

It has ben built by Merill Fernando, see there


How to install it ?

It is available as browser extension:

- For Chrome: here

- For Edge: here

Or as an app in the MS Store.


In my case, I will add it as a Chome extension.

To do it proceed as below:

1. Click on the link

2. Click on Add to Chrome

3. Click on Add extension



How to use it ?

Now we have installed it let's find Graph equivalent of Intune resource.

Let's see some actions on the Intune portal and how to do it with Graph X ray.


Listing all devices

1. Go to the MEM portal

2. Click on Devices

3. Enable developer mode with F12

4. Click on the >>>

5. Select Graph X Ray

6. In the MEM portal, click on All devices

7. Graph X Ray gives you:

- The appropriate resource path

- How to use it with PowerShell


8. You can then save the script by clicking on Save script


9. This will download a PowerShell script to do your action


Renaming a device

1. Go to the MEM portal

2. Click on Devices

3. Click on All devices

4. Click on a device


5. Enable developer mode with F12

6. Click on the arrow

7. Select Graph X Ray

8. In the MEM portal, click on ...

9. Click on Rename device

10. Graph X Ray gives you the appropriate resource path


11. You can then save the script by clicking on Save script

12. This will download a PowerShell script to do your action


Creating a new group

1. Go to the MEM portal

2. Click on Groups

3. Enable developer mode with F12

4. Click on the arrow

5. Select Graph X Ray

6. In the MEM portal, click on New group

7. Type a name like: test xray


8. Click on Create

9. Graph X Ray gives you:

- The appropriate resource path

- How to use it with PowerShell


Removing a group

1. Go to the MEM portal

2. Click on Groups

3. Select the group to remove

4. Enable developer mode with F12

5. Select Graph X Ray

6. In the MEM portal, click on Delete

- Graph X Ray gives you:

- The appropriate resource path

7. How to use it with PowerShell



MS Graph 7647593231950050137

Enregistrer un commentaire

Accueil item

Award

Sponsors

You want to support me ?

Mes articles en français

Endpoint Manager award

Author of Books

Stats