https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/keyvault/Azure.Security.KeyVault.Secrets
Login in Azure portal and navigate into the KeyVault service.
Create a new KeyVault pressing the "Create key vault" button
IMPORTANT NOTE: pay attention go to the "Access configuration" tab, and select the option "Azure role-based access control (recommended)"
Navigate to the Azure ResourceGroup where the Azure KeyVault was created
Grant permssion to the ResourceGroup as KeyVault Administrator
using Azure.Identity;
using Azure.Security.KeyVault.Secrets;
// Create a secret client using the DefaultAzureCredential
var client = new SecretClient(new Uri("https://myNewVault2000.vault.azure.net/"), new DefaultAzureCredential());
try
{
KeyVaultSecret secret = client.SetSecret("mysecret1", "Luiscoco123456789");
// Retrieve a secret using the secret client.
secret = client.GetSecret("mysecret1");
Console.WriteLine(secret.Value);
}
catch (AuthenticationFailedException e)
{
Console.WriteLine($"Authentication Failed. {e.Message}");
}