azurepower-automateintune

How do I programmatically get Configuration and Compliance policies?


In the Microsoft Intune Admin Center, I can list the Configuration and Compliance policies for my devices. I want to pull that information programmatically, like from a Power Automate Flow. Is there an endpoint that returns these policies?

I am currently using MDE Endpoints, so I can pull information about Machines. But I can't find anything in the documentation that refers to policies.

I can go to a browser (Microsoft Intune Admin Center) and see what I want (Configuration and Compliance policies). I just do not know how, programmatically, to get that same information.

UPDATE: I have accepted an answer for Graph API that shows me Compliance policies, but Configuration only returns policies of a specific policy type. I have created a new question specific to that issue here: How do I programmatically get Configuration policies for all policy types?


Solution

  • NOTE: Ensure to Consent at least DeviceManagementConfiguration.Read.All permission in Microsoft Graph Explorer.

    To list the devicesConfiguration policy:

    GET https://graph.microsoft.com/v1.0/deviceManagement/deviceConfigurations
    

    Response:

    enter image description here

    Also, I've verified the same from Microsoft Intune Admin Center the same deviceConfiguration policy of displayName is present.

    enter image description here

    To list the devicesCompliance policy:

    GET https://graph.microsoft.com/v1.0/deviceManagement/deviceCompliancePolicies
    

    enter image description here

    Also, I've verified the same from Microsoft Intune Admin Center the same deviceCompliance policy of displayName is present.

    enter image description here

    Reference:

    List deviceConfiguration Policies

    List deviceCompliance Policies