Recovery Services 자격 증명 모음을 만들거나 업데이트합니다.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}?api-version=2025-02-01
URI 매개 변수
Name |
In(다음 안에) |
필수 |
형식 |
Description |
resourceGroupName
|
path |
True
|
string
minLength: 1 maxLength: 90
|
리소스 그룹의 이름입니다. 이름은 대소문자를 구분하지 않습니다.
|
subscriptionId
|
path |
True
|
string
minLength: 1
|
대상 구독의 ID입니다.
|
vaultName
|
path |
True
|
string
|
Vault의 이름입니다.
|
api-version
|
query |
True
|
string
minLength: 1
|
이 작업에 사용할 API 버전입니다.
|
Name |
필수 |
형식 |
Description |
x-ms-authorization-auxiliary
|
|
string
|
|
요청 본문
Name |
필수 |
형식 |
Description |
___location
|
True
|
string
|
리소스가 있는 지리적 위치
|
etag
|
|
string
|
etag를 사용합니다.
|
identity
|
|
IdentityData
|
리소스의 ID입니다.
|
properties
|
|
VaultProperties
|
자격 증명 모음의 속성입니다.
|
sku
|
|
Sku
|
각 Azure 리소스에 대한 고유 시스템 식별자를 식별합니다.
|
tags
|
|
object
|
리소스 태그.
|
응답
Name |
형식 |
Description |
200 OK
|
Vault
|
리소스 'Vault' 업데이트 작업이 성공했습니다.
|
201 Created
|
Vault
|
리소스 'Vault' 생성 작업이 성공했습니다.
헤더
- Location: string
- Retry-After: integer
|
Other Status Codes
|
CloudError
|
예기치 않은 오류 응답입니다.
|
보안
azure_auth
Azure Active Directory OAuth2 흐름.
형식:
oauth2
Flow:
implicit
권한 부여 URL:
https://login.microsoftonline.com/common/oauth2/authorize
범위
Name |
Description |
user_impersonation
|
사용자 계정 가장
|
예제
Create or Update Recovery Services vault
샘플 요청
PUT https://management.azure.com/subscriptions/77777777-b0c6-47a2-b37c-d8e65a629c18/resourceGroups/Default-RecoveryServices-ResourceGroup/providers/Microsoft.RecoveryServices/vaults/swaggerExample?api-version=2025-02-01
{
"identity": {
"type": "SystemAssigned"
},
"___location": "West US",
"properties": {
"publicNetworkAccess": "Enabled"
},
"sku": {
"name": "Standard"
}
}
import com.azure.resourcemanager.recoveryservices.models.IdentityData;
import com.azure.resourcemanager.recoveryservices.models.PublicNetworkAccess;
import com.azure.resourcemanager.recoveryservices.models.ResourceIdentityType;
import com.azure.resourcemanager.recoveryservices.models.Sku;
import com.azure.resourcemanager.recoveryservices.models.SkuName;
import com.azure.resourcemanager.recoveryservices.models.VaultProperties;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Vaults CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2025-02-01/examples/PUTVault.
* json
*/
/**
* Sample code: Create or Update Recovery Services vault.
*
* @param manager Entry point to RecoveryServicesManager.
*/
public static void createOrUpdateRecoveryServicesVault(
com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) {
manager.vaults().define("swaggerExample").withRegion("West US")
.withExistingResourceGroup("Default-RecoveryServices-ResourceGroup")
.withIdentity(new IdentityData().withType(ResourceIdentityType.SYSTEM_ASSIGNED))
.withProperties(new VaultProperties().withPublicNetworkAccess(PublicNetworkAccess.ENABLED))
.withSku(new Sku().withName(SkuName.STANDARD)).create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.recoveryservices import RecoveryServicesClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-recoveryservices
# USAGE
python put_vault.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = RecoveryServicesClient(
credential=DefaultAzureCredential(),
subscription_id="77777777-b0c6-47a2-b37c-d8e65a629c18",
)
response = client.vaults.begin_create_or_update(
resource_group_name="Default-RecoveryServices-ResourceGroup",
vault_name="swaggerExample",
vault={
"identity": {"type": "SystemAssigned"},
"___location": "West US",
"properties": {"publicNetworkAccess": "Enabled"},
"sku": {"name": "Standard"},
},
).result()
print(response)
# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2025-02-01/examples/PUTVault.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armrecoveryservices_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservices/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/82e9c6f9fbfa2d6d47d5e2a6a11c0ad2eb345c43/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2025-02-01/examples/PUTVault.json
func ExampleVaultsClient_BeginCreateOrUpdate_createOrUpdateRecoveryServicesVault() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armrecoveryservices.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewVaultsClient().BeginCreateOrUpdate(ctx, "Default-RecoveryServices-ResourceGroup", "swaggerExample", armrecoveryservices.Vault{
Location: to.Ptr("West US"),
Identity: &armrecoveryservices.IdentityData{
Type: to.Ptr(armrecoveryservices.ResourceIdentityTypeSystemAssigned),
},
Properties: &armrecoveryservices.VaultProperties{
PublicNetworkAccess: to.Ptr(armrecoveryservices.PublicNetworkAccessEnabled),
},
SKU: &armrecoveryservices.SKU{
Name: to.Ptr(armrecoveryservices.SKUNameStandard),
},
}, &armrecoveryservices.VaultsClientBeginCreateOrUpdateOptions{XMSAuthorizationAuxiliary: nil})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Vault = armrecoveryservices.Vault{
// Name: to.Ptr("swaggerExample"),
// Type: to.Ptr("Microsoft.RecoveryServices/vaults"),
// Etag: to.Ptr("W/\"datetime'2017-12-15T12%3A36%3A51.68Z'\""),
// ID: to.Ptr("/subscriptions/77777777-b0c6-47a2-b37c-d8e65a629c18/resourceGroups/Default-RecoveryServices-ResourceGroup/providers/Microsoft.RecoveryServices/vaults/swaggerExample"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "TestUpdatedKey": to.Ptr("TestUpdatedValue"),
// },
// Identity: &armrecoveryservices.IdentityData{
// Type: to.Ptr(armrecoveryservices.ResourceIdentityTypeSystemAssigned),
// PrincipalID: to.Ptr("3137d6c7-5d6c-411c-b934-7a2a729ee247"),
// TenantID: to.Ptr("d676e86e-2206-4a7c-999c-ece52c144b5b"),
// },
// Properties: &armrecoveryservices.VaultProperties{
// ProvisioningState: to.Ptr("Succeeded"),
// PublicNetworkAccess: to.Ptr(armrecoveryservices.PublicNetworkAccessEnabled),
// },
// SKU: &armrecoveryservices.SKU{
// Name: to.Ptr(armrecoveryservices.SKUNameRS0),
// Tier: to.Ptr("Standard"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { RecoveryServicesClient } = require("@azure/arm-recoveryservices");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Creates or updates a Recovery Services vault.
*
* @summary Creates or updates a Recovery Services vault.
* x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2025-02-01/examples/PUTVault.json
*/
async function createOrUpdateRecoveryServicesVault() {
const subscriptionId =
process.env["RECOVERYSERVICES_SUBSCRIPTION_ID"] || "77777777-b0c6-47a2-b37c-d8e65a629c18";
const resourceGroupName =
process.env["RECOVERYSERVICES_RESOURCE_GROUP"] || "Default-RecoveryServices-ResourceGroup";
const vaultName = "swaggerExample";
const vault = {
identity: { type: "SystemAssigned" },
___location: "West US",
properties: { publicNetworkAccess: "Enabled" },
sku: { name: "Standard" },
};
const credential = new DefaultAzureCredential();
const client = new RecoveryServicesClient(credential, subscriptionId);
const result = await client.vaults.beginCreateOrUpdateAndWait(
resourceGroupName,
vaultName,
vault,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
샘플 응답
{
"name": "swaggerExample",
"type": "Microsoft.RecoveryServices/vaults",
"etag": "W/\"datetime'2017-12-15T12%3A36%3A51.68Z'\"",
"id": "/subscriptions/77777777-b0c6-47a2-b37c-d8e65a629c18/resourceGroups/Default-RecoveryServices-ResourceGroup/providers/Microsoft.RecoveryServices/vaults/swaggerExample",
"identity": {
"type": "SystemAssigned",
"principalId": "3137d6c7-5d6c-411c-b934-7a2a729ee247",
"tenantId": "d676e86e-2206-4a7c-999c-ece52c144b5b"
},
"___location": "westus",
"properties": {
"provisioningState": "Succeeded",
"publicNetworkAccess": "Enabled"
},
"sku": {
"name": "RS0",
"tier": "Standard"
},
"tags": {
"TestUpdatedKey": "TestUpdatedValue"
}
}
{
"name": "swaggerExample",
"type": "Microsoft.RecoveryServices/vaults",
"etag": "W/\"datetime'2017-12-15T12%3A36%3A51.68Z'\"",
"id": "/subscriptions/77777777-b0c6-47a2-b37c-d8e65a629c18/resourceGroups/Default-RecoveryServices-ResourceGroup/providers/Microsoft.RecoveryServices/vaults/swaggerExample",
"identity": {
"type": "SystemAssigned",
"principalId": "3137d6c7-5d6c-411c-b934-7a2a729ee247",
"tenantId": "d676e86e-2206-4a7c-999c-ece52c144b5b"
},
"___location": "westus",
"properties": {
"provisioningState": "Succeeded",
"publicNetworkAccess": "Enabled"
},
"sku": {
"name": "RS0",
"tier": "Standard"
},
"tags": {
"TestUpdatedKey": "TestUpdatedValue"
}
}
샘플 요청
PUT https://management.azure.com/subscriptions/77777777-b0c6-47a2-b37c-d8e65a629c18/resourceGroups/Default-RecoveryServices-ResourceGroup/providers/Microsoft.RecoveryServices/vaults/swaggerExample?api-version=2025-02-01
{
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi": {}
}
},
"___location": "West US",
"properties": {
"encryption": {
"infrastructureEncryption": "Enabled",
"kekIdentity": {
"userAssignedIdentity": "/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi"
},
"keyVaultProperties": {
"keyUri": "https://cmk2xkv.vault.azure.net/keys/Key1/0767b348bb1a4c07baa6c4ec0055d2b3"
}
},
"publicNetworkAccess": "Enabled",
"resourceGuardOperationRequests": [
"/subscriptions/38304e13-357e-405e-9e9a-220351dcce8c/resourcegroups/ankurResourceGuard1/providers/Microsoft.DataProtection/resourceGuards/ResourceGuard38-1/modifyEncryptionSettings/default"
]
},
"sku": {
"name": "Standard"
}
}
import com.azure.resourcemanager.recoveryservices.models.CmkKekIdentity;
import com.azure.resourcemanager.recoveryservices.models.CmkKeyVaultProperties;
import com.azure.resourcemanager.recoveryservices.models.IdentityData;
import com.azure.resourcemanager.recoveryservices.models.InfrastructureEncryptionState;
import com.azure.resourcemanager.recoveryservices.models.PublicNetworkAccess;
import com.azure.resourcemanager.recoveryservices.models.ResourceIdentityType;
import com.azure.resourcemanager.recoveryservices.models.Sku;
import com.azure.resourcemanager.recoveryservices.models.SkuName;
import com.azure.resourcemanager.recoveryservices.models.UserIdentity;
import com.azure.resourcemanager.recoveryservices.models.VaultProperties;
import com.azure.resourcemanager.recoveryservices.models.VaultPropertiesEncryption;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Vaults CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2025-02-01/examples/
* PUTVault_ResourceGuardEnabled.json
*/
/**
* Sample code: Create or Update Vault performing critical operation With MUA.
*
* @param manager Entry point to RecoveryServicesManager.
*/
public static void createOrUpdateVaultPerformingCriticalOperationWithMUA(
com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) {
manager.vaults().define("swaggerExample").withRegion("West US")
.withExistingResourceGroup("Default-RecoveryServices-ResourceGroup")
.withIdentity(new IdentityData().withType(ResourceIdentityType.USER_ASSIGNED)
.withUserAssignedIdentities(mapOf(
"/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi",
new UserIdentity())))
.withProperties(new VaultProperties().withEncryption(new VaultPropertiesEncryption()
.withKeyVaultProperties(new CmkKeyVaultProperties().withKeyUri("fakeTokenPlaceholder"))
.withKekIdentity(new CmkKekIdentity().withUserAssignedIdentity(
"/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi"))
.withInfrastructureEncryption(InfrastructureEncryptionState.ENABLED))
.withPublicNetworkAccess(PublicNetworkAccess.ENABLED)
.withResourceGuardOperationRequests(Arrays.asList(
"/subscriptions/38304e13-357e-405e-9e9a-220351dcce8c/resourcegroups/ankurResourceGuard1/providers/Microsoft.DataProtection/resourceGuards/ResourceGuard38-1/modifyEncryptionSettings/default")))
.withSku(new Sku().withName(SkuName.STANDARD)).create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.recoveryservices import RecoveryServicesClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-recoveryservices
# USAGE
python put_vault_resource_guard_enabled.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = RecoveryServicesClient(
credential=DefaultAzureCredential(),
subscription_id="77777777-b0c6-47a2-b37c-d8e65a629c18",
)
response = client.vaults.begin_create_or_update(
resource_group_name="Default-RecoveryServices-ResourceGroup",
vault_name="swaggerExample",
vault={
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi": {}
},
},
"___location": "West US",
"properties": {
"encryption": {
"infrastructureEncryption": "Enabled",
"kekIdentity": {
"userAssignedIdentity": "/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi"
},
"keyVaultProperties": {
"keyUri": "https://cmk2xkv.vault.azure.net/keys/Key1/0767b348bb1a4c07baa6c4ec0055d2b3"
},
},
"publicNetworkAccess": "Enabled",
"resourceGuardOperationRequests": [
"/subscriptions/38304e13-357e-405e-9e9a-220351dcce8c/resourcegroups/ankurResourceGuard1/providers/Microsoft.DataProtection/resourceGuards/ResourceGuard38-1/modifyEncryptionSettings/default"
],
},
"sku": {"name": "Standard"},
},
).result()
print(response)
# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2025-02-01/examples/PUTVault_ResourceGuardEnabled.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armrecoveryservices_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservices/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/82e9c6f9fbfa2d6d47d5e2a6a11c0ad2eb345c43/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2025-02-01/examples/PUTVault_ResourceGuardEnabled.json
func ExampleVaultsClient_BeginCreateOrUpdate_createOrUpdateVaultPerformingCriticalOperationWithMua() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armrecoveryservices.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewVaultsClient().BeginCreateOrUpdate(ctx, "Default-RecoveryServices-ResourceGroup", "swaggerExample", armrecoveryservices.Vault{
Location: to.Ptr("West US"),
Identity: &armrecoveryservices.IdentityData{
Type: to.Ptr(armrecoveryservices.ResourceIdentityTypeUserAssigned),
UserAssignedIdentities: map[string]*armrecoveryservices.UserIdentity{
"/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi": {},
},
},
Properties: &armrecoveryservices.VaultProperties{
Encryption: &armrecoveryservices.VaultPropertiesEncryption{
InfrastructureEncryption: to.Ptr(armrecoveryservices.InfrastructureEncryptionStateEnabled),
KekIdentity: &armrecoveryservices.CmkKekIdentity{
UserAssignedIdentity: to.Ptr("/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi"),
},
KeyVaultProperties: &armrecoveryservices.CmkKeyVaultProperties{
KeyURI: to.Ptr("https://cmk2xkv.vault.azure.net/keys/Key1/0767b348bb1a4c07baa6c4ec0055d2b3"),
},
},
PublicNetworkAccess: to.Ptr(armrecoveryservices.PublicNetworkAccessEnabled),
ResourceGuardOperationRequests: []*string{
to.Ptr("/subscriptions/38304e13-357e-405e-9e9a-220351dcce8c/resourcegroups/ankurResourceGuard1/providers/Microsoft.DataProtection/resourceGuards/ResourceGuard38-1/modifyEncryptionSettings/default")},
},
SKU: &armrecoveryservices.SKU{
Name: to.Ptr(armrecoveryservices.SKUNameStandard),
},
}, &armrecoveryservices.VaultsClientBeginCreateOrUpdateOptions{XMSAuthorizationAuxiliary: nil})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Vault = armrecoveryservices.Vault{
// Name: to.Ptr("swaggerExample"),
// Type: to.Ptr("Microsoft.RecoveryServices/vaults"),
// Etag: to.Ptr("W/\"datetime'2017-12-15T12%3A36%3A51.68Z'\""),
// ID: to.Ptr("/subscriptions/77777777-b0c6-47a2-b37c-d8e65a629c18/resourceGroups/Default-RecoveryServices-ResourceGroup/providers/Microsoft.RecoveryServices/vaults/swaggerExample"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "TestUpdatedKey": to.Ptr("TestUpdatedValue"),
// },
// Identity: &armrecoveryservices.IdentityData{
// Type: to.Ptr(armrecoveryservices.ResourceIdentityTypeUserAssigned),
// UserAssignedIdentities: map[string]*armrecoveryservices.UserIdentity{
// "/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi": &armrecoveryservices.UserIdentity{
// ClientID: to.Ptr("fbe75b66-01c5-4f87-a220-233af3270436"),
// PrincipalID: to.Ptr("075a0ca6-43f6-4434-9abf-c9b1b79f9219"),
// },
// },
// },
// Properties: &armrecoveryservices.VaultProperties{
// Encryption: &armrecoveryservices.VaultPropertiesEncryption{
// InfrastructureEncryption: to.Ptr(armrecoveryservices.InfrastructureEncryptionStateEnabled),
// KekIdentity: &armrecoveryservices.CmkKekIdentity{
// UseSystemAssignedIdentity: to.Ptr(false),
// UserAssignedIdentity: to.Ptr("/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi"),
// },
// KeyVaultProperties: &armrecoveryservices.CmkKeyVaultProperties{
// KeyURI: to.Ptr("https://cmk2xkv.vault.azure.net/keys/Key1/0767b348bb1a4c07baa6c4ec0055d2b3"),
// },
// },
// ProvisioningState: to.Ptr("Succeeded"),
// PublicNetworkAccess: to.Ptr(armrecoveryservices.PublicNetworkAccessEnabled),
// },
// SKU: &armrecoveryservices.SKU{
// Name: to.Ptr(armrecoveryservices.SKUNameStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { RecoveryServicesClient } = require("@azure/arm-recoveryservices");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Creates or updates a Recovery Services vault.
*
* @summary Creates or updates a Recovery Services vault.
* x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2025-02-01/examples/PUTVault_ResourceGuardEnabled.json
*/
async function createOrUpdateVaultPerformingCriticalOperationWithMua() {
const subscriptionId =
process.env["RECOVERYSERVICES_SUBSCRIPTION_ID"] || "77777777-b0c6-47a2-b37c-d8e65a629c18";
const resourceGroupName =
process.env["RECOVERYSERVICES_RESOURCE_GROUP"] || "Default-RecoveryServices-ResourceGroup";
const vaultName = "swaggerExample";
const vault = {
identity: {
type: "UserAssigned",
userAssignedIdentities: {
"/subscriptions/85bf5e8c30844f42Add2746ebb7e97b2/resourcegroups/defaultrg/providers/MicrosoftManagedIdentity/userAssignedIdentities/examplemsi":
{},
},
},
___location: "West US",
properties: {
encryption: {
infrastructureEncryption: "Enabled",
kekIdentity: {
userAssignedIdentity:
"/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi",
},
keyVaultProperties: {
keyUri: "https://cmk2xkv.vault.azure.net/keys/Key1/0767b348bb1a4c07baa6c4ec0055d2b3",
},
},
publicNetworkAccess: "Enabled",
resourceGuardOperationRequests: [
"/subscriptions/38304e13-357e-405e-9e9a-220351dcce8c/resourcegroups/ankurResourceGuard1/providers/Microsoft.DataProtection/resourceGuards/ResourceGuard38-1/modifyEncryptionSettings/default",
],
},
sku: { name: "Standard" },
};
const credential = new DefaultAzureCredential();
const client = new RecoveryServicesClient(credential, subscriptionId);
const result = await client.vaults.beginCreateOrUpdateAndWait(
resourceGroupName,
vaultName,
vault,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
샘플 응답
{
"name": "swaggerExample",
"type": "Microsoft.RecoveryServices/vaults",
"etag": "W/\"datetime'2017-12-15T12%3A36%3A51.68Z'\"",
"id": "/subscriptions/77777777-b0c6-47a2-b37c-d8e65a629c18/resourceGroups/Default-RecoveryServices-ResourceGroup/providers/Microsoft.RecoveryServices/vaults/swaggerExample",
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi": {
"clientId": "fbe75b66-01c5-4f87-a220-233af3270436",
"principalId": "075a0ca6-43f6-4434-9abf-c9b1b79f9219"
}
}
},
"___location": "westus",
"properties": {
"encryption": {
"infrastructureEncryption": "Enabled",
"kekIdentity": {
"useSystemAssignedIdentity": false,
"userAssignedIdentity": "/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi"
},
"keyVaultProperties": {
"keyUri": "https://cmk2xkv.vault.azure.net/keys/Key1/0767b348bb1a4c07baa6c4ec0055d2b3"
}
},
"provisioningState": "Succeeded",
"publicNetworkAccess": "Enabled"
},
"sku": {
"name": "Standard"
},
"tags": {
"TestUpdatedKey": "TestUpdatedValue"
}
}
Azure-AsyncOperation: /subscriptions/77777777-b0c6-47a2-b37c-d8e65a629c18/resourceGroups/Default-RecoveryServices-ResourceGroup/providers/Microsoft.RecoveryServices/vaults/swaggerExample/operationStatus/YWUzNDFkMzQtZmM5OS00MmUyLWEzNDMtZGJkMDIxZjlmZjgzOzdmYzBiMzhmLTc2NmItNDM5NS05OWQ1LTVmOGEzNzg4MWQzNA==?api-version=2015-03-15
Retry-After: 10
{
"name": "swaggerExample",
"type": "Microsoft.RecoveryServices/vaults",
"etag": "W/\"datetime'2017-12-15T12%3A36%3A51.68Z'\"",
"id": "/subscriptions/77777777-b0c6-47a2-b37c-d8e65a629c18/resourceGroups/Default-RecoveryServices-ResourceGroup/providers/Microsoft.RecoveryServices/vaults/swaggerExample",
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi": {}
}
},
"___location": "westus",
"properties": {
"encryption": {
"infrastructureEncryption": "Enabled",
"kekIdentity": {
"useSystemAssignedIdentity": false,
"userAssignedIdentity": "/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi"
},
"keyVaultProperties": {
"keyUri": "https://cmk2xkv.vault.azure.net/keys/Key1/0767b348bb1a4c07baa6c4ec0055d2b3"
}
},
"provisioningState": "Provisioning",
"publicNetworkAccess": "Enabled"
},
"sku": {
"name": "Standard"
},
"tags": {
"TestUpdatedKey": "TestUpdatedValue"
}
}
Create or Update Vault with CustomerManagedKeys
샘플 요청
PUT https://management.azure.com/subscriptions/77777777-b0c6-47a2-b37c-d8e65a629c18/resourceGroups/Default-RecoveryServices-ResourceGroup/providers/Microsoft.RecoveryServices/vaults/swaggerExample?api-version=2025-02-01
{
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi": {}
}
},
"___location": "West US",
"properties": {
"encryption": {
"infrastructureEncryption": "Enabled",
"kekIdentity": {
"userAssignedIdentity": "/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi"
},
"keyVaultProperties": {
"keyUri": "https://cmk2xkv.vault.azure.net/keys/Key1/0767b348bb1a4c07baa6c4ec0055d2b3"
}
},
"publicNetworkAccess": "Enabled"
},
"sku": {
"name": "Standard"
}
}
import com.azure.resourcemanager.recoveryservices.models.CmkKekIdentity;
import com.azure.resourcemanager.recoveryservices.models.CmkKeyVaultProperties;
import com.azure.resourcemanager.recoveryservices.models.IdentityData;
import com.azure.resourcemanager.recoveryservices.models.InfrastructureEncryptionState;
import com.azure.resourcemanager.recoveryservices.models.PublicNetworkAccess;
import com.azure.resourcemanager.recoveryservices.models.ResourceIdentityType;
import com.azure.resourcemanager.recoveryservices.models.Sku;
import com.azure.resourcemanager.recoveryservices.models.SkuName;
import com.azure.resourcemanager.recoveryservices.models.UserIdentity;
import com.azure.resourcemanager.recoveryservices.models.VaultProperties;
import com.azure.resourcemanager.recoveryservices.models.VaultPropertiesEncryption;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Vaults CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2025-02-01/examples/
* PUTVault_WithCMK.json
*/
/**
* Sample code: Create or Update Vault with CustomerManagedKeys.
*
* @param manager Entry point to RecoveryServicesManager.
*/
public static void createOrUpdateVaultWithCustomerManagedKeys(
com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) {
manager.vaults().define("swaggerExample").withRegion("West US")
.withExistingResourceGroup("Default-RecoveryServices-ResourceGroup")
.withIdentity(new IdentityData().withType(ResourceIdentityType.USER_ASSIGNED)
.withUserAssignedIdentities(mapOf(
"/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi",
new UserIdentity())))
.withProperties(new VaultProperties().withEncryption(new VaultPropertiesEncryption()
.withKeyVaultProperties(new CmkKeyVaultProperties().withKeyUri("fakeTokenPlaceholder"))
.withKekIdentity(new CmkKekIdentity().withUserAssignedIdentity(
"/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi"))
.withInfrastructureEncryption(InfrastructureEncryptionState.ENABLED))
.withPublicNetworkAccess(PublicNetworkAccess.ENABLED))
.withSku(new Sku().withName(SkuName.STANDARD)).create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.recoveryservices import RecoveryServicesClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-recoveryservices
# USAGE
python put_vault_with_cmk.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = RecoveryServicesClient(
credential=DefaultAzureCredential(),
subscription_id="77777777-b0c6-47a2-b37c-d8e65a629c18",
)
response = client.vaults.begin_create_or_update(
resource_group_name="Default-RecoveryServices-ResourceGroup",
vault_name="swaggerExample",
vault={
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi": {}
},
},
"___location": "West US",
"properties": {
"encryption": {
"infrastructureEncryption": "Enabled",
"kekIdentity": {
"userAssignedIdentity": "/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi"
},
"keyVaultProperties": {
"keyUri": "https://cmk2xkv.vault.azure.net/keys/Key1/0767b348bb1a4c07baa6c4ec0055d2b3"
},
},
"publicNetworkAccess": "Enabled",
},
"sku": {"name": "Standard"},
},
).result()
print(response)
# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2025-02-01/examples/PUTVault_WithCMK.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armrecoveryservices_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservices/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/82e9c6f9fbfa2d6d47d5e2a6a11c0ad2eb345c43/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2025-02-01/examples/PUTVault_WithCMK.json
func ExampleVaultsClient_BeginCreateOrUpdate_createOrUpdateVaultWithCustomerManagedKeys() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armrecoveryservices.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewVaultsClient().BeginCreateOrUpdate(ctx, "Default-RecoveryServices-ResourceGroup", "swaggerExample", armrecoveryservices.Vault{
Location: to.Ptr("West US"),
Identity: &armrecoveryservices.IdentityData{
Type: to.Ptr(armrecoveryservices.ResourceIdentityTypeUserAssigned),
UserAssignedIdentities: map[string]*armrecoveryservices.UserIdentity{
"/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi": {},
},
},
Properties: &armrecoveryservices.VaultProperties{
Encryption: &armrecoveryservices.VaultPropertiesEncryption{
InfrastructureEncryption: to.Ptr(armrecoveryservices.InfrastructureEncryptionStateEnabled),
KekIdentity: &armrecoveryservices.CmkKekIdentity{
UserAssignedIdentity: to.Ptr("/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi"),
},
KeyVaultProperties: &armrecoveryservices.CmkKeyVaultProperties{
KeyURI: to.Ptr("https://cmk2xkv.vault.azure.net/keys/Key1/0767b348bb1a4c07baa6c4ec0055d2b3"),
},
},
PublicNetworkAccess: to.Ptr(armrecoveryservices.PublicNetworkAccessEnabled),
},
SKU: &armrecoveryservices.SKU{
Name: to.Ptr(armrecoveryservices.SKUNameStandard),
},
}, &armrecoveryservices.VaultsClientBeginCreateOrUpdateOptions{XMSAuthorizationAuxiliary: nil})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Vault = armrecoveryservices.Vault{
// Name: to.Ptr("swaggerExample"),
// Type: to.Ptr("Microsoft.RecoveryServices/vaults"),
// Etag: to.Ptr("W/\"datetime'2017-12-15T12%3A36%3A51.68Z'\""),
// ID: to.Ptr("/subscriptions/77777777-b0c6-47a2-b37c-d8e65a629c18/resourceGroups/Default-RecoveryServices-ResourceGroup/providers/Microsoft.RecoveryServices/vaults/swaggerExample"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "TestUpdatedKey": to.Ptr("TestUpdatedValue"),
// },
// Identity: &armrecoveryservices.IdentityData{
// Type: to.Ptr(armrecoveryservices.ResourceIdentityTypeUserAssigned),
// UserAssignedIdentities: map[string]*armrecoveryservices.UserIdentity{
// "/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi": &armrecoveryservices.UserIdentity{
// ClientID: to.Ptr("fbe75b66-01c5-4f87-a220-233af3270436"),
// PrincipalID: to.Ptr("075a0ca6-43f6-4434-9abf-c9b1b79f9219"),
// },
// },
// },
// Properties: &armrecoveryservices.VaultProperties{
// Encryption: &armrecoveryservices.VaultPropertiesEncryption{
// InfrastructureEncryption: to.Ptr(armrecoveryservices.InfrastructureEncryptionStateEnabled),
// KekIdentity: &armrecoveryservices.CmkKekIdentity{
// UseSystemAssignedIdentity: to.Ptr(false),
// UserAssignedIdentity: to.Ptr("/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi"),
// },
// KeyVaultProperties: &armrecoveryservices.CmkKeyVaultProperties{
// KeyURI: to.Ptr("https://cmk2xkv.vault.azure.net/keys/Key1/0767b348bb1a4c07baa6c4ec0055d2b3"),
// },
// },
// ProvisioningState: to.Ptr("Succeeded"),
// PublicNetworkAccess: to.Ptr(armrecoveryservices.PublicNetworkAccessEnabled),
// },
// SKU: &armrecoveryservices.SKU{
// Name: to.Ptr(armrecoveryservices.SKUNameStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { RecoveryServicesClient } = require("@azure/arm-recoveryservices");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Creates or updates a Recovery Services vault.
*
* @summary Creates or updates a Recovery Services vault.
* x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2025-02-01/examples/PUTVault_WithCMK.json
*/
async function createOrUpdateVaultWithCustomerManagedKeys() {
const subscriptionId =
process.env["RECOVERYSERVICES_SUBSCRIPTION_ID"] || "77777777-b0c6-47a2-b37c-d8e65a629c18";
const resourceGroupName =
process.env["RECOVERYSERVICES_RESOURCE_GROUP"] || "Default-RecoveryServices-ResourceGroup";
const vaultName = "swaggerExample";
const vault = {
identity: {
type: "UserAssigned",
userAssignedIdentities: {
"/subscriptions/85bf5e8c30844f42Add2746ebb7e97b2/resourcegroups/defaultrg/providers/MicrosoftManagedIdentity/userAssignedIdentities/examplemsi":
{},
},
},
___location: "West US",
properties: {
encryption: {
infrastructureEncryption: "Enabled",
kekIdentity: {
userAssignedIdentity:
"/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi",
},
keyVaultProperties: {
keyUri: "https://cmk2xkv.vault.azure.net/keys/Key1/0767b348bb1a4c07baa6c4ec0055d2b3",
},
},
publicNetworkAccess: "Enabled",
},
sku: { name: "Standard" },
};
const credential = new DefaultAzureCredential();
const client = new RecoveryServicesClient(credential, subscriptionId);
const result = await client.vaults.beginCreateOrUpdateAndWait(
resourceGroupName,
vaultName,
vault,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
샘플 응답
{
"name": "swaggerExample",
"type": "Microsoft.RecoveryServices/vaults",
"etag": "W/\"datetime'2017-12-15T12%3A36%3A51.68Z'\"",
"id": "/subscriptions/77777777-b0c6-47a2-b37c-d8e65a629c18/resourceGroups/Default-RecoveryServices-ResourceGroup/providers/Microsoft.RecoveryServices/vaults/swaggerExample",
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi": {
"clientId": "fbe75b66-01c5-4f87-a220-233af3270436",
"principalId": "075a0ca6-43f6-4434-9abf-c9b1b79f9219"
}
}
},
"___location": "westus",
"properties": {
"encryption": {
"infrastructureEncryption": "Enabled",
"kekIdentity": {
"useSystemAssignedIdentity": false,
"userAssignedIdentity": "/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi"
},
"keyVaultProperties": {
"keyUri": "https://cmk2xkv.vault.azure.net/keys/Key1/0767b348bb1a4c07baa6c4ec0055d2b3"
}
},
"provisioningState": "Succeeded",
"publicNetworkAccess": "Enabled"
},
"sku": {
"name": "Standard"
},
"tags": {
"TestUpdatedKey": "TestUpdatedValue"
}
}
Azure-AsyncOperation: /subscriptions/77777777-b0c6-47a2-b37c-d8e65a629c18/resourceGroups/Default-RecoveryServices-ResourceGroup/providers/Microsoft.RecoveryServices/vaults/swaggerExample/operationStatus/YWUzNDFkMzQtZmM5OS00MmUyLWEzNDMtZGJkMDIxZjlmZjgzOzdmYzBiMzhmLTc2NmItNDM5NS05OWQ1LTVmOGEzNzg4MWQzNA==?api-version=2015-03-15
Retry-After: 10
{
"name": "swaggerExample",
"type": "Microsoft.RecoveryServices/vaults",
"etag": "W/\"datetime'2017-12-15T12%3A36%3A51.68Z'\"",
"id": "/subscriptions/77777777-b0c6-47a2-b37c-d8e65a629c18/resourceGroups/Default-RecoveryServices-ResourceGroup/providers/Microsoft.RecoveryServices/vaults/swaggerExample",
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi": {}
}
},
"___location": "westus",
"properties": {
"encryption": {
"infrastructureEncryption": "Enabled",
"kekIdentity": {
"useSystemAssignedIdentity": false,
"userAssignedIdentity": "/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi"
},
"keyVaultProperties": {
"keyUri": "https://cmk2xkv.vault.azure.net/keys/Key1/0767b348bb1a4c07baa6c4ec0055d2b3"
}
},
"provisioningState": "Provisioning",
"publicNetworkAccess": "Enabled"
},
"sku": {
"name": "Standard"
},
"tags": {
"TestUpdatedKey": "TestUpdatedValue"
}
}
Create or Update Vault With Monitoring Setting
샘플 요청
PUT https://management.azure.com/subscriptions/77777777-b0c6-47a2-b37c-d8e65a629c18/resourceGroups/Default-RecoveryServices-ResourceGroup/providers/Microsoft.RecoveryServices/vaults/swaggerExample?api-version=2025-02-01
{
"identity": {
"type": "SystemAssigned"
},
"___location": "West US",
"properties": {
"monitoringSettings": {
"azureMonitorAlertSettings": {
"alertsForAllFailoverIssues": "Disabled",
"alertsForAllJobFailures": "Enabled",
"alertsForAllReplicationIssues": "Enabled"
},
"classicAlertSettings": {
"alertsForCriticalOperations": "Disabled",
"emailNotificationsForSiteRecovery": "Enabled"
}
},
"publicNetworkAccess": "Enabled"
},
"sku": {
"name": "Standard"
}
}
import com.azure.resourcemanager.recoveryservices.models.AlertsState;
import com.azure.resourcemanager.recoveryservices.models.AzureMonitorAlertSettings;
import com.azure.resourcemanager.recoveryservices.models.ClassicAlertSettings;
import com.azure.resourcemanager.recoveryservices.models.IdentityData;
import com.azure.resourcemanager.recoveryservices.models.MonitoringSettings;
import com.azure.resourcemanager.recoveryservices.models.PublicNetworkAccess;
import com.azure.resourcemanager.recoveryservices.models.ResourceIdentityType;
import com.azure.resourcemanager.recoveryservices.models.Sku;
import com.azure.resourcemanager.recoveryservices.models.SkuName;
import com.azure.resourcemanager.recoveryservices.models.VaultProperties;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Vaults CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2025-02-01/examples/
* PUTVault_WithMonitoringSettings.json
*/
/**
* Sample code: Create or Update Vault With Monitoring Setting.
*
* @param manager Entry point to RecoveryServicesManager.
*/
public static void createOrUpdateVaultWithMonitoringSetting(
com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) {
manager.vaults().define("swaggerExample").withRegion("West US")
.withExistingResourceGroup("Default-RecoveryServices-ResourceGroup")
.withIdentity(
new IdentityData().withType(ResourceIdentityType.SYSTEM_ASSIGNED))
.withProperties(
new VaultProperties()
.withPublicNetworkAccess(
PublicNetworkAccess.ENABLED)
.withMonitoringSettings(new MonitoringSettings().withAzureMonitorAlertSettings(
new AzureMonitorAlertSettings().withAlertsForAllJobFailures(AlertsState.ENABLED)
.withAlertsForAllReplicationIssues(AlertsState.ENABLED)
.withAlertsForAllFailoverIssues(AlertsState.DISABLED))
.withClassicAlertSettings(
new ClassicAlertSettings().withAlertsForCriticalOperations(AlertsState.DISABLED)
.withEmailNotificationsForSiteRecovery(AlertsState.ENABLED))))
.withSku(new Sku().withName(SkuName.STANDARD)).create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.recoveryservices import RecoveryServicesClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-recoveryservices
# USAGE
python put_vault_with_monitoring_settings.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = RecoveryServicesClient(
credential=DefaultAzureCredential(),
subscription_id="77777777-b0c6-47a2-b37c-d8e65a629c18",
)
response = client.vaults.begin_create_or_update(
resource_group_name="Default-RecoveryServices-ResourceGroup",
vault_name="swaggerExample",
vault={
"identity": {"type": "SystemAssigned"},
"___location": "West US",
"properties": {
"monitoringSettings": {
"azureMonitorAlertSettings": {
"alertsForAllFailoverIssues": "Disabled",
"alertsForAllJobFailures": "Enabled",
"alertsForAllReplicationIssues": "Enabled",
},
"classicAlertSettings": {
"alertsForCriticalOperations": "Disabled",
"emailNotificationsForSiteRecovery": "Enabled",
},
},
"publicNetworkAccess": "Enabled",
},
"sku": {"name": "Standard"},
},
).result()
print(response)
# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2025-02-01/examples/PUTVault_WithMonitoringSettings.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armrecoveryservices_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservices/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/82e9c6f9fbfa2d6d47d5e2a6a11c0ad2eb345c43/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2025-02-01/examples/PUTVault_WithMonitoringSettings.json
func ExampleVaultsClient_BeginCreateOrUpdate_createOrUpdateVaultWithMonitoringSetting() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armrecoveryservices.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewVaultsClient().BeginCreateOrUpdate(ctx, "Default-RecoveryServices-ResourceGroup", "swaggerExample", armrecoveryservices.Vault{
Location: to.Ptr("West US"),
Identity: &armrecoveryservices.IdentityData{
Type: to.Ptr(armrecoveryservices.ResourceIdentityTypeSystemAssigned),
},
Properties: &armrecoveryservices.VaultProperties{
MonitoringSettings: &armrecoveryservices.MonitoringSettings{
AzureMonitorAlertSettings: &armrecoveryservices.AzureMonitorAlertSettings{
AlertsForAllFailoverIssues: to.Ptr(armrecoveryservices.AlertsStateDisabled),
AlertsForAllJobFailures: to.Ptr(armrecoveryservices.AlertsStateEnabled),
AlertsForAllReplicationIssues: to.Ptr(armrecoveryservices.AlertsStateEnabled),
},
ClassicAlertSettings: &armrecoveryservices.ClassicAlertSettings{
AlertsForCriticalOperations: to.Ptr(armrecoveryservices.AlertsStateDisabled),
EmailNotificationsForSiteRecovery: to.Ptr(armrecoveryservices.AlertsStateEnabled),
},
},
PublicNetworkAccess: to.Ptr(armrecoveryservices.PublicNetworkAccessEnabled),
},
SKU: &armrecoveryservices.SKU{
Name: to.Ptr(armrecoveryservices.SKUNameStandard),
},
}, &armrecoveryservices.VaultsClientBeginCreateOrUpdateOptions{XMSAuthorizationAuxiliary: nil})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Vault = armrecoveryservices.Vault{
// Name: to.Ptr("swaggerExample"),
// Type: to.Ptr("Microsoft.RecoveryServices/vaults"),
// Etag: to.Ptr("W/\"datetime'2017-12-15T12%3A36%3A51.68Z'\""),
// ID: to.Ptr("/subscriptions/77777777-b0c6-47a2-b37c-d8e65a629c18/resourceGroups/Default-RecoveryServices-ResourceGroup/providers/Microsoft.RecoveryServices/vaults/swaggerExample"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "TestUpdatedKey": to.Ptr("TestUpdatedValue"),
// },
// Identity: &armrecoveryservices.IdentityData{
// Type: to.Ptr(armrecoveryservices.ResourceIdentityTypeSystemAssigned),
// PrincipalID: to.Ptr("3137d6c7-5d6c-411c-b934-7a2a729ee247"),
// TenantID: to.Ptr("d676e86e-2206-4a7c-999c-ece52c144b5b"),
// },
// Properties: &armrecoveryservices.VaultProperties{
// MonitoringSettings: &armrecoveryservices.MonitoringSettings{
// AzureMonitorAlertSettings: &armrecoveryservices.AzureMonitorAlertSettings{
// AlertsForAllFailoverIssues: to.Ptr(armrecoveryservices.AlertsStateDisabled),
// AlertsForAllJobFailures: to.Ptr(armrecoveryservices.AlertsStateEnabled),
// AlertsForAllReplicationIssues: to.Ptr(armrecoveryservices.AlertsStateEnabled),
// },
// ClassicAlertSettings: &armrecoveryservices.ClassicAlertSettings{
// AlertsForCriticalOperations: to.Ptr(armrecoveryservices.AlertsStateDisabled),
// EmailNotificationsForSiteRecovery: to.Ptr(armrecoveryservices.AlertsStateEnabled),
// },
// },
// ProvisioningState: to.Ptr("Succeeded"),
// PublicNetworkAccess: to.Ptr(armrecoveryservices.PublicNetworkAccessEnabled),
// },
// SKU: &armrecoveryservices.SKU{
// Name: to.Ptr(armrecoveryservices.SKUNameRS0),
// Tier: to.Ptr("Standard"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { RecoveryServicesClient } = require("@azure/arm-recoveryservices");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Creates or updates a Recovery Services vault.
*
* @summary Creates or updates a Recovery Services vault.
* x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2025-02-01/examples/PUTVault_WithMonitoringSettings.json
*/
async function createOrUpdateVaultWithMonitoringSetting() {
const subscriptionId =
process.env["RECOVERYSERVICES_SUBSCRIPTION_ID"] || "77777777-b0c6-47a2-b37c-d8e65a629c18";
const resourceGroupName =
process.env["RECOVERYSERVICES_RESOURCE_GROUP"] || "Default-RecoveryServices-ResourceGroup";
const vaultName = "swaggerExample";
const vault = {
identity: { type: "SystemAssigned" },
___location: "West US",
properties: {
monitoringSettings: {
azureMonitorAlertSettings: {
alertsForAllFailoverIssues: "Disabled",
alertsForAllJobFailures: "Enabled",
alertsForAllReplicationIssues: "Enabled",
},
classicAlertSettings: {
alertsForCriticalOperations: "Disabled",
emailNotificationsForSiteRecovery: "Enabled",
},
},
publicNetworkAccess: "Enabled",
},
sku: { name: "Standard" },
};
const credential = new DefaultAzureCredential();
const client = new RecoveryServicesClient(credential, subscriptionId);
const result = await client.vaults.beginCreateOrUpdateAndWait(
resourceGroupName,
vaultName,
vault,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
샘플 응답
{
"name": "swaggerExample",
"type": "Microsoft.RecoveryServices/vaults",
"etag": "W/\"datetime'2017-12-15T12%3A36%3A51.68Z'\"",
"id": "/subscriptions/77777777-b0c6-47a2-b37c-d8e65a629c18/resourceGroups/Default-RecoveryServices-ResourceGroup/providers/Microsoft.RecoveryServices/vaults/swaggerExample",
"identity": {
"type": "SystemAssigned",
"principalId": "3137d6c7-5d6c-411c-b934-7a2a729ee247",
"tenantId": "d676e86e-2206-4a7c-999c-ece52c144b5b"
},
"___location": "westus",
"properties": {
"monitoringSettings": {
"azureMonitorAlertSettings": {
"alertsForAllFailoverIssues": "Disabled",
"alertsForAllJobFailures": "Enabled",
"alertsForAllReplicationIssues": "Enabled"
},
"classicAlertSettings": {
"alertsForCriticalOperations": "Disabled",
"emailNotificationsForSiteRecovery": "Enabled"
}
},
"provisioningState": "Succeeded",
"publicNetworkAccess": "Enabled"
},
"sku": {
"name": "RS0",
"tier": "Standard"
},
"tags": {
"TestUpdatedKey": "TestUpdatedValue"
}
}
{
"name": "swaggerExample",
"type": "Microsoft.RecoveryServices/vaults",
"etag": "W/\"datetime'2017-12-15T12%3A36%3A51.68Z'\"",
"id": "/subscriptions/77777777-b0c6-47a2-b37c-d8e65a629c18/resourceGroups/Default-RecoveryServices-ResourceGroup/providers/Microsoft.RecoveryServices/vaults/swaggerExample",
"identity": {
"type": "SystemAssigned",
"principalId": "3137d6c7-5d6c-411c-b934-7a2a729ee247",
"tenantId": "d676e86e-2206-4a7c-999c-ece52c144b5b"
},
"___location": "westus",
"properties": {
"monitoringSettings": {
"azureMonitorAlertSettings": {
"alertsForAllFailoverIssues": "Disabled",
"alertsForAllJobFailures": "Enabled",
"alertsForAllReplicationIssues": "Enabled"
},
"classicAlertSettings": {
"alertsForCriticalOperations": "Disabled",
"emailNotificationsForSiteRecovery": "Enabled"
}
},
"provisioningState": "Succeeded",
"publicNetworkAccess": "Enabled"
},
"sku": {
"name": "RS0",
"tier": "Standard"
},
"tags": {
"TestUpdatedKey": "TestUpdatedValue"
}
}
Create or Update Vault With Redundancy Setting
샘플 요청
PUT https://management.azure.com/subscriptions/77777777-b0c6-47a2-b37c-d8e65a629c18/resourceGroups/Default-RecoveryServices-ResourceGroup/providers/Microsoft.RecoveryServices/vaults/swaggerExample?api-version=2025-02-01
{
"identity": {
"type": "SystemAssigned"
},
"___location": "West US",
"properties": {
"publicNetworkAccess": "Enabled",
"redundancySettings": {
"crossRegionRestore": "Enabled",
"standardTierStorageRedundancy": "GeoRedundant"
}
},
"sku": {
"name": "Standard"
}
}
import com.azure.resourcemanager.recoveryservices.models.CrossRegionRestore;
import com.azure.resourcemanager.recoveryservices.models.IdentityData;
import com.azure.resourcemanager.recoveryservices.models.PublicNetworkAccess;
import com.azure.resourcemanager.recoveryservices.models.ResourceIdentityType;
import com.azure.resourcemanager.recoveryservices.models.Sku;
import com.azure.resourcemanager.recoveryservices.models.SkuName;
import com.azure.resourcemanager.recoveryservices.models.StandardTierStorageRedundancy;
import com.azure.resourcemanager.recoveryservices.models.VaultProperties;
import com.azure.resourcemanager.recoveryservices.models.VaultPropertiesRedundancySettings;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Vaults CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2025-02-01/examples/
* PUTVault_WithRedundancySettings.json
*/
/**
* Sample code: Create or Update Vault With Redundancy Setting.
*
* @param manager Entry point to RecoveryServicesManager.
*/
public static void createOrUpdateVaultWithRedundancySetting(
com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) {
manager.vaults().define("swaggerExample").withRegion("West US")
.withExistingResourceGroup("Default-RecoveryServices-ResourceGroup")
.withIdentity(new IdentityData().withType(ResourceIdentityType.SYSTEM_ASSIGNED))
.withProperties(new VaultProperties().withPublicNetworkAccess(PublicNetworkAccess.ENABLED)
.withRedundancySettings(new VaultPropertiesRedundancySettings()
.withStandardTierStorageRedundancy(StandardTierStorageRedundancy.GEO_REDUNDANT)
.withCrossRegionRestore(CrossRegionRestore.ENABLED)))
.withSku(new Sku().withName(SkuName.STANDARD)).create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.recoveryservices import RecoveryServicesClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-recoveryservices
# USAGE
python put_vault_with_redundancy_settings.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = RecoveryServicesClient(
credential=DefaultAzureCredential(),
subscription_id="77777777-b0c6-47a2-b37c-d8e65a629c18",
)
response = client.vaults.begin_create_or_update(
resource_group_name="Default-RecoveryServices-ResourceGroup",
vault_name="swaggerExample",
vault={
"identity": {"type": "SystemAssigned"},
"___location": "West US",
"properties": {
"publicNetworkAccess": "Enabled",
"redundancySettings": {
"crossRegionRestore": "Enabled",
"standardTierStorageRedundancy": "GeoRedundant",
},
},
"sku": {"name": "Standard"},
},
).result()
print(response)
# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2025-02-01/examples/PUTVault_WithRedundancySettings.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armrecoveryservices_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservices/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/82e9c6f9fbfa2d6d47d5e2a6a11c0ad2eb345c43/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2025-02-01/examples/PUTVault_WithRedundancySettings.json
func ExampleVaultsClient_BeginCreateOrUpdate_createOrUpdateVaultWithRedundancySetting() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armrecoveryservices.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewVaultsClient().BeginCreateOrUpdate(ctx, "Default-RecoveryServices-ResourceGroup", "swaggerExample", armrecoveryservices.Vault{
Location: to.Ptr("West US"),
Identity: &armrecoveryservices.IdentityData{
Type: to.Ptr(armrecoveryservices.ResourceIdentityTypeSystemAssigned),
},
Properties: &armrecoveryservices.VaultProperties{
PublicNetworkAccess: to.Ptr(armrecoveryservices.PublicNetworkAccessEnabled),
RedundancySettings: &armrecoveryservices.VaultPropertiesRedundancySettings{
CrossRegionRestore: to.Ptr(armrecoveryservices.CrossRegionRestoreEnabled),
StandardTierStorageRedundancy: to.Ptr(armrecoveryservices.StandardTierStorageRedundancyGeoRedundant),
},
},
SKU: &armrecoveryservices.SKU{
Name: to.Ptr(armrecoveryservices.SKUNameStandard),
},
}, &armrecoveryservices.VaultsClientBeginCreateOrUpdateOptions{XMSAuthorizationAuxiliary: nil})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Vault = armrecoveryservices.Vault{
// Name: to.Ptr("swaggerExample"),
// Type: to.Ptr("Microsoft.RecoveryServices/vaults"),
// Etag: to.Ptr("W/\"datetime'2017-12-15T12%3A36%3A51.68Z'\""),
// ID: to.Ptr("/subscriptions/77777777-b0c6-47a2-b37c-d8e65a629c18/resourceGroups/Default-RecoveryServices-ResourceGroup/providers/Microsoft.RecoveryServices/vaults/swaggerExample"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "TestUpdatedKey": to.Ptr("TestUpdatedValue"),
// },
// Identity: &armrecoveryservices.IdentityData{
// Type: to.Ptr(armrecoveryservices.ResourceIdentityTypeSystemAssigned),
// PrincipalID: to.Ptr("3137d6c7-5d6c-411c-b934-7a2a729ee247"),
// TenantID: to.Ptr("d676e86e-2206-4a7c-999c-ece52c144b5b"),
// },
// Properties: &armrecoveryservices.VaultProperties{
// ProvisioningState: to.Ptr("Succeeded"),
// PublicNetworkAccess: to.Ptr(armrecoveryservices.PublicNetworkAccessEnabled),
// RedundancySettings: &armrecoveryservices.VaultPropertiesRedundancySettings{
// CrossRegionRestore: to.Ptr(armrecoveryservices.CrossRegionRestoreEnabled),
// StandardTierStorageRedundancy: to.Ptr(armrecoveryservices.StandardTierStorageRedundancyGeoRedundant),
// },
// },
// SKU: &armrecoveryservices.SKU{
// Name: to.Ptr(armrecoveryservices.SKUNameRS0),
// Tier: to.Ptr("Standard"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { RecoveryServicesClient } = require("@azure/arm-recoveryservices");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Creates or updates a Recovery Services vault.
*
* @summary Creates or updates a Recovery Services vault.
* x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2025-02-01/examples/PUTVault_WithRedundancySettings.json
*/
async function createOrUpdateVaultWithRedundancySetting() {
const subscriptionId =
process.env["RECOVERYSERVICES_SUBSCRIPTION_ID"] || "77777777-b0c6-47a2-b37c-d8e65a629c18";
const resourceGroupName =
process.env["RECOVERYSERVICES_RESOURCE_GROUP"] || "Default-RecoveryServices-ResourceGroup";
const vaultName = "swaggerExample";
const vault = {
identity: { type: "SystemAssigned" },
___location: "West US",
properties: {
publicNetworkAccess: "Enabled",
redundancySettings: {
crossRegionRestore: "Enabled",
standardTierStorageRedundancy: "GeoRedundant",
},
},
sku: { name: "Standard" },
};
const credential = new DefaultAzureCredential();
const client = new RecoveryServicesClient(credential, subscriptionId);
const result = await client.vaults.beginCreateOrUpdateAndWait(
resourceGroupName,
vaultName,
vault,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
샘플 응답
{
"name": "swaggerExample",
"type": "Microsoft.RecoveryServices/vaults",
"etag": "W/\"datetime'2017-12-15T12%3A36%3A51.68Z'\"",
"id": "/subscriptions/77777777-b0c6-47a2-b37c-d8e65a629c18/resourceGroups/Default-RecoveryServices-ResourceGroup/providers/Microsoft.RecoveryServices/vaults/swaggerExample",
"identity": {
"type": "SystemAssigned",
"principalId": "3137d6c7-5d6c-411c-b934-7a2a729ee247",
"tenantId": "d676e86e-2206-4a7c-999c-ece52c144b5b"
},
"___location": "westus",
"properties": {
"provisioningState": "Succeeded",
"publicNetworkAccess": "Enabled",
"redundancySettings": {
"crossRegionRestore": "Enabled",
"standardTierStorageRedundancy": "GeoRedundant"
}
},
"sku": {
"name": "RS0",
"tier": "Standard"
},
"tags": {
"TestUpdatedKey": "TestUpdatedValue"
}
}
{
"name": "swaggerExample",
"type": "Microsoft.RecoveryServices/vaults",
"etag": "W/\"datetime'2017-12-15T12%3A36%3A51.68Z'\"",
"id": "/subscriptions/77777777-b0c6-47a2-b37c-d8e65a629c18/resourceGroups/Default-RecoveryServices-ResourceGroup/providers/Microsoft.RecoveryServices/vaults/swaggerExample",
"identity": {
"type": "SystemAssigned",
"principalId": "3137d6c7-5d6c-411c-b934-7a2a729ee247",
"tenantId": "d676e86e-2206-4a7c-999c-ece52c144b5b"
},
"___location": "westus",
"properties": {
"provisioningState": "Succeeded",
"publicNetworkAccess": "Enabled",
"redundancySettings": {
"crossRegionRestore": "Enabled",
"standardTierStorageRedundancy": "GeoRedundant"
}
},
"sku": {
"name": "RS0",
"tier": "Standard"
},
"tags": {
"TestUpdatedKey": "TestUpdatedValue"
}
}
Create or Update Vault with Source scan configuration
샘플 요청
PUT https://management.azure.com/subscriptions/77777777-b0c6-47a2-b37c-d8e65a629c18/resourceGroups/Default-RecoveryServices-ResourceGroup/providers/Microsoft.RecoveryServices/vaults/swaggerExample?api-version=2025-02-01
{
"identity": {
"type": "SystemAssigned"
},
"___location": "West US",
"properties": {
"publicNetworkAccess": "Enabled",
"securitySettings": {
"sourceScanConfiguration": {
"sourceScanIdentity": {
"operationIdentityType": "SystemAssigned"
},
"state": "Enabled"
}
}
},
"sku": {
"name": "Standard"
}
}
import com.azure.resourcemanager.recoveryservices.models.AssociatedIdentity;
import com.azure.resourcemanager.recoveryservices.models.IdentityData;
import com.azure.resourcemanager.recoveryservices.models.IdentityType;
import com.azure.resourcemanager.recoveryservices.models.PublicNetworkAccess;
import com.azure.resourcemanager.recoveryservices.models.ResourceIdentityType;
import com.azure.resourcemanager.recoveryservices.models.SecuritySettings;
import com.azure.resourcemanager.recoveryservices.models.Sku;
import com.azure.resourcemanager.recoveryservices.models.SkuName;
import com.azure.resourcemanager.recoveryservices.models.SourceScanConfiguration;
import com.azure.resourcemanager.recoveryservices.models.State;
import com.azure.resourcemanager.recoveryservices.models.VaultProperties;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Vaults CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2025-02-01/examples/
* PUTVault_WithSourceScanConfiguration.json
*/
/**
* Sample code: Create or Update Vault with Source scan configuration.
*
* @param manager Entry point to RecoveryServicesManager.
*/
public static void createOrUpdateVaultWithSourceScanConfiguration(
com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) {
manager.vaults().define("swaggerExample").withRegion("West US")
.withExistingResourceGroup("Default-RecoveryServices-ResourceGroup")
.withIdentity(new IdentityData().withType(ResourceIdentityType.SYSTEM_ASSIGNED))
.withProperties(new VaultProperties().withPublicNetworkAccess(PublicNetworkAccess.ENABLED)
.withSecuritySettings(new SecuritySettings().withSourceScanConfiguration(
new SourceScanConfiguration().withState(State.ENABLED).withSourceScanIdentity(
new AssociatedIdentity().withOperationIdentityType(IdentityType.SYSTEM_ASSIGNED)))))
.withSku(new Sku().withName(SkuName.STANDARD)).create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.recoveryservices import RecoveryServicesClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-recoveryservices
# USAGE
python put_vault_with_source_scan_configuration.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = RecoveryServicesClient(
credential=DefaultAzureCredential(),
subscription_id="77777777-b0c6-47a2-b37c-d8e65a629c18",
)
response = client.vaults.begin_create_or_update(
resource_group_name="Default-RecoveryServices-ResourceGroup",
vault_name="swaggerExample",
vault={
"identity": {"type": "SystemAssigned"},
"___location": "West US",
"properties": {
"publicNetworkAccess": "Enabled",
"securitySettings": {
"sourceScanConfiguration": {
"sourceScanIdentity": {"operationIdentityType": "SystemAssigned"},
"state": "Enabled",
}
},
},
"sku": {"name": "Standard"},
},
).result()
print(response)
# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2025-02-01/examples/PUTVault_WithSourceScanConfiguration.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armrecoveryservices_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservices/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/82e9c6f9fbfa2d6d47d5e2a6a11c0ad2eb345c43/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2025-02-01/examples/PUTVault_WithSourceScanConfiguration.json
func ExampleVaultsClient_BeginCreateOrUpdate_createOrUpdateVaultWithSourceScanConfiguration() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armrecoveryservices.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewVaultsClient().BeginCreateOrUpdate(ctx, "Default-RecoveryServices-ResourceGroup", "swaggerExample", armrecoveryservices.Vault{
Location: to.Ptr("West US"),
Identity: &armrecoveryservices.IdentityData{
Type: to.Ptr(armrecoveryservices.ResourceIdentityTypeSystemAssigned),
},
Properties: &armrecoveryservices.VaultProperties{
PublicNetworkAccess: to.Ptr(armrecoveryservices.PublicNetworkAccessEnabled),
SecuritySettings: &armrecoveryservices.SecuritySettings{
SourceScanConfiguration: &armrecoveryservices.SourceScanConfiguration{
SourceScanIdentity: &armrecoveryservices.AssociatedIdentity{
OperationIdentityType: to.Ptr(armrecoveryservices.IdentityTypeSystemAssigned),
},
State: to.Ptr(armrecoveryservices.StateEnabled),
},
},
},
SKU: &armrecoveryservices.SKU{
Name: to.Ptr(armrecoveryservices.SKUNameStandard),
},
}, &armrecoveryservices.VaultsClientBeginCreateOrUpdateOptions{XMSAuthorizationAuxiliary: nil})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Vault = armrecoveryservices.Vault{
// Name: to.Ptr("swaggerExample"),
// Type: to.Ptr("Microsoft.RecoveryServices/vaults"),
// Etag: to.Ptr("W/\"datetime'2025-02-15T12%3A36%3A51.68Z'\""),
// ID: to.Ptr("/subscriptions/77777777-b0c6-47a2-b37c-d8e65a629c18/resourceGroups/Default-RecoveryServices-ResourceGroup/providers/Microsoft.RecoveryServices/vaults/swaggerExample"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "TestUpdatedKey": to.Ptr("TestUpdatedValue"),
// },
// Identity: &armrecoveryservices.IdentityData{
// Type: to.Ptr(armrecoveryservices.ResourceIdentityTypeSystemAssigned),
// PrincipalID: to.Ptr("1be097b0-eb5e-4927-bac2-b24ee8716f64"),
// TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"),
// },
// Properties: &armrecoveryservices.VaultProperties{
// ProvisioningState: to.Ptr("Succeeded"),
// PublicNetworkAccess: to.Ptr(armrecoveryservices.PublicNetworkAccessEnabled),
// SecuritySettings: &armrecoveryservices.SecuritySettings{
// SourceScanConfiguration: &armrecoveryservices.SourceScanConfiguration{
// SourceScanIdentity: &armrecoveryservices.AssociatedIdentity{
// OperationIdentityType: to.Ptr(armrecoveryservices.IdentityTypeSystemAssigned),
// },
// State: to.Ptr(armrecoveryservices.StateEnabled),
// },
// },
// },
// SKU: &armrecoveryservices.SKU{
// Name: to.Ptr(armrecoveryservices.SKUNameStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { RecoveryServicesClient } = require("@azure/arm-recoveryservices");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Creates or updates a Recovery Services vault.
*
* @summary Creates or updates a Recovery Services vault.
* x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2025-02-01/examples/PUTVault_WithSourceScanConfiguration.json
*/
async function createOrUpdateVaultWithSourceScanConfiguration() {
const subscriptionId =
process.env["RECOVERYSERVICES_SUBSCRIPTION_ID"] || "77777777-b0c6-47a2-b37c-d8e65a629c18";
const resourceGroupName =
process.env["RECOVERYSERVICES_RESOURCE_GROUP"] || "Default-RecoveryServices-ResourceGroup";
const vaultName = "swaggerExample";
const vault = {
identity: { type: "SystemAssigned" },
___location: "West US",
properties: {
publicNetworkAccess: "Enabled",
securitySettings: {
sourceScanConfiguration: {
sourceScanIdentity: { operationIdentityType: "SystemAssigned" },
state: "Enabled",
},
},
},
sku: { name: "Standard" },
};
const credential = new DefaultAzureCredential();
const client = new RecoveryServicesClient(credential, subscriptionId);
const result = await client.vaults.beginCreateOrUpdateAndWait(
resourceGroupName,
vaultName,
vault,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
샘플 응답
{
"name": "swaggerExample",
"type": "Microsoft.RecoveryServices/vaults",
"etag": "W/\"datetime'2025-02-15T12%3A36%3A51.68Z'\"",
"id": "/subscriptions/77777777-b0c6-47a2-b37c-d8e65a629c18/resourceGroups/Default-RecoveryServices-ResourceGroup/providers/Microsoft.RecoveryServices/vaults/swaggerExample",
"identity": {
"type": "SystemAssigned",
"principalId": "1be097b0-eb5e-4927-bac2-b24ee8716f64",
"tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47"
},
"___location": "westus",
"properties": {
"provisioningState": "Succeeded",
"publicNetworkAccess": "Enabled",
"securitySettings": {
"sourceScanConfiguration": {
"sourceScanIdentity": {
"operationIdentityType": "SystemAssigned"
},
"state": "Enabled"
}
}
},
"sku": {
"name": "Standard"
},
"tags": {
"TestUpdatedKey": "TestUpdatedValue"
}
}
Azure-AsyncOperation: /subscriptions/77777777-b0c6-47a2-b37c-d8e65a629c18/resourceGroups/Default-RecoveryServices-ResourceGroup/providers/Microsoft.RecoveryServices/vaults/swaggerExample/operationStatus/YWUzNDFkMzQtZmM5OS00MmUyLWEzNDMtZGJkMDIxZjlmZjgzOzdmYzBiMzhmLTc2NmItNDM5NS05OWQ1LTVmOGEzNzg4MWQzNA==?api-version=2015-03-15
Retry-After: 10
{
"name": "swaggerExample",
"type": "Microsoft.RecoveryServices/vaults",
"etag": "W/\"datetime'2017-12-15T12%3A36%3A51.68Z'\"",
"id": "/subscriptions/77777777-b0c6-47a2-b37c-d8e65a629c18/resourceGroups/Default-RecoveryServices-ResourceGroup/providers/Microsoft.RecoveryServices/vaults/swaggerExample",
"identity": {
"type": "SystemAssigned",
"principalId": "1be097b0-eb5e-4927-bac2-b24ee8716f64",
"tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47"
},
"___location": "westus",
"properties": {
"provisioningState": "Provisioning",
"publicNetworkAccess": "Enabled",
"securitySettings": {
"sourceScanConfiguration": {
"sourceScanIdentity": {
"operationIdentityType": "SystemAssigned"
},
"state": "Enabled"
}
}
},
"sku": {
"name": "Standard"
},
"tags": {
"TestUpdatedKey": "TestUpdatedValue"
}
}
Create or Update Vault with User Assigned Identity
샘플 요청
PUT https://management.azure.com/subscriptions/77777777-b0c6-47a2-b37c-d8e65a629c18/resourceGroups/Default-RecoveryServices-ResourceGroup/providers/Microsoft.RecoveryServices/vaults/swaggerExample?api-version=2025-02-01
{
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi": {}
}
},
"___location": "West US",
"properties": {
"publicNetworkAccess": "Enabled"
},
"sku": {
"name": "Standard"
}
}
import com.azure.resourcemanager.recoveryservices.models.IdentityData;
import com.azure.resourcemanager.recoveryservices.models.PublicNetworkAccess;
import com.azure.resourcemanager.recoveryservices.models.ResourceIdentityType;
import com.azure.resourcemanager.recoveryservices.models.Sku;
import com.azure.resourcemanager.recoveryservices.models.SkuName;
import com.azure.resourcemanager.recoveryservices.models.UserIdentity;
import com.azure.resourcemanager.recoveryservices.models.VaultProperties;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Vaults CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2025-02-01/examples/
* PUTVault_WithUserAssignedIdentity.json
*/
/**
* Sample code: Create or Update Vault with User Assigned Identity.
*
* @param manager Entry point to RecoveryServicesManager.
*/
public static void createOrUpdateVaultWithUserAssignedIdentity(
com.azure.resourcemanager.recoveryservices.RecoveryServicesManager manager) {
manager.vaults().define("swaggerExample").withRegion("West US")
.withExistingResourceGroup("Default-RecoveryServices-ResourceGroup")
.withIdentity(new IdentityData().withType(ResourceIdentityType.USER_ASSIGNED)
.withUserAssignedIdentities(mapOf(
"/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi",
new UserIdentity())))
.withProperties(new VaultProperties().withPublicNetworkAccess(PublicNetworkAccess.ENABLED))
.withSku(new Sku().withName(SkuName.STANDARD)).create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.recoveryservices import RecoveryServicesClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-recoveryservices
# USAGE
python put_vault_with_user_assigned_identity.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = RecoveryServicesClient(
credential=DefaultAzureCredential(),
subscription_id="77777777-b0c6-47a2-b37c-d8e65a629c18",
)
response = client.vaults.begin_create_or_update(
resource_group_name="Default-RecoveryServices-ResourceGroup",
vault_name="swaggerExample",
vault={
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi": {}
},
},
"___location": "West US",
"properties": {"publicNetworkAccess": "Enabled"},
"sku": {"name": "Standard"},
},
).result()
print(response)
# x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2025-02-01/examples/PUTVault_WithUserAssignedIdentity.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armrecoveryservices_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservices/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/82e9c6f9fbfa2d6d47d5e2a6a11c0ad2eb345c43/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2025-02-01/examples/PUTVault_WithUserAssignedIdentity.json
func ExampleVaultsClient_BeginCreateOrUpdate_createOrUpdateVaultWithUserAssignedIdentity() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armrecoveryservices.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewVaultsClient().BeginCreateOrUpdate(ctx, "Default-RecoveryServices-ResourceGroup", "swaggerExample", armrecoveryservices.Vault{
Location: to.Ptr("West US"),
Identity: &armrecoveryservices.IdentityData{
Type: to.Ptr(armrecoveryservices.ResourceIdentityTypeUserAssigned),
UserAssignedIdentities: map[string]*armrecoveryservices.UserIdentity{
"/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi": {},
},
},
Properties: &armrecoveryservices.VaultProperties{
PublicNetworkAccess: to.Ptr(armrecoveryservices.PublicNetworkAccessEnabled),
},
SKU: &armrecoveryservices.SKU{
Name: to.Ptr(armrecoveryservices.SKUNameStandard),
},
}, &armrecoveryservices.VaultsClientBeginCreateOrUpdateOptions{XMSAuthorizationAuxiliary: nil})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Vault = armrecoveryservices.Vault{
// Name: to.Ptr("swaggerExample"),
// Type: to.Ptr("Microsoft.RecoveryServices/vaults"),
// Etag: to.Ptr("W/\"datetime'2017-12-15T12%3A36%3A51.68Z'\""),
// ID: to.Ptr("/subscriptions/77777777-b0c6-47a2-b37c-d8e65a629c18/resourceGroups/Default-RecoveryServices-ResourceGroup/providers/Microsoft.RecoveryServices/vaults/swaggerExample"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "TestUpdatedKey": to.Ptr("TestUpdatedValue"),
// },
// Identity: &armrecoveryservices.IdentityData{
// Type: to.Ptr(armrecoveryservices.ResourceIdentityTypeUserAssigned),
// UserAssignedIdentities: map[string]*armrecoveryservices.UserIdentity{
// "/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi": &armrecoveryservices.UserIdentity{
// ClientID: to.Ptr("fbe75b66-01c5-4f87-a220-233af3270436"),
// PrincipalID: to.Ptr("075a0ca6-43f6-4434-9abf-c9b1b79f9219"),
// },
// },
// },
// Properties: &armrecoveryservices.VaultProperties{
// ProvisioningState: to.Ptr("Succeeded"),
// PublicNetworkAccess: to.Ptr(armrecoveryservices.PublicNetworkAccessEnabled),
// },
// SKU: &armrecoveryservices.SKU{
// Name: to.Ptr(armrecoveryservices.SKUNameStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { RecoveryServicesClient } = require("@azure/arm-recoveryservices");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Creates or updates a Recovery Services vault.
*
* @summary Creates or updates a Recovery Services vault.
* x-ms-original-file: specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/stable/2025-02-01/examples/PUTVault_WithUserAssignedIdentity.json
*/
async function createOrUpdateVaultWithUserAssignedIdentity() {
const subscriptionId =
process.env["RECOVERYSERVICES_SUBSCRIPTION_ID"] || "77777777-b0c6-47a2-b37c-d8e65a629c18";
const resourceGroupName =
process.env["RECOVERYSERVICES_RESOURCE_GROUP"] || "Default-RecoveryServices-ResourceGroup";
const vaultName = "swaggerExample";
const vault = {
identity: {
type: "UserAssigned",
userAssignedIdentities: {
"/subscriptions/85bf5e8c30844f42Add2746ebb7e97b2/resourcegroups/defaultrg/providers/MicrosoftManagedIdentity/userAssignedIdentities/examplemsi":
{},
},
},
___location: "West US",
properties: { publicNetworkAccess: "Enabled" },
sku: { name: "Standard" },
};
const credential = new DefaultAzureCredential();
const client = new RecoveryServicesClient(credential, subscriptionId);
const result = await client.vaults.beginCreateOrUpdateAndWait(
resourceGroupName,
vaultName,
vault,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
샘플 응답
{
"name": "swaggerExample",
"type": "Microsoft.RecoveryServices/vaults",
"etag": "W/\"datetime'2017-12-15T12%3A36%3A51.68Z'\"",
"id": "/subscriptions/77777777-b0c6-47a2-b37c-d8e65a629c18/resourceGroups/Default-RecoveryServices-ResourceGroup/providers/Microsoft.RecoveryServices/vaults/swaggerExample",
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi": {
"clientId": "fbe75b66-01c5-4f87-a220-233af3270436",
"principalId": "075a0ca6-43f6-4434-9abf-c9b1b79f9219"
}
}
},
"___location": "westus",
"properties": {
"provisioningState": "Succeeded",
"publicNetworkAccess": "Enabled"
},
"sku": {
"name": "Standard"
},
"tags": {
"TestUpdatedKey": "TestUpdatedValue"
}
}
Azure-AsyncOperation: /subscriptions/77777777-b0c6-47a2-b37c-d8e65a629c18/resourceGroups/Default-RecoveryServices-ResourceGroup/providers/Microsoft.RecoveryServices/vaults/swaggerExample/operationStatus/YWUzNDFkMzQtZmM5OS00MmUyLWEzNDMtZGJkMDIxZjlmZjgzOzdmYzBiMzhmLTc2NmItNDM5NS05OWQ1LTVmOGEzNzg4MWQzNA==?api-version=2015-03-15
Retry-After: 10
{
"name": "swaggerExample",
"type": "Microsoft.RecoveryServices/vaults",
"etag": "W/\"datetime'2017-12-15T12%3A36%3A51.68Z'\"",
"id": "/subscriptions/77777777-b0c6-47a2-b37c-d8e65a629c18/resourceGroups/Default-RecoveryServices-ResourceGroup/providers/Microsoft.RecoveryServices/vaults/swaggerExample",
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/85bf5e8c-3084-4f42-add2-746ebb7e97b2/resourcegroups/defaultrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplemsi": {}
}
},
"___location": "westus",
"properties": {
"provisioningState": "Provisioning",
"publicNetworkAccess": "Enabled"
},
"sku": {
"name": "Standard"
},
"tags": {
"TestUpdatedKey": "TestUpdatedValue"
}
}
정의
AlertsState
열거형
값 |
Description |
Enabled
|
|
Disabled
|
|
AssociatedIdentity
Object
작업에 사용할 ID 세부 정보
Name |
형식 |
Description |
operationIdentityType
|
IdentityType
|
작업에 사용해야 하는 ID 형식입니다.
|
userAssignedIdentity
|
string
|
operationIdentityType이 UserAssigned인 경우 작업에 사용할 사용자 할당 ID입니다.
|
AzureMonitorAlertSettings
Object
Azure Monitor 기반 경고에 대한 설정
BackupStorageVersion
열거형
백업 스토리지 버전
값 |
Description |
V1
|
|
V2
|
|
Unassigned
|
|
BCDRSecurityLevel
열거형
비즈니스 연속성 및 재해 복구를 위한 Recovery Services 자격 증명 모음의 보안 수준
값 |
Description |
Poor
|
|
Fair
|
|
Good
|
|
Excellent
|
|
ClassicAlertSettings
Object
클래식 경고에 대한 설정
CloudError
Object
Azure Backup의 오류 응답입니다.
Name |
형식 |
Description |
error
|
Error
|
리소스 관리 오류 응답입니다.
|
CmkKekIdentity
Object
CMK에 사용되는 ID의 세부 정보
Name |
형식 |
Description |
useSystemAssignedIdentity
|
boolean
|
시스템 할당 ID를 사용해야 함을 나타냅니다. 'userAssignedIdentity' 필드와 함께 사용할 수 없음
|
userAssignedIdentity
|
string
|
사용된 ID 유형이 UserAssigned인 경우 권한을 부여하는 데 사용할 사용자 할당 ID
|
CmkKeyVaultProperties
Object
CMK를 호스트하는 Key Vault의 속성
Name |
형식 |
Description |
keyUri
|
string
|
고객 관리형 키의 키 URI
|
createdByType
열거형
리소스를 만든 ID의 형식입니다.
값 |
Description |
User
|
|
Application
|
|
ManagedIdentity
|
|
Key
|
|
CrossRegionRestore
열거형
자격 증명 모음에서 지역 간 복원을 사용할 수 있는지 여부를 표시하는 플래그
값 |
Description |
Enabled
|
|
Disabled
|
|
CrossSubscriptionRestoreSettings
Object
구독 간 복원 설정 설정
CrossSubscriptionRestoreState
열거형
값 |
Description |
Enabled
|
|
Disabled
|
|
PermanentlyDisabled
|
|
EnhancedSecurityState
열거형
값 |
Description |
Invalid
|
|
Enabled
|
|
Disabled
|
|
AlwaysON
|
|
Error
Object
리소스 관리 오류 응답입니다.
Name |
형식 |
Description |
additionalInfo
|
ErrorAdditionalInfo[]
|
오류 추가 정보입니다.
|
code
|
string
|
오류 코드입니다.
|
details
|
Error[]
|
오류 세부 정보입니다.
|
message
|
string
|
오류 메시지입니다.
|
target
|
string
|
오류 대상입니다.
|
ErrorAdditionalInfo
Object
리소스 관리 오류 추가 정보입니다.
Name |
형식 |
Description |
info
|
object
|
추가 정보입니다.
|
type
|
string
|
추가 정보 유형입니다.
|
IdentityData
Object
리소스의 ID입니다.
Name |
형식 |
Description |
principalId
|
string
|
리소스 ID의 보안 주체 ID입니다.
|
tenantId
|
string
|
리소스의 테넌트 ID입니다.
|
type
|
ResourceIdentityType
|
사용되는 관리 ID의 형식입니다. 'SystemAssigned, UserAssigned' 형식에는 암시적으로 생성된 ID와 사용자 할당 ID 집합이 모두 포함됩니다. 'None' 형식은 모든 ID를 제거합니다.
|
userAssignedIdentities
|
<string,
UserIdentity>
|
리소스와 연결된 사용자 할당 ID 목록입니다. 사용자 할당 ID 사전 키는 '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}' 형식의 ARM 리소스 ID입니다.
|
IdentityType
열거형
작업에 사용해야 하는 ID 형식입니다.
값 |
Description |
SystemAssigned
|
|
UserAssigned
|
|
ImmutabilitySettings
Object
자격 증명 모음의 불변성 설정
ImmutabilityState
열거형
값 |
Description |
Disabled
|
|
Unlocked
|
|
Locked
|
|
InfrastructureEncryptionState
열거형
이중 암호화 상태 사용/사용 안 함
값 |
Description |
Enabled
|
|
Disabled
|
|
MonitoringSettings
Object
자격 증명 모음의 모니터링 설정
MultiUserAuthorization
열거형
자격 증명 모음의 MUA 설정
값 |
Description |
Invalid
|
|
Enabled
|
|
Disabled
|
|
PrivateEndpoint
Object
프라이빗 엔드포인트 연결에 연결된 프라이빗 엔드포인트 네트워크 리소스입니다.
Name |
형식 |
Description |
id
|
string
|
ID를 가져오거나 설정합니다.
|
PrivateEndpointConnection
Object
프라이빗 엔드포인트 연결 응답 속성입니다.
PrivateEndpointConnectionStatus
열거형
상태를 가져오거나 설정합니다.
값 |
Description |
Pending
|
|
Approved
|
|
Rejected
|
|
Disconnected
|
|
PrivateEndpointConnectionVaultProperties
Object
privateEndpointConnections 목록의 요소로 자격 증명 모음 속성에 저장할 정보입니다.
Name |
형식 |
Description |
id
|
string
|
ID 구독 형식/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft. [서비스]/{resource}/{resourceName}/privateEndpointConnections/{connectionName}.
|
___location
|
string
|
프라이빗 엔드포인트 연결의 위치
|
name
|
string
|
프라이빗 엔드포인트 연결의 이름
|
properties
|
PrivateEndpointConnection
|
프라이빗 엔드포인트 연결 응답 속성입니다.
|
type
|
string
|
형식인 Microsoft.RecoveryServices/vaults/privateEndpointConnections 형식입니다.
|
PrivateLinkServiceConnectionState
Object
프라이빗 링크 서비스 연결 상태를 가져오거나 설정합니다.
Name |
형식 |
Description |
actionsRequired
|
string
|
필요한 작업을 가져오거나 설정합니다.
|
description
|
string
|
설명을 가져오거나 설정합니다.
|
status
|
PrivateEndpointConnectionStatus
|
상태를 가져오거나 설정합니다.
|
ProvisioningState
열거형
프라이빗 엔드포인트 연결의 프로비전 상태를 가져오거나 설정합니다.
값 |
Description |
Succeeded
|
|
Deleting
|
|
Failed
|
|
Pending
|
|
PublicNetworkAccess
열거형
공용 클라이언트에서 리소스 공급자 인바운드 네트워크 트래픽을 사용하거나 사용하지 않도록 설정하는 속성
값 |
Description |
Enabled
|
|
Disabled
|
|
ResourceIdentityType
열거형
사용되는 관리 ID의 형식입니다. 'SystemAssigned, UserAssigned' 형식에는 암시적으로 생성된 ID와 사용자 할당 ID 집합이 모두 포함됩니다. 'None' 형식은 모든 ID를 제거합니다.
값 |
Description |
SystemAssigned
|
|
None
|
|
UserAssigned
|
|
SystemAssigned, UserAssigned
|
|
ResourceMoveState
열거형
이동 작업 후 리소스의 상태입니다.
값 |
Description |
Unknown
|
|
InProgress
|
|
PrepareFailed
|
|
CommitFailed
|
|
PrepareTimedout
|
|
CommitTimedout
|
|
MoveSucceeded
|
|
Failure
|
|
CriticalFailure
|
|
PartialSuccess
|
|
RestoreSettings
Object
자격 증명 모음의 복원 설정
SecureScoreLevel
열거형
Recovery Services 자격 증명 모음의 보안 점수
값 |
Description |
None
|
|
Minimum
|
|
Adequate
|
|
Maximum
|
|
SecuritySettings
Object
자격 증명 모음의 보안 설정
Sku
Object
각 Azure 리소스에 대한 고유 시스템 식별자를 식별합니다.
Name |
형식 |
Description |
capacity
|
string
|
sku 용량
|
family
|
string
|
sku 제품군
|
name
|
SkuName
|
SKU의 이름은 RS0(Recovery Services 0번째 버전)이며 계층은 표준 계층입니다. 백 엔드 스토리지 중복성 또는 다른 자격 증명 모음 설정에는 영향을 주지 않습니다. 스토리지 중복성을 관리하려면 backupstorageconfig를 사용합니다.
|
size
|
string
|
sku 크기
|
tier
|
string
|
Sku 계층입니다.
|
SkuName
열거형
SKU의 이름은 RS0(Recovery Services 0번째 버전)이며 계층은 표준 계층입니다. 백 엔드 스토리지 중복성 또는 다른 자격 증명 모음 설정에는 영향을 주지 않습니다. 스토리지 중복성을 관리하려면 backupstorageconfig를 사용합니다.
값 |
Description |
Standard
|
|
RS0
|
|
SoftDeleteSettings
Object
자격 증명 모음의 일시 삭제 설정
SoftDeleteState
열거형
값 |
Description |
Invalid
|
|
Enabled
|
|
Disabled
|
|
AlwaysON
|
|
SourceScanConfiguration
Object
자격 증명 모음의 원본 검사 구성
StandardTierStorageRedundancy
열거형
자격 증명 모음의 스토리지 중복 설정
값 |
Description |
Invalid
|
|
LocallyRedundant
|
|
GeoRedundant
|
|
ZoneRedundant
|
|
State
열거형
값 |
Description |
Invalid
|
|
Enabled
|
|
Disabled
|
|
systemData
Object
리소스의 생성 및 마지막 수정과 관련된 메타데이터입니다.
Name |
형식 |
Description |
createdAt
|
string
(date-time)
|
리소스 만들기의 타임스탬프(UTC)입니다.
|
createdBy
|
string
|
리소스를 만든 ID입니다.
|
createdByType
|
createdByType
|
리소스를 만든 ID의 형식입니다.
|
lastModifiedAt
|
string
(date-time)
|
리소스 마지막 수정의 타임스탬프(UTC)
|
lastModifiedBy
|
string
|
리소스를 마지막으로 수정한 ID입니다.
|
lastModifiedByType
|
createdByType
|
리소스를 마지막으로 수정한 ID의 형식입니다.
|
TriggerType
열거형
자격 증명 모음 업그레이드가 트리거된 방식입니다.
값 |
Description |
UserTriggered
|
|
ForcedUpgrade
|
|
UpgradeDetails
Object
자격 증명 모음 업그레이드에 대한 세부 정보입니다.
Name |
형식 |
Description |
endTimeUtc
|
string
(date-time)
|
업그레이드 작업이 종료된 UTC 시간입니다.
|
lastUpdatedTimeUtc
|
string
(date-time)
|
업그레이드 작업 상태가 마지막으로 업데이트된 UTC 시간입니다.
|
message
|
string
|
업그레이드 작업에 대한 정보가 포함된 사용자에게 메시지를 표시합니다.
|
operationId
|
string
|
자격 증명 모음 업그레이드 작업의 ID입니다.
|
previousResourceId
|
string
|
업그레이드 전 자격 증명 모음의 리소스 ID입니다.
|
startTimeUtc
|
string
(date-time)
|
업그레이드 작업이 시작된 UTC 시간입니다.
|
status
|
VaultUpgradeState
|
자격 증명 모음 업그레이드 작업의 상태입니다.
|
triggerType
|
TriggerType
|
자격 증명 모음 업그레이드가 트리거된 방식입니다.
|
upgradedResourceId
|
string
|
업그레이드된 자격 증명 모음의 리소스 ID입니다.
|
UserIdentity
Object
서비스 사용자가 관리하는 리소스 ID입니다.
Name |
형식 |
Description |
clientId
|
string
|
사용자 할당 ID의 클라이언트 ID입니다.
|
principalId
|
string
|
사용자 할당 ID의 보안 주체 ID입니다.
|
Vault
Object
리소스 공급자가 반환한 리소스 정보입니다.
Name |
형식 |
Description |
etag
|
string
|
etag를 사용합니다.
|
id
|
string
|
리소스에 대한 정규화된 리소스 ID입니다. 예 - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
identity
|
IdentityData
|
리소스의 ID입니다.
|
___location
|
string
|
리소스가 있는 지리적 위치
|
name
|
string
|
리소스의 이름
|
properties
|
VaultProperties
|
자격 증명 모음의 속성입니다.
|
sku
|
Sku
|
각 Azure 리소스에 대한 고유 시스템 식별자를 식별합니다.
|
systemData
|
systemData
|
createdBy 및 modifiedBy 정보가 포함된 Azure Resource Manager 메타데이터입니다.
|
tags
|
object
|
리소스 태그.
|
type
|
string
|
리소스의 형식입니다. 예: "Microsoft.Compute/virtualMachines" 또는 "Microsoft.Storage/storageAccounts"
|
VaultPrivateEndpointState
열거형
백업에 대한 프라이빗 엔드포인트 상태입니다.
값 |
Description |
None
|
|
Enabled
|
|
VaultProperties
Object
자격 증명 모음의 속성입니다.
VaultPropertiesEncryption
Object
리소스의 고객 관리형 키 세부 정보입니다.
VaultPropertiesMoveDetails
Object
Azure 리소스에서 수행된 최신 이동 작업의 세부 정보
Name |
형식 |
Description |
completionTimeUtc
|
string
(date-time)
|
리소스 이동 작업의 종료 시간
|
operationId
|
string
|
리소스 이동 작업의 OperationId
|
sourceResourceId
|
string
|
리소스 이동 작업의 원본 리소스
|
startTimeUtc
|
string
(date-time)
|
리소스 이동 작업의 시작 시간
|
targetResourceId
|
string
|
리소스 이동 작업의 대상 리소스
|
VaultPropertiesRedundancySettings
Object
자격 증명 모음의 중복 설정
VaultSubResourceType
열거형
자격 증명 모음 AzureBackup, AzureBackup_secondary 또는 AzureSiteRecovery의 하위 리소스 유형
값 |
Description |
AzureBackup
|
|
AzureBackup_secondary
|
|
AzureSiteRecovery
|
|
VaultUpgradeState
열거형
자격 증명 모음 업그레이드 작업의 상태입니다.
값 |
Description |
Unknown
|
|
InProgress
|
|
Upgraded
|
|
Failed
|
|