Policy Tracked Resources - List Query Results For Resource Group

Queries policy tracked resources under the resource group.

POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyTrackedResources/default/queryResults?api-version=2018-07-01-preview
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyTrackedResources/default/queryResults?$top={$top}&$filter={$filter}&api-version=2018-07-01-preview

URI Parameters

Name In Required Type Description
subscriptionId
path True
  • string

Microsoft Azure subscription ID.

resourceGroupName
path True
  • string

Resource group name.

policyTrackedResourcesResource
path True
  • string

The name of the virtual resource under PolicyTrackedResources resource type; only "default" is allowed.

$top
query
  • integer
int32

Maximum number of records to return.

$filter
query
  • string

OData filter expression.

api-version
query True
  • string

Client Api Version.

Responses

Name Type Description
200 OK

Query 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

Query at resource group scope
Query at resource group scope using query parameters

Query at resource group scope

Sample Request

POST https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/resourceGroups/myResourceGroup/providers/Microsoft.PolicyInsights/policyTrackedResources/default/queryResults?api-version=2018-07-01-preview

Sample Response

{
  "value": [
    {
      "trackedResourceId": "/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Example/exampleResourceType/exampleTrackedResourceName1",
      "policyDetails": {
        "policyDefinitionId": "/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Authorization/policyDefinitions/myPolicyDefinition1",
        "policyAssignmentId": "/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Authorization/policyAssignments/myPolicyAssignment1",
        "policyAssignmentDisplayName": "My Policy Assignment 1 Display name",
        "policyAssignmentScope": "/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/",
        "policySetDefinitionId": "/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/providers/Microsoft.Authorization/policySetDefinitions/mySetDefinition",
        "policyDefinitionReferenceId": "123ABC"
      },
      "createdBy": {
        "policyDetails": {
          "policyDefinitionId": "/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Authorization/policyDefinitions/createdByPolicyDefinition",
          "policyAssignmentId": "/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Authorization/policyAssignments/createdByPolicyAssignment",
          "policyAssignmentScope": "/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/"
        },
        "deploymentId": "/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Resources/deployments/deploymentName",
        "deploymentTime": "2018-03-09T00:00:00.0000000Z"
      },
      "lastModifiedBy": {
        "policyDetails": {
          "policyDefinitionId": "/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Authorization/policyDefinitions/lastModifiedByPolicyDefinition",
          "policyAssignmentId": "/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Authorization/policyAssignments/lastModifiedByPolicyAssignment",
          "policyAssignmentScope": "/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/"
        },
        "deploymentId": "/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Resources/deployments/deploymentName",
        "deploymentTime": "2018-04-09T00:00:00.0000000Z"
      },
      "lastUpdateUtc": "2018-08-09T20:40:17.3585243Z"
    },
    {
      "trackedResourceId": "/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Example/exampleResourceType/exampleTrackedResourceName2",
      "policyDetails": {
        "policyDefinitionId": "/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Authorization/policyDefinitions/myPolicyDefinition2",
        "policyAssignmentId": "/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/providers/Microsoft.Authorization/policyAssignments/myPolicyAssignment2",
        "policyAssignmentScope": "/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/"
      },
      "lastUpdateUtc": "2018-08-10T00:40:17.3585243Z"
    }
  ]
}

Query at resource group scope using query parameters

Sample Request

POST https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/resourceGroups/myResourceGroup/providers/Microsoft.PolicyInsights/policyTrackedResources/default/queryResults?$top=1&$filter=PolicyAssignmentId eq '/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Authorization/policyAssignments/myPolicyAssignment' AND TrackedResourceId eq '/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Example/exampleResourceType/myResource/nestedResourceType/TrackedResource1'&api-version=2018-07-01-preview

Sample Response

{
  "value": [
    {
      "trackedResourceId": "/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Example/exampleResourceType/myResource/nestedResourceType/TrackedResource1",
      "policyDetails": {
        "policyDefinitionId": "/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Authorization/policyDefinitions/myPolicyDefinition1",
        "policyAssignmentId": "/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Authorization/policyAssignments/myPolicyAssignment1",
        "policyAssignmentDisplayName": "My Policy Assignment 1 Display name",
        "policyAssignmentScope": "/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/",
        "policySetDefinitionId": "/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/providers/Microsoft.Authorization/policySetDefinitions/mySetDefinition",
        "policyDefinitionReferenceId": "123ABC"
      },
      "createdBy": {
        "policyDetails": {
          "policyDefinitionId": "/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Authorization/policyDefinitions/createdByPolicyDefinition",
          "policyAssignmentId": "/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Authorization/policyAssignments/createdByPolicyAssignment",
          "policyAssignmentScope": "/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/"
        },
        "deploymentId": "/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Resources/deployments/deploymentName",
        "deploymentTime": "2018-03-09T00:00:00.0000000Z"
      },
      "lastModifiedBy": {
        "policyDetails": {
          "policyDefinitionId": "/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Authorization/policyDefinitions/lastModifiedByPolicyDefinition",
          "policyAssignmentId": "/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Authorization/policyAssignments/lastModifiedByPolicyAssignment",
          "policyAssignmentScope": "/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/"
        },
        "deploymentId": "/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myResourceGroup/providers/Microsoft.Resources/deployments/deploymentName",
        "deploymentTime": "2018-04-09T00:00:00.0000000Z"
      },
      "lastUpdateUtc": "2018-08-09T20:40:17.3585243Z"
    }
  ]
}

Definitions

Error

Error definition.

PolicyDetails

The policy details.

PolicyTrackedResource

Policy tracked resource record.

PolicyTrackedResourcesQueryResults

Query results.

QueryFailure

Error response.

TrackedResourceModificationDetails

The details of the policy triggered deployment that created or modified the tracked resource.

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.

PolicyDetails

The policy details.

Name Type Description
policyAssignmentDisplayName
  • string

The display name of the policy assignment.

policyAssignmentId
  • string

The ID of the policy assignment.

policyAssignmentScope
  • string

The scope of the policy assignment.

policyDefinitionId
  • string

The ID of the policy definition.

policyDefinitionReferenceId
  • string

The policy definition reference ID within the policy set definition.

policySetDefinitionId
  • string

The ID of the policy set definition.

PolicyTrackedResource

Policy tracked resource record.

Name Type Description
createdBy

The details of the policy triggered deployment that created the tracked resource.

lastModifiedBy

The details of the policy triggered deployment that modified the tracked resource.

lastUpdateUtc
  • string

Timestamp of the last update to the tracked resource.

policyDetails

The details of the policy that require the tracked resource.

trackedResourceId
  • string

The ID of the policy tracked resource.

PolicyTrackedResourcesQueryResults

Query results.

Name Type Description
nextLink
  • string

The URL to get the next set of results.

value

Query results.

QueryFailure

Error response.

Name Type Description
error

Error definition.

TrackedResourceModificationDetails

The details of the policy triggered deployment that created or modified the tracked resource.

Name Type Description
deploymentId
  • string

The ID of the deployment that created or modified the tracked resource.

deploymentTime
  • string

Timestamp of the deployment that created or modified the tracked resource.

policyDetails

The details of the policy that created or modified the tracked resource.