TAP-AzureKeyVault
1.0.0
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
<PackageReference Include="TAP-AzureKeyVault" Version="1.0.0" />
paket add TAP-AzureKeyVault --version 1.0.0
#r "nuget: TAP-AzureKeyVault, 1.0.0"
// 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
Clone this repository to your local machine:
git clone https://github.com/TouchAndPay-Technologies/TKV-TAPKeyVault-Lib_CSharp.git
Open the project in your preferred development environment.
Configuration
Open the
appsettings.json
file in the project.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:
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); }
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:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes and write tests if necessary.
- Run the existing tests to ensure they pass.
- 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 | Versions 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. |
-
net6.0
- Azure.Identity (>= 1.10.3)
- Azure.Security.KeyVault.Keys (>= 4.5.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 7.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.