/oci-secrets

sample to read the secrets from the oracle cloud oci vault

Primary LanguageC#

Read secrets from OCI Vault

OCI vault feature

Secrets

Used to store any cryptographic information like passwords, key-phrases, senstive data.

Sample code

    using (var client = new SecretsClient(provider, new ClientConfiguration()))
    {
        var response = await client.GetSecretBundle(getSecretBundleRequest);
        // Retrieve value from the response.
        Base64SecretBundleContentDetails secretIdValue = (Base64SecretBundleContentDetails)response.SecretBundle.SecretBundleContent;
        Console.WriteLine(JsonSerializer.Serialize(secretIdValue));
    }

Pre-requesite to use this sample

  1. Install visual code, link
  2. clone the repo
  3. Add below packages
dotnet add package OCI.DotNetSDK.Core
dotnet add package OCI.DotNetSDK.Identity
dotnet add package OCI.DotNetSDK.Secrets
  1. Create a vault, key, secret in OCI.

  2. Configure the OCI .net SDK link

    note: config region and vault region should be same. How to run?

dotnet run

Reference sample code: https://docs.oracle.com/en-us/iaas/tools/dot-net-examples/32.1.0/secrets/GetSecretBundle.cs.html