共用方式為


Azure Recovery Services and Backup libraries for .NET

Overview

Azure Recovery Services is a suite of services for data recovery, including Azure Backup and Azure Site Recovery.

Management library

Install the NuGet package directly from the Visual Studio Package Manager console or with the .NET Core CLI.

Visual Studio Package Manager

Install-Package Microsoft.Azure.Management.RecoveryServices
Install-Package Microsoft.Azure.Management.RecoveryServices.Backup

.NET Core CLI

dotnet add package Microsoft.Azure.Management.RecoveryServices
dotnet add package Microsoft.Azure.Management.RecoveryServices.Backup

Code Example

The following code example uses the management library to trigger a backup.

RecoveryServicesBackupClient client = new RecoveryServicesBackupClient(credentials);
TriggerBackupRequest triggerBackupRequest = new TriggerBackupRequest();
BaseRecoveryServicesJobResponse resp =
    await client.Backups.TriggerBackupAsync(resourceGroupName, resourceName, null,
        fabricName, containerName, protectedItemName, triggerBackupRequest);