Skip to content

Commit 59b9df4

Browse files
committed
REST API method to enable/disable REST API
1 parent 55c6ecf commit 59b9df4

File tree

2 files changed

+131
-0
lines changed

2 files changed

+131
-0
lines changed
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
---
2+
title: Update Recovery Services vault configuration properties using REST API
3+
description: In this article, learn how to update vault's configuration using REST API.
4+
ms.topic: conceptual
5+
ms.date: 12/06/2019
6+
ms.assetid: 9aafa5a0-1e57-4644-bf79-97124db27aa2
7+
---
8+
# Update Azure Recovery Services Vault configurations using REST API
9+
10+
## Soft delete state
11+
12+
Deleting backups of a protected item is significant operation that has to be monitored. To protect against accidental deletions, Azure Recovery services vault has a soft-delete capability. This capability allows customers to restore deleted backups, if necessary, within a time period after the deletion.
13+
14+
But there are scenarios in which this capability is not required. A Recovery Services vault cannot be deleted if there are backup items within it, even soft-deleted ones. This may pose a problem if the vault needs to be immediately deleted. For for example: often, deployment operations clean up the created resources in the same workflow. A deployment can create a vault, configure backups for an item, do a test restore and then proceed to delete the backup items and the vault. If the vault deletion fails, the entire deployment might fail. Disabling soft-delete is the only way to guarantee immediate deletion.
15+
16+
Hence, the customer needs to carefully choose whether or not to disable soft-delete for a particular vault depending on the scenario. For more information, see the [soft-delete article](backup-azure-security-feature-cloud.md#soft-delete).
17+
18+
### Fetch soft delete state using REST API
19+
20+
By default, the soft-delete state will be enabled for any newly created Recovery services vault. To fetch/update the state of soft-delete for a vault, use the backup vault's config related [REST API document](https://docs.microsoft.com/rest/api/backup/backupresourcevaultconfigs)
21+
22+
To fetch the current state of soft-delete for a vault, use the following *GET* operation
23+
24+
```http
25+
GET https://management.azure.com/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig?api-version=2019-05-13
26+
```
27+
28+
The GET URI has `{subscriptionId}`, `{vaultName}`, `{vaultresourceGroupName}` parameters. Let us take an example, `{vaultName}` is "testVault" and `{vaultresourceGroupName}` is "testVaultRG". As all the required parameters are given in the URI, there is no need for a separate request body.
29+
30+
```http
31+
GET https://management.azure.com/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testVaultRG/providers/Microsoft.RecoveryServices/vaults/testVault/backupconfig/vaultconfig?api-version=2019-05-13
32+
```
33+
34+
#### Responses
35+
36+
The successful responses for the 'GET' operation is shown below:
37+
38+
|Name |Type |Description |
39+
|---------|---------|---------|
40+
|200 OK | [BackupResourceVaultConfig](https://docs.microsoft.com/rest/api/backup/backupresourcevaultconfigs/get#backupresourcevaultconfigresource) | OK |
41+
42+
##### Example response
43+
44+
Once the 'GET' request is submitted, a 200 (successful) response is returned.
45+
46+
```json
47+
{
48+
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testvaultRG/providers/Microsoft.RecoveryServices/vaults/testvault/backupconfig/vaultconfig",
49+
"name": "vaultconfig",
50+
"type": "Microsoft.RecoveryServices/vaults/backupconfig",
51+
"properties": {
52+
"enhancedSecurityState": "Enabled",
53+
"softDeleteFeatureState": "Enabled"
54+
}
55+
}
56+
```
57+
58+
### Update soft delete state using REST API
59+
60+
To update the soft-delete state of the recovery services vault using REST API, use the following *PATCH* operation
61+
62+
```http
63+
PATCH https://management.azure.com/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig?api-version=2019-05-13
64+
```
65+
66+
The PATCH URI has `{subscriptionId}`, `{vaultName}`, `{vaultresourceGroupName}` parameters. Let us take an example, `{vaultName}` is "testVault" and `{vaultresourceGroupName}` is "testVaultRG". If we replace the URI with above values, then the URI will look like this.
67+
68+
```http
69+
PATCH https://management.azure.com/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testVaultRG/providers/Microsoft.RecoveryServices/vaults/testVault/backupconfig/vaultconfig?api-version=2019-05-13
70+
```
71+
72+
#### Create the request body
73+
74+
THe following common definitions are used to create a request body
75+
76+
For more details, refer to [the REST API documentation](https://docs.microsoft.com/rest/api/backup/backupresourcevaultconfigs/update#request-body)
77+
78+
|Name |Required |Type |Description |
79+
|---------|---------|---------|---------|
80+
|eTag | | String | Optional eTag |
81+
|location | true |String | Resource location |
82+
|properties | | [VaultProperties](https://docs.microsoft.com/rest/api/recoveryservices/vaults/createorupdate#vaultproperties) | Properties of the vault |
83+
|tags | | Object | Resource tags |
84+
85+
#### Example request body
86+
87+
The following example is used to update the soft-delete sate to 'disabled'.
88+
89+
```json
90+
{
91+
"properties": {
92+
"enhancedSecurityState": "Enabled",
93+
"softDeleteFeatureState": "Disabled"
94+
}
95+
}
96+
```
97+
98+
#### Responses
99+
100+
The successful responses for the 'PATCH' operation is shown below:
101+
102+
|Name |Type |Description |
103+
|---------|---------|---------|
104+
|200 OK | [BackupResourceVaultConfig](https://docs.microsoft.com/rest/api/backup/backupresourcevaultconfigs/get#backupresourcevaultconfigresource) | OK |
105+
106+
##### Example response
107+
108+
Once the 'PATCH' request is submitted, a 200 (successful) response is returned.
109+
110+
```json
111+
{
112+
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testvaultRG/providers/Microsoft.RecoveryServices/vaults/testvault/backupconfig/vaultconfig",
113+
"name": "vaultconfig",
114+
"type": "Microsoft.RecoveryServices/vaults/backupconfig",
115+
"properties": {
116+
"enhancedSecurityState": "Enabled",
117+
"softDeleteFeatureState": "Disabled"
118+
}
119+
}
120+
```
121+
122+
## Next steps
123+
124+
[Create a backup policy for backing up an Azure VM in this vault](backup-azure-arm-userestapi-createorupdatepolicy.md).
125+
126+
For more information on the Azure REST APIs, see the following documents:
127+
128+
- [Azure Recovery Services provider REST API](/rest/api/recoveryservices/)
129+
- [Get started with Azure REST API](/rest/api/azure/)

articles/backup/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,8 @@
216216
items:
217217
- name: Create Recovery Services vault
218218
href: backup-azure-arm-userestapi-createorupdatevault.md
219+
- name: Update Recovery Services vault configurations
220+
href: backup-azure-arm-userestapi-updatersvaultproperties.md
219221
- name: Create and update backup policy
220222
href: backup-azure-arm-userestapi-createorupdatepolicy.md
221223
- name: Back up Azure VMs

0 commit comments

Comments
 (0)