Policy States - Summarize For Subscription

Summarizes policy states for the resources under the subscription.

POST https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates/latest/summarize?api-version=2018-04-04
POST https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates/latest/summarize?api-version=2018-04-04&$top={$top}&$from={$from}&$to={$to}&$filter={$filter}

URI Parameters

Name In Required Type Description
subscriptionId
path True
  • string

Microsoft Azure subscription ID.

policyStatesSummaryResource
path True
  • string

The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value.

api-version
query True
  • string

API version to use with the client requests.

$top
query
  • integer
int32

Maximum number of records to return.

$from
query
  • string
date-time

ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, the service uses ($to - 1-day).

$to
query
  • string
date-time

ISO 8601 formatted timestamp specifying the end time of the interval to query. When not specified, the service uses request time.

$filter
query
  • string

OData filter expression.

Responses

Name Type Description
200 OK

Summarize results.

Other Status Codes

Error response describing why the operation failed.

Security

azure_auth

Azure Active Directory OAuth2 Flow

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

Summarize at subscription scope

Sample Request

POST https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyStates/latest/summarize?api-version=2018-04-04&$top=5

Sample Response

{
  "@odata.context": "https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyStates/$metadata#summary",
  "@odata.count": 1,
  "value": [
    {
      "@odata.id": null,
      "@odata.context": "https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyStates/$metadata#summary/$entity",
      "results": {
        "queryResultsUri": "https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyStates/latest/queryResults?api-version=2018-04-04&$from=2018-02-12 19:48:53Z&$to=2018-02-13 19:48:53Z&$filter=IsCompliant eq false",
        "nonCompliantResources": 619,
        "nonCompliantPolicies": 40
      },
      "policyAssignments": [
        {
          "policyAssignmentId": "/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/microsoft.authorization/policyassignments/e46af646ebdb461dba708e01",
          "policySetDefinitionId": "/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/microsoft.authorization/policysetdefinitions/a03db67e-a286-43c3-9098-b2da83d361ad",
          "results": {
            "queryResultsUri": "https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyStates/latest/queryResults?api-version=2018-04-04&$from=2018-02-12 19:48:53Z&$to=2018-02-13 19:48:53Z&$filter=IsCompliant eq false and PolicyAssignmentId eq '/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/microsoft.authorization/policyassignments/e46af646ebdb461dba708e01'",
            "nonCompliantResources": 557,
            "nonCompliantPolicies": 1
          },
          "policyDefinitions": [
            {
              "policyDefinitionId": "/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/microsoft.authorization/policydefinitions/c8b79b49-a579-4045-984e-1b249ab8b474",
              "policyDefinitionReferenceId": "",
              "effect": "audit",
              "results": {
                "queryResultsUri": "https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyStates/latest/queryResults?api-version=2018-04-04&$from=2018-02-12 19:48:53Z&$to=2018-02-13 19:48:53Z&$filter=IsCompliant eq false and PolicyAssignmentId eq '/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/microsoft.authorization/policyassignments/e46af646ebdb461dba708e01' and PolicyDefinitionId eq '/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/microsoft.authorization/policydefinitions/c8b79b49-a579-4045-984e-1b249ab8b474'",
                "nonCompliantResources": 557
              }
            }
          ]
        },
        {
          "policyAssignmentId": "/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/microsoft.authorization/policyassignments/d9da7e80af6344ab9d342aa7",
          "policySetDefinitionId": "",
          "results": {
            "queryResultsUri": "https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyStates/latest/queryResults?api-version=2018-04-04&$from=2018-02-12 19:48:53Z&$to=2018-02-13 19:48:53Z&$filter=IsCompliant eq false and PolicyAssignmentId eq '/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/microsoft.authorization/policyassignments/d9da7e80af6344ab9d342aa7'",
            "nonCompliantResources": 557,
            "nonCompliantPolicies": 1
          },
          "policyDefinitions": [
            {
              "policyDefinitionId": "/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/microsoft.authorization/policydefinitions/24813039-7534-408a-9842-eb99f45721b1",
              "policyDefinitionReferenceId": "",
              "effect": "audit",
              "results": {
                "queryResultsUri": "https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyStates/latest/queryResults?api-version=2018-04-04&$from=2018-02-12 19:48:53Z&$to=2018-02-13 19:48:53Z&$filter=IsCompliant eq false and PolicyAssignmentId eq '/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/microsoft.authorization/policyassignments/d9da7e80af6344ab9d342aa7' and PolicyDefinitionId eq '/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/microsoft.authorization/policydefinitions/24813039-7534-408a-9842-eb99f45721b1'",
                "nonCompliantResources": 557
              }
            }
          ]
        },
        {
          "policyAssignmentId": "/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/microsoft.authorization/policyassignments/dcda79d769674aea8bfcaa49",
          "policySetDefinitionId": "",
          "results": {
            "queryResultsUri": "https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyStates/latest/queryResults?api-version=2018-04-04&$from=2018-02-12 19:48:53Z&$to=2018-02-13 19:48:53Z&$filter=IsCompliant eq false and PolicyAssignmentId eq '/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/microsoft.authorization/policyassignments/dcda79d769674aea8bfcaa49'",
            "nonCompliantResources": 557,
            "nonCompliantPolicies": 1
          },
          "policyDefinitions": [
            {
              "policyDefinitionId": "/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/microsoft.authorization/policydefinitions/c8b79b49-a579-4045-984e-1b249ab8b474",
              "policyDefinitionReferenceId": "",
              "effect": "audit",
              "results": {
                "queryResultsUri": "https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyStates/latest/queryResults?api-version=2018-04-04&$from=2018-02-12 19:48:53Z&$to=2018-02-13 19:48:53Z&$filter=IsCompliant eq false and PolicyAssignmentId eq '/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/microsoft.authorization/policyassignments/dcda79d769674aea8bfcaa49' and PolicyDefinitionId eq '/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/microsoft.authorization/policydefinitions/c8b79b49-a579-4045-984e-1b249ab8b474'",
                "nonCompliantResources": 557
              }
            }
          ]
        },
        {
          "policyAssignmentId": "/providers/microsoft.management/managementgroups/myManagementGroup/providers/microsoft.authorization/policyassignments/1ef5d536aec743a0aa801c1a",
          "policySetDefinitionId": "/providers/microsoft.management/managementgroups/myManagementGroup/providers/microsoft.authorization/policysetdefinitions/335cefd2-ab16-430f-b364-974a170eb1d5",
          "results": {
            "queryResultsUri": "https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyStates/latest/queryResults?api-version=2018-04-04&$from=2018-02-12 19:48:53Z&$to=2018-02-13 19:48:53Z&$filter=IsCompliant eq false and PolicyAssignmentId eq '/providers/microsoft.management/managementgroups/myManagementGroup/providers/microsoft.authorization/policyassignments/1ef5d536aec743a0aa801c1a'",
            "nonCompliantResources": 557,
            "nonCompliantPolicies": 1
          },
          "policyDefinitions": [
            {
              "policyDefinitionId": "/providers/microsoft.management/managementgroups/myManagementGroup/providers/microsoft.authorization/policydefinitions/022d9357-5a90-46f7-9554-21d30ce4c32d",
              "policyDefinitionReferenceId": "",
              "effect": "audit",
              "results": {
                "queryResultsUri": "https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyStates/latest/queryResults?api-version=2018-04-04&$from=2018-02-12 19:48:53Z&$to=2018-02-13 19:48:53Z&$filter=IsCompliant eq false and PolicyAssignmentId eq '/providers/microsoft.management/managementgroups/myManagementGroup/providers/microsoft.authorization/policyassignments/1ef5d536aec743a0aa801c1a' and PolicyDefinitionId eq '/providers/microsoft.management/managementgroups/myManagementGroup/providers/microsoft.authorization/policydefinitions/022d9357-5a90-46f7-9554-21d30ce4c32d'",
                "nonCompliantResources": 557
              }
            }
          ]
        },
        {
          "policyAssignmentId": "/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/microsoft.authorization/policyassignments/3f3c4330183b4e218fe6fd29",
          "policySetDefinitionId": "/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/microsoft.authorization/policysetdefinitions/3e3807c1-65c9-49e0-a406-82d8ae3e338c",
          "results": {
            "queryResultsUri": "https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyStates/latest/queryResults?api-version=2018-04-04&$from=2018-02-12 19:48:53Z&$to=2018-02-13 19:48:53Z&$filter=IsCompliant eq false and PolicyAssignmentId eq '/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/microsoft.authorization/policyassignments/3f3c4330183b4e218fe6fd29'",
            "nonCompliantResources": 552,
            "nonCompliantPolicies": 3
          },
          "policyDefinitions": [
            {
              "policyDefinitionId": "/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/microsoft.authorization/policydefinitions/24813039-7534-408a-9842-eb99f45721b1",
              "policyDefinitionReferenceId": "",
              "effect": "audit",
              "results": {
                "queryResultsUri": "https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyStates/latest/queryResults?api-version=2018-04-04&$from=2018-02-12 19:48:53Z&$to=2018-02-13 19:48:53Z&$filter=IsCompliant eq false and PolicyAssignmentId eq '/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/microsoft.authorization/policyassignments/3f3c4330183b4e218fe6fd29' and PolicyDefinitionId eq '/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/microsoft.authorization/policydefinitions/24813039-7534-408a-9842-eb99f45721b1'",
                "nonCompliantResources": 552
              }
            },
            {
              "policyDefinitionId": "/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/microsoft.authorization/policydefinitions/locationauditdefinition",
              "policyDefinitionReferenceId": "",
              "effect": "audit",
              "results": {
                "queryResultsUri": "https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyStates/latest/queryResults?api-version=2018-04-04&$from=2018-02-12 19:48:53Z&$to=2018-02-13 19:48:53Z&$filter=IsCompliant eq false and PolicyAssignmentId eq '/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/microsoft.authorization/policyassignments/3f3c4330183b4e218fe6fd29' and PolicyDefinitionId eq '/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/microsoft.authorization/policydefinitions/locationauditdefinition'",
                "nonCompliantResources": 29
              }
            },
            {
              "policyDefinitionId": "/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/microsoft.authorization/policydefinitions/3e3807c1-65c9-49e0-a406-82d8ae3e3682",
              "policyDefinitionReferenceId": "",
              "effect": "audit",
              "results": {
                "queryResultsUri": "https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyStates/latest/queryResults?api-version=2018-04-04&$from=2018-02-12 19:48:53Z&$to=2018-02-13 19:48:53Z&$filter=IsCompliant eq false and PolicyAssignmentId eq '/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/microsoft.authorization/policyassignments/3f3c4330183b4e218fe6fd29' and PolicyDefinitionId eq '/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/microsoft.authorization/policydefinitions/3e3807c1-65c9-49e0-a406-82d8ae3e3682'",
                "nonCompliantResources": 2
              }
            }
          ]
        }
      ]
    }
  ]
}

Definitions

Error

Error definition.

PolicyAssignmentSummary

Policy assignment summary.

PolicyDefinitionSummary

Policy definition summary.

QueryFailure

Error response.

SummarizeResults

Summarize action results.

Summary

Summary results.

SummaryResults

Non-compliance summary on a particular summary level.

Error

Error definition.

Name Type Description
code
  • string

Service specific error code which serves as the substatus for the HTTP error code.

message
  • string

Description of the error.

PolicyAssignmentSummary

Policy assignment summary.

Name Type Description
policyAssignmentId
  • string

Policy assignment ID.

policyDefinitions

Policy definitions summary.

policySetDefinitionId
  • string

Policy set definition ID, if the policy assignment is for a policy set.

results

Non-compliance summary for the policy assignment.

PolicyDefinitionSummary

Policy definition summary.

Name Type Description
effect
  • string

Policy effect, i.e. policy definition action.

policyDefinitionId
  • string

Policy definition ID.

policyDefinitionReferenceId
  • string

Policy definition reference ID.

results

Non-compliance summary for the policy definition.

QueryFailure

Error response.

Name Type Description
error

Error definition.

SummarizeResults

Summarize action results.

Name Type Description
@odata.context
  • string

OData context string; used by OData clients to resolve type information based on metadata.

@odata.count
  • integer

OData entity count; represents the number of summaries returned; always set to 1.

value

Summarize action results.

Summary

Summary results.

Name Type Description
@odata.context
  • string

OData context string; used by OData clients to resolve type information based on metadata.

@odata.id
  • string

OData entity ID; always set to null since summaries do not have an entity ID.

policyAssignments

Policy assignments summary.

results

Non-compliance summary for all policy assignments.

SummaryResults

Non-compliance summary on a particular summary level.

Name Type Description
nonCompliantPolicies
  • integer

Number of non-compliant policies.

nonCompliantResources
  • integer

Number of non-compliant resources.

queryResultsUri
  • string

HTTP POST URI for queryResults action on Microsoft.PolicyInsights to retrieve raw results for the non-compliance summary.