Skip to content

Commit a5ba9de

Browse files
authored
Merge pull request #28351 from microsoftgraph/user/abbhadauria/billingPolicyIdForPatchPu
Api for patch protection unit
2 parents 9433e6b + 29a7d6c commit a5ba9de

13 files changed

Lines changed: 672 additions & 1 deletion
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
---
2+
title: "Update driveProtectionUnit"
3+
description: "Update the properties of a driveProtectionUnit object."
4+
author: "abbhadauria"
5+
ms.reviewer: "haputta"
6+
ms.localizationpriority: medium
7+
ms.subservice: "m365-backup-storage"
8+
doc_type: apiPageType
9+
ms.date: 03/04/2026
10+
---
11+
12+
# Update driveProtectionUnit
13+
14+
Namespace: microsoft.graph
15+
16+
[!INCLUDE [beta-disclaimer](../../includes/beta-disclaimer.md)]
17+
18+
Update the properties of a [driveProtectionUnit](../resources/driveprotectionunit.md) object.
19+
20+
> [!NOTE]
21+
> This API is currently available only through the Microsoft Graph PowerShell SDK.
22+
23+
[!INCLUDE [national-cloud-support](../../includes/global-only.md)]
24+
25+
## Permissions
26+
27+
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions [only if your app requires it](/graph/permissions-overview#best-practices-for-using-microsoft-graph-permissions). For details about delegated and application permissions, see [Permission types](/graph/permissions-overview#permission-types). To learn more about these permissions, see the [permissions reference](/graph/permissions-reference).
28+
29+
<!-- { "blockType": "permissions", "name": "driveprotectionunit_update" } -->
30+
[!INCLUDE [permissions-table](../includes/permissions/driveprotectionunit-update-permissions.md)]
31+
32+
## HTTP request
33+
34+
<!-- {
35+
"blockType": "ignored"
36+
}
37+
-->
38+
```http
39+
PATCH /backupRestore/driveProtectionUnits/{driveProtectionUnitId}
40+
```
41+
42+
## Request headers
43+
44+
|Name|Description|
45+
|:---|:---|
46+
|Authorization|Bearer {token}. Required. Learn more about [authentication and authorization](/graph/auth/auth-concepts).|
47+
|Content-Type|application/json. Required.|
48+
49+
## Request body
50+
51+
This API supports updates only to the **billingPolicyId** property, and only for protection units removed from backup policies (**policyId** is an empty string `""` or `null`).
52+
53+
In the request body, provide a JSON representation of the following property.
54+
55+
|Property|Type|Description|
56+
|:---|:---|:---|
57+
|billingPolicyId|String|Optional. The unique identifier of the billing policy assigned to the protection unit. You can update this property only when **policyId** is `null` or an empty string (`""`).|
58+
59+
> **Note:** If **policyId** has a value, the protection unit is attached to a protection policy and **billingPolicyId** can't be updated.
60+
61+
## Response
62+
63+
If successful, this method returns a `200 OK` response code and an updated [driveProtectionUnit](../resources/driveprotectionunit.md) object in the response body.
64+
65+
For a list of possible error responses, see [Backup Storage API error responses](/graph/backup-storage-error-codes).
66+
67+
## Examples
68+
69+
### Example 1: Update the billing policy when the protection unit isn't attached to a protection policy
70+
71+
The following example shows how to update the **billingPolicyId** property when the protection unit isn't attached to a protection policy.
72+
73+
#### Request
74+
75+
The following example shows a request.
76+
77+
<!-- {
78+
"blockType": "request",
79+
"name": "driveprotectionunit_update_unattached_policy"
80+
}
81+
-->
82+
```msgraph-interactive
83+
PATCH https://graph.microsoft.com/beta/backupRestore/driveProtectionUnits/MGRkM2E3MTYtNGQ0Yi00MTIzLWEyMDUtN2EyYTgxMTNjMzYzXzQ=
84+
Content-Type: application/json
85+
86+
{
87+
"billingPolicyId": "fa3d95b5-2878-4de7-94f5-157f4b7607aa"
88+
}
89+
```
90+
91+
#### Response
92+
93+
The following example shows the response.
94+
<!-- {
95+
"blockType": "response",
96+
"truncated": true,
97+
"@odata.type": "microsoft.graph.driveProtectionUnit"
98+
}
99+
-->
100+
```http
101+
HTTP/1.1 200 OK
102+
Content-Type: application/json
103+
104+
{
105+
"@odata.type": "#microsoft.graph.driveProtectionUnit",
106+
"id": "MGRkM2E3MTYtNGQ0Yi00MTIzLWEyMDUtN2EyYTgxMTNjMzYzXzQ=",
107+
"directoryObjectId": "6b4a7195-59a5-4a31-ab17-1e73973d992e",
108+
"displayName": "Global Admin",
109+
"email": "gadmin@contoso.com",
110+
"policyId": "",
111+
"billingPolicyId": "fa3d95b5-2878-4de7-94f5-157f4b7607aa",
112+
"createdDateTime": "2026-03-05T11:07:57.7038797Z",
113+
"createdBy": {
114+
"user": {
115+
"identity": "6b4a7195-59a5-4a31-ab17-1e73973d992e"
116+
}
117+
},
118+
"status": "unprotected",
119+
"protectionSources": "none",
120+
"lastModifiedDateTime": "2026-03-09T05:46:56.8235422Z",
121+
"lastModifiedBy": {
122+
"user": {
123+
"identity": "6b4a7195-59a5-4a31-ab17-1e73973d992e"
124+
}
125+
},
126+
"offboardRequestedDateTime": "0001-01-01T00:00:00Z"
127+
}
128+
```
129+
130+
### Example 2: Update the billing policy when the protection unit is attached to a protection policy
131+
132+
The following example shows the response you get if you try to update the **billingPolicyId** property when the protection unit is attached to a protection policy.
133+
134+
#### Request
135+
136+
The following example shows a request.
137+
138+
<!-- {
139+
"blockType": "request",
140+
"name": "driveprotectionunit_update_attached_policy_error"
141+
}
142+
-->
143+
```http
144+
PATCH https://graph.microsoft.com/beta/backupRestore/driveProtectionUnits/NmFmNTQ2NTUtNTkwYS00YWU2LThkMDQtODRmNDI0OGMwZjU0XzE=
145+
Content-Type: application/json
146+
147+
{
148+
"billingPolicyId": "f65f082d-a073-4451-9a3b-2355956f2cd7"
149+
}
150+
```
151+
152+
#### Response
153+
154+
The following example shows the response.
155+
<!-- {
156+
"blockType": "response",
157+
"@odata.type": "microsoft.graph.publicError"
158+
}
159+
-->
160+
```http
161+
HTTP/1.1 403 Operation Not Allowed
162+
Content-Type: application/json
163+
164+
{
165+
"@odata.type": "#microsoft.graph.publicError",
166+
"code": "OperationNotAllowed",
167+
"message": "Only protection units removed from backup policies are allowed for this API.",
168+
"target": "billingPolicyId",
169+
"details": [],
170+
"innerError": {
171+
"@odata.type": "#microsoft.graph.publicError",
172+
"code": "OperationNotAllowed",
173+
"message": "The protection unit is attached to a backup policy.",
174+
"target": "policyId",
175+
"details": [],
176+
"innerError": null
177+
}
178+
}
179+
```
180+
181+
## Related content
182+
183+
- [driveProtectionUnit](../resources/driveprotectionunit.md)
Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
---
2+
title: "Update mailboxProtectionUnit"
3+
description: "Update the properties of a mailboxProtectionUnit object."
4+
author: "abbhadauria"
5+
ms.reviewer: "haputta"
6+
ms.localizationpriority: medium
7+
ms.subservice: "m365-backup-storage"
8+
doc_type: apiPageType
9+
ms.date: 03/04/2026
10+
---
11+
12+
# Update mailboxProtectionUnit
13+
14+
Namespace: microsoft.graph
15+
16+
[!INCLUDE [beta-disclaimer](../../includes/beta-disclaimer.md)]
17+
18+
Update the properties of a [mailboxProtectionUnit](../resources/mailboxprotectionunit.md) object.
19+
20+
> [!NOTE]
21+
> This API is currently available only through the Microsoft Graph PowerShell SDK.
22+
23+
[!INCLUDE [national-cloud-support](../../includes/global-only.md)]
24+
25+
## Permissions
26+
27+
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions [only if your app requires it](/graph/permissions-overview#best-practices-for-using-microsoft-graph-permissions). For details about delegated and application permissions, see [Permission types](/graph/permissions-overview#permission-types). To learn more about these permissions, see the [permissions reference](/graph/permissions-reference).
28+
29+
<!-- { "blockType": "permissions", "name": "mailboxprotectionunit_update" } -->
30+
[!INCLUDE [permissions-table](../includes/permissions/mailboxprotectionunit-update-permissions.md)]
31+
32+
## HTTP request
33+
34+
<!-- {
35+
"blockType": "ignored"
36+
}
37+
-->
38+
```http
39+
PATCH /backupRestore/mailboxProtectionUnits/{mailboxProtectionUnitId}
40+
```
41+
42+
## Request headers
43+
44+
|Name|Description|
45+
|:---|:---|
46+
|Authorization|Bearer {token}. Required. Learn more about [authentication and authorization](/graph/auth/auth-concepts).|
47+
|Content-Type|application/json. Required.|
48+
49+
## Request body
50+
51+
This API supports updates only to the **billingPolicyId** property, and only for protection units removed from backup policies (**policyId** is an empty string `""` or `null`).
52+
53+
In the request body, provide a JSON representation of the following property.
54+
55+
|Property|Type|Description|
56+
|:---|:---|:---|
57+
|billingPolicyId|String|Optional. The unique identifier of the billing policy assigned to the protection unit. You can update this property only when **policyId** is `null` or an empty string (`""`).|
58+
59+
> **Note:** If **policyId** has a value, the protection unit is attached to a protection policy and **billingPolicyId** can't be updated.
60+
61+
## Response
62+
63+
If successful, this method returns a `200 OK` response code and an updated [mailboxProtectionUnit](../resources/mailboxprotectionunit.md) object in the response body.
64+
65+
For a list of possible error responses, see [Backup Storage API error responses](/graph/backup-storage-error-codes).
66+
67+
## Examples
68+
69+
### Example 1: Update the billing policy when the protection unit isn't attached to a protection policy
70+
71+
The following example shows how to update the **billingPolicyId** property when the protection unit isn't attached to a protection policy.
72+
73+
#### Request
74+
75+
The following example shows a request.
76+
77+
<!-- {
78+
"blockType": "request",
79+
"name": "mailboxprotectionunit_update_unattached_policy"
80+
}
81+
-->
82+
```msgraph-interactive
83+
PATCH https://graph.microsoft.com/beta/backupRestore/mailboxProtectionUnits/MjUyZTc3ZDEtM2IyYS00ZGMwLTkzYTMtMjkxZDI3NWZlY2YzXzM=
84+
Content-Type: application/json
85+
86+
{
87+
"billingPolicyId": "fa3d95b5-2878-4de7-94f5-157f4b7607aa"
88+
}
89+
```
90+
91+
#### Response
92+
93+
The following example shows the response.
94+
<!-- {
95+
"blockType": "response",
96+
"truncated": true,
97+
"@odata.type": "microsoft.graph.mailboxProtectionUnit"
98+
}
99+
-->
100+
```http
101+
HTTP/1.1 200 OK
102+
Content-Type: application/json
103+
104+
{
105+
"@odata.type": "#microsoft.graph.mailboxProtectionUnit",
106+
"id": "MjUyZTc3ZDEtM2IyYS00ZGMwLTkzYTMtMjkxZDI3NWZlY2YzXzM=",
107+
"directoryObjectId": "bb1b5307-d650-49cf-88cf-05eaf1b3bb33",
108+
"displayName": "Exo admin",
109+
"email": "exoadmin@contoso.com",
110+
"mailboxType": "user",
111+
"policyId": "",
112+
"billingPolicyId": "fa3d95b5-2878-4de7-94f5-157f4b7607aa",
113+
"createdDateTime": "2026-02-04T06:24:19.5736657Z",
114+
"createdBy": {
115+
"user": {
116+
"identity": "6294dedc-d456-4c78-9b2f-b4bae765fb09"
117+
}
118+
},
119+
"status": "unprotected",
120+
"protectionSources": "none",
121+
"lastModifiedDateTime": "2026-02-24T06:44:53.6014453Z",
122+
"lastModifiedBy": {
123+
"user": {
124+
"identity": "6294dedc-d456-4c78-9b2f-b4bae765fb09"
125+
}
126+
},
127+
"offboardRequestedDateTime": "0001-01-01T00:00:00Z"
128+
}
129+
```
130+
131+
### Example 2: Update the billing policy when the protection unit is attached to a protection policy
132+
133+
The following example shows the response you get if you try to update the **billingPolicyId** property when the protection unit is attached to a protection policy.
134+
135+
#### Request
136+
137+
The following example shows a request.
138+
139+
<!-- {
140+
"blockType": "request",
141+
"name": "mailboxprotectionunit_update_attached_policy_error"
142+
}
143+
-->
144+
```http
145+
PATCH https://graph.microsoft.com/beta/backupRestore/mailboxProtectionUnits/NmFmNTQ2NTUtNTkwYS00YWU2LThkMDQtODRmNDI0OGMwZjU0XzE=
146+
Content-Type: application/json
147+
148+
{
149+
"billingPolicyId": "f65f082d-a073-4451-9a3b-2355956f2cd7"
150+
}
151+
```
152+
153+
#### Response
154+
155+
The following example shows the response.
156+
<!-- {
157+
"blockType": "response",
158+
"@odata.type": "microsoft.graph.publicError"
159+
}
160+
-->
161+
```http
162+
HTTP/1.1 403 Operation Not Allowed
163+
Content-Type: application/json
164+
165+
{
166+
"@odata.type": "#microsoft.graph.publicError",
167+
"code": "OperationNotAllowed",
168+
"message": "Only protection units removed from backup policies are allowed for this API.",
169+
"target": "billingPolicyId",
170+
"details": [],
171+
"innerError": {
172+
"@odata.type": "#microsoft.graph.publicError",
173+
"code": "OperationNotAllowed",
174+
"message": "The protection unit is attached to a backup policy.",
175+
"target": "policyId",
176+
"details": [],
177+
"innerError": null
178+
}
179+
}
180+
```
181+
182+
## Related content
183+
184+
- [mailboxProtectionUnit](../resources/mailboxprotectionunit.md)

0 commit comments

Comments
 (0)