Forum Discussion

spying1001's avatar
spying1001
Copper Contributor
Nov 21, 2024

intune device disable

Hello Everyone – Help needed I’m supporting SD teams in our company providing automated way to quickly offboard some employees.One of the tasks is to disable Entra device objects.While I can disable the Entra Objects using Intune console, I cannot do that via Graph API nor via Powershell Graph API Is it possible ?

2 Replies

  • kyazaferr's avatar
    kyazaferr
    Steel Contributor

    Using Microsoft Graph API to Disable Devices

    To disable an Azure AD device using the Microsoft Graph API, you would typically update the device's accountEnabled property to false. Here's how you can do it using Graph API:

    1. Get the device ID: You'll need the ID of the device object in Azure AD, which you can retrieve using the Microsoft Graph API.
    2. Example GET request to list devices:

      Troubleshooting Tips

      • Permissions: Make sure the account you are using to authenticate has the necessary permissions (Device.ReadWrite.All or Directory.ReadWrite.All).
      • Token Scopes: When using Graph API directly, ensure that your authentication token includes the required permissions.
      • API Version: Ensure you're using the appropriate version of the Microsoft Graph API (v1.0 or beta) depending on your requirements.
    3.  
    • spying1001's avatar
      spying1001
      Copper Contributor

      Thanks but its not working 

      it doesnt gave me any error output but devices status not changing in AD ,

Resources