How to recover and restore Azure Key Vault entities with .NET

Prerequisites

To complete this tutorial:

If you don't have an Azure subscription, create a free account before you begin.

Create an App registration using the Azure Portal

  1. Go to the Azure Portal and log in using your Azure account.
  2. Search for and select Azure Active Directory > Manage > App registrations.
  3. Select New registration.
  4. Enter a name for your App registrations, then click Register.
  5. Under Overview select Application (client) ID, Directory (tenant) ID, and Object ID copy to text editor for later use.
  6. Under Manage > Certificates & secrets > New client secret, filter Description and click Add.
  7. Copy preview created secret value to text editor for later use.

Run the application

First, clone the repository on your machine:

git clone https://github.com/Azure-Samples/key-vault-dotnet-recovery.git

Then, switch to the project folder to edit the app.config file, specifying the required parameters.

cd key-vault-dotnet-recovery

Finally, run the application with the dotnet run command.

dotnet run

This sample shows how to do following operations of Azure Key Vault

  1. Back up and restore Key Vault entities.
  2. Enable soft delete.
  3. Delete, recover and purge a vault.
  4. Delete, recover and purge vault entities.

The following samples are also related:

More information

The Azure Key Vault documentation includes a rich set of tutorials and conceptual articles, which serve as a good complement to the samples.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.