TAP-AzureKeyVault 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package TAP-AzureKeyVault --version 1.0.0
NuGet\Install-Package TAP-AzureKeyVault -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TAP-AzureKeyVault" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TAP-AzureKeyVault --version 1.0.0
#r "nuget: TAP-AzureKeyVault, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install TAP-AzureKeyVault as a Cake Addin
#addin nuget:?package=TAP-AzureKeyVault&version=1.0.0

// Install TAP-AzureKeyVault as a Cake Tool
#tool nuget:?package=TAP-AzureKeyVault&version=1.0.0

Azure KeyVault Utility

The Azure KeyVault Utility is a C# library that simplifies working with Azure Key Vault. It includes features for key rotation and key retrieval, making it easier to manage cryptographic keys in your Azure Key Vault.

Table of Contents

Introduction

Azure Key Vault is a secure and centralized service for managing secrets, keys, and certificates used by cloud applications and services. This utility simplifies interactions with Azure Key Vault by providing a set of C# classes and methods.

Features

  • Key Rotation: Rotate keys in your Azure Key Vault, creating a new version with updated key material while preserving key attributes and tags.
  • Key Retrieval: Retrieve keys from your Azure Key Vault.

Getting Started

Prerequisites

  • .NET Core or .NET Framework installed on your development machine.
  • An Azure subscription with an Azure Key Vault created and configured.

Installation

  1. Clone this repository to your local machine:

    git clone https://github.com/TouchAndPay-Technologies/TKV-TAPKeyVault-Lib_CSharp.git
    
  2. Open the project in your preferred development environment.

Configuration

  1. Open the appsettings.json file in the project.

  2. Configure the following settings:

    {
      "AzureKeyVault": {
        "VaultBaseUrl": "https://your-keyvault.vault.azure.net/",
        "KeyName": "your-key-name"
      },
      "AzureActiveDirectory": {
        "TenantId": "your-tenant-id",
        "ClientId": "your-client-id",
        "ClientSecret": "your-client-secret"
      }
    }
    

    Replace the placeholders with your actual Azure Key Vault and Azure Active Directory credentials.

Usage

Key Rotation

To rotate a key in your Azure Key Vault:

using AzureKeyVault;

var keyVault = new TapAzureKeyVault();
await keyVault.RotateKeyAsync("your-key-name");

Key Retrieval

To retrieve a key from your Azure Key Vault:

using AzureKeyVault;

var keyVault = new TapAzureKeyVault();
var key = await keyVault.GetKeyAsync("your-key-name");

Advanced

Dependency Injection

If you are using an ASP.NET Core application, you can register the TapAzureKeyVault as a service and inject it where needed. Here's how:

  1. In your Startup.cs file, add the service registration:

    using AzureKeyVault;
    
    public void ConfigureServices(IServiceCollection services)
    {
        var azureKeyConfig = new AzureKeyConfig
        {
            // Configure your AzureKeyConfig here
        };
    
        services.AddAzureKeyVaultClient(azureKeyConfig);
    }
    
  2. Inject the IKeyVaultService interface in your controller or service:

    using AzureKeyVault;
    
    public class MyService
    {
        private readonly IKeyVaultService _keyVaultService;
    
        public MyService(IKeyVaultService keyVaultService)
        {
            _keyVaultService = keyVaultService;
        }
    }
    

Contributing

We welcome contributions! If you'd like to contribute to this project, please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Make your changes and write tests if necessary.
  4. Run the existing tests to ensure they pass.
  5. Submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.


Feel free to modify the README further to include more specific information about your project, additional features, or any other sections that you find relevant.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 175 11/7/2023
1.0.0 97 11/7/2023