Skip to main content
If you’re working with .NET, the official Infisical .NET SDK package is the easiest way to fetch and work with secrets for your application.

Installation

Getting Started (.NET)

Getting Started (Visual Basic)

Core Methods

The SDK methods are organized into the following high-level categories:
  1. Auth(): Handles authentication methods.
  2. Secrets(): Manages CRUD operations for secrets.
  3. Pki(): Programmatically interact with the Infisical PKI.
    • Subscribers(): Manage PKI Subscribers.

Auth()

The Auth() component provides methods for authentication:

Universal Auth

Authenticating

Parameters:
  • clientId (string): The client ID of your Machine Identity.
  • clientSecret (string): The client secret of your Machine Identity.

LDAP Auth

Authenticating

Parameters:
  • identityId (string): The ID of your Machine Identity .
  • username (string): The LDAP username for authentication.
  • password (string): The LDAP password for authentication.

Secrets()

The Secrets() sub-class handles operations related to the Infisical secrets management product.

List Secrets

ListSecretsOptions:
  • ProjectId (string): The ID of your project.
  • EnvironmentSlug (string): The environment in which to list secrets (e.g., “dev”).
  • SecretPath (string): The path to the secrets.
  • ExpandSecretReferences (boolean): Whether to expand secret references.
  • Recursive (boolean): Whether to list secrets recursively.
  • SetSecretsAsEnvironmentVariables (boolean): Set the retrieved secrets as environment variables.
Returns:
  • Task<Secret[]>: The response containing the list of secrets.

Create Secret

Parameters:
  • SecretName (string): The name of the secret to create
  • SecretValue (string): The value of the secret.
  • ProjectId (string): The ID of your project.
  • EnvironmentSlug (string): The environment in which to create the secret.
  • SecretPath (string, optional): The path to the secret.
  • Metadata (object, optional): Attach metadata to the secret.
  • SecretComment (string, optional): Attach a secret comment to the secret.
  • SecretReminderNote (string, optional): Attach a secret reminder note to the secret.
  • SecretReminderRepeatDays (int, optional): Set the reminder repeat days on the secret.
  • SkipMultilineEncoding (bool, optional): Whether or not to skip multiline encoding for the secret’s value. Defaults to false.
Returns:
  • Task<Secret>: The created secret.

Update Secret

Parameters:
  • SecretName (string): The name of the secret to update.`
  • ProjectId (string): The ID of your project.
  • EnvironmentSlug (string): The environment in which to update the secret.
  • SecretPath (string): The path to the secret.
  • NewSecretValue (string, optional): The new value of the secret.
  • NewSecretName (string, optional): A new name for the secret.
  • NewMetadata (object, optional): New metadata to attach to the secret.
Returns:
  • Task<Secret>: The updated secret.

Get Secret by Name

Parameters:
  • SecretName (string): The name of the secret to get`
  • ProjectId (string): The ID of your project.
  • EnvironmentSlug (string): The environment in which to retrieve the secret.
  • SecretPath (string): The path to the secret.
  • ExpandSecretReferences (boolean, optional): Whether to expand secret references.
  • Type (SecretType, optional): The type of secret to fetch. Defaults to Shared.
Returns:
  • Task<Secret>: The fetched secret.

Delete Secret by Name

Parameters:
  • SecretName (string): The name of the secret to delete.
  • ProjectId (string): The ID of your project.
  • EnvironmentSlug (string): The environment in which to delete the secret.
  • SecretPath (string, optional): The path to the secret.
Returns:
  • Task<Secret>: The deleted secret.

Pki().Subscribers()

The Pki().Subscribers() sub-class is used to programmatically interact with the Infisical PKI product line. Currently only issuing new certificates and retrieving the latest certificate bundle from a subscriber is supported. More widespread support for the PKI product is coming to the .NET SDK in the near future.

Issue a new certificate

Parameters:
  • SubscriberName (string): The name of the subscriber to create a certificate for.
  • ProjectId (string): The ID of PKI project.
Returns:
  • Task<SubscriberIssuedCertificate>: The newly issued certificate along with it’s credentials for the specified subscriber.

Retrieve latest certificate bundle

Parameters:
  • SubscriberName (string): The name of the subscriber to retrieve the latest certificate bundle for
  • ProjectId (string): The ID of PKI project.
Returns:
  • Task<CertificateBundle>: The latest certificate bundle for the specified subscriber.