Skip to content

Commit 64da0d6

Browse files
committed
how to fetch policies
1 parent d92eb34 commit 64da0d6

File tree

1 file changed

+71
-2
lines changed

1 file changed

+71
-2
lines changed

articles/purview/troubleshoot-policy-distribution.md

Lines changed: 71 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ To get the necessary context about Microsoft Purview policies, see concept guide
2828
## Overview
2929
There are two ways to fetch access policies from Microsoft Purview
3030
- Full pull: Provides a complete set of policies for a particular data resource scope.
31-
- Delta pull: Provides an incremental view of policies, that is, what has changed since the last pull request, whether that one was a full pull or a delta pull.
31+
- Delta pull: Provides an incremental view of policies, that is, what has changed since the last pull request, whether that one was a full pull or a delta pull. A full pull is required prior to the first delta pull.
3232

3333
Microsoft Purview policy model is described using [JSON syntax](https://datatracker.ietf.org/doc/html/rfc8259)
3434

@@ -49,9 +49,9 @@ GET {{endpoint}}/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupNam
4949
|Http Code|Http Code Description|Type|Description|Response|
5050
|---------|---------------------|----|-----------|--------|
5151
|200|Success|Success|Request processed successfully|Policy data|
52-
|404|Not Found|Error|The request path is invalid or not registered|Error data|
5352
|401|Unauthenticated|Error|No bearer token passed in request or invalid token|Error data|
5453
|403|Forbidden|Error|Other authentication errors|Error data|
54+
|404|Not found|Error|The request path is invalid or not registered|Error data|
5555
|500|Internal server error|Error|Backend service unavailable|Error data|
5656
|503|Backend service unavailable|Error|Backend service unavailable|Error data|
5757

@@ -95,6 +95,75 @@ GET https://relecloud-pv.purview.azure.com/pds/subscriptions/b285630c-8185-456b-
9595
}
9696
```
9797

98+
## Delta pull
99+
100+
### Request
101+
To fetch policies via full pull, send a `GET` request to /policyEvents as follows:
102+
103+
```
104+
GET {{endpoint}}/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProvider}/{resourceType}/{resourceName}/policyEvents?api-version={apiVersion}&syncToken={syncToken}
105+
```
106+
107+
Provide the syncToken you got from the prior pull in any successive delta pulls.
108+
109+
### Response status codes
110+
111+
|Http Code|Http Code Description|Type|Description|Response|
112+
|---------|---------------------|----|-----------|--------|
113+
|200|Success|Success|Request processed successfully|Policy data|
114+
|304|Not modified|Success|No events received since last delta pull call|None|
115+
|401|Unauthenticated|Error|No bearer token passed in request or invalid token|Error data|
116+
|403|Forbidden|Error|Other authentication errors|Error data|
117+
|404|Not found|Error|The request path is invalid or not registered|Error data|
118+
|500|Internal server error|Error|Backend service unavailable|Error data|
119+
|503|Backend service unavailable|Error|Backend service unavailable|Error data|
120+
121+
### Example for Arc-enabled SQL Server
122+
123+
##### Example parameters:
124+
- resourceProvider = Microsoft.AzureArcData
125+
- resourceType = sqlServerInstances
126+
- apiVersion = 2021-01-01-preview
127+
- syncToken = 808:0
128+
129+
##### Example request:
130+
```
131+
https://relecloud-pv.purview.azure.com/pds/subscriptions/b285630c-8185-456b-80ae-97296561303e/resourceGroups/Finance-rg/providers/Microsoft.AzureArcData/sqlServerInstances/vm-finance/policyEvents?api-version=2021-01-01-preview&syncToken=808:0
132+
```
133+
134+
##### Example response:
135+
136+
```json
137+
{
138+
"count": 2,
139+
"syncToken": "816:0",
140+
"elements": [
141+
{
142+
"eventType": "Microsoft.Purview/PolicyElements/Write",
143+
"id": "6554a0d5-2d18-49fb-b44d-dc26f935fc61",
144+
"scopes": [
145+
"/subscriptions/b285630c-8185-456b-80ae-97296561303e/resourceGroups/Finance-rg/providers/Microsoft.AzureArcData/SqlServerInstances/vm-finance"
146+
],
147+
"kind": "policyset",
148+
"updatedAt": "2022-11-09T00:46:23.2085292Z",
149+
"version": 1,
150+
"elementJson": "{\"id\":\"6554a0d5-2d18-49fb-b44d-dc26f935fc61\",\"name\":\"6554a0d5-2d18-49fb-b44d-dc26f935fc61\",\"kind\":\"policyset\",\"version\":1,\"updatedAt\":\"2022-11-09T00:46:23.2085292Z\",\"preconditionRules\":[{\"dnfCondition\":[[{\"attributeName\":\"resource.azure.path\",\"attributeValueIncludedIn\":[\"/subscriptions/b285630c-8185-456b-80ae-97296561303e/resourceGroups/Finance-rg/providers/Microsoft.AzureArcData/SqlServerInstances/vm-finance/**\"]}]]}],\"policyRefs\":[\"919a18b7-6dfd-4e3c-81c9-3414dcbd0cef\"]}"
151+
},
152+
{
153+
"eventType": "Microsoft.Purview/PolicyElements/Write",
154+
"id": "919a18b7-6dfd-4e3c-81c9-3414dcbd0cef",
155+
"scopes": [
156+
"/subscriptions/b285630c-8185-456b-80ae-97296561303e/resourceGroups/Finance-rg/providers/Microsoft.AzureArcData/SqlServerInstances/vm-finance"
157+
],
158+
"kind": "policy",
159+
"updatedAt": "2022-11-09T00:46:23.2085486Z",
160+
"version": 1,
161+
"elementJson": "{\"id\":\"919a18b7-6dfd-4e3c-81c9-3414dcbd0cef\",\"name\":\"ArcSQL-Finance_sqlperfmonitor\",\"kind\":\"policy\",\"version\":1,\"updatedAt\":\"2022-11-09T00:46:23.2085486Z\",\"decisionRules\":[{\"kind\":\"decisionrule\",\"effect\":\"Permit\",\"updatedAt\":\"11/09/2022 00:46:23\",\"cnfCondition\":[[{\"attributeName\":\"resource.azure.path\",\"attributeValueIncludedIn\":[\"/subscriptions/b285630c-8185-456b-80ae-97296561303e/resourceGroups/Finance-rg/providers/Microsoft.AzureArcData/SqlServerInstances/vm-finance/**\"]}],[{\"fromRule\":\"purviewdatarole_builtin_sqlperfmonitor\",\"attributeName\":\"derived.purview.role\",\"attributeValueIncludes\":\"purviewdatarole_builtin_sqlperfmonitor\"}],[{\"attributeName\":\"principal.microsoft.groups\",\"attributeValueIncludedIn\":[\"e119d3ec-8353-4a33-96e7-e1a95680d37d\"]}]]},{\"kind\":\"decisionrule\",\"effect\":\"Permit\",\"id\":\"auto_81cd13c9-0417-4b97-a310-c14009a7c2ed\",\"updatedAt\":\"11/09/2022 00:46:23\",\"cnfCondition\":[[{\"attributeName\":\"resource.azure.path\",\"attributeValueIncludedIn\":[\"/subscriptions/b285630c-8185-456b-80ae-97296561303e/resourceGroups/Finance-rg/providers/Microsoft.AzureArcData/SqlServerInstances/vm-finance\"]}],[{\"attributeName\":\"request.azure.dataAction\",\"attributeValueIncludedIn\":[\"Microsoft.Sql/sqlservers/Connect\"]}],[{\"attributeName\":\"principal.microsoft.groups\",\"attributeValueIncludedIn\":[\"e119d3ec-8353-4a33-96e7-e1a95680d37d\"]}]]},{\"kind\":\"decisionrule\",\"effect\":\"Permit\",\"id\":\"auto_4b655d27-c8b0-4aa7-aa36-27f95ede2ada\",\"updatedAt\":\"11/09/2022 00:46:23\",\"cnfCondition\":[[{\"attributeName\":\"resource.azure.path\",\"attributeValueIncludedIn\":[\"/subscriptions/b285630c-8185-456b-80ae-97296561303e/resourceGroups/Finance-rg/providers/Microsoft.AzureArcData/SqlServerInstances/vm-finance/databases/**\"]}],[{\"attributeName\":\"request.azure.dataAction\",\"attributeValueIncludedIn\":[\"Microsoft.Sql/sqlservers/databases/Connect\"]}],[{\"attributeName\":\"principal.microsoft.groups\",\"attributeValueIncludedIn\":[\"e119d3ec-8353-4a33-96e7-e1a95680d37d\"]}]]}]}"
162+
}
163+
]
164+
}
165+
```
166+
98167
## Policy constructs
99168
There are 3 top-level policy constructs used within the full pull (/policyElements) and delta pull (/policyEvents) requests: PolicySet, Policy and AttributeRule.
100169

0 commit comments

Comments
 (0)