public sealed class SecretEnvVar : IMessage<SecretEnvVar>, IEquatable<SecretEnvVar>, IDeepCloneable<SecretEnvVar>, IBufferMessage, IMessage
Reference documentation and code samples for the Cloud Functions v2 API class SecretEnvVar.
Configuration for a secret environment variable. It has the information
necessary to fetch the secret value from secret manager and expose it as an
environment variable.
Project identifier (preferably project number but can also be the
project ID) of the project that contains the secret. If not set, it is
assumed that the secret is in the same project as the function.
Version of the secret (version number or the string 'latest'). It is
recommended to use a numeric version for secret environment variables as
any updates to the secret value is not reflected until new instances
start.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-09 UTC."],[[["\u003cp\u003eThis page provides reference documentation for the \u003ccode\u003eSecretEnvVar\u003c/code\u003e class within the Google Cloud Functions v2 API, specifically for .NET development.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eSecretEnvVar\u003c/code\u003e is used to configure a secret environment variable, enabling the fetching of secret values from Secret Manager and exposing them as environment variables.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version of the \u003ccode\u003eSecretEnvVar\u003c/code\u003e class is 1.7.0, with prior versions available back to 1.0.0.\u003c/p\u003e\n"],["\u003cp\u003eThe class implements several interfaces, including \u003ccode\u003eIMessage\u003c/code\u003e, \u003ccode\u003eIEquatable\u003c/code\u003e, \u003ccode\u003eIDeepCloneable\u003c/code\u003e, and \u003ccode\u003eIBufferMessage\u003c/code\u003e, and inherits members from \u003ccode\u003eobject\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe class has four properties: Key, ProjectId, Secret, and Version, that are used to define the name of the env variable, the project ID where the secret is stored, the name of the secret, and the version of the secret respectively.\u003c/p\u003e\n"]]],[],null,["# Cloud Functions v2 API - Class SecretEnvVar (1.7.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.7.0 (latest)](/dotnet/docs/reference/Google.Cloud.Functions.V2/latest/Google.Cloud.Functions.V2.SecretEnvVar)\n- [1.6.0](/dotnet/docs/reference/Google.Cloud.Functions.V2/1.6.0/Google.Cloud.Functions.V2.SecretEnvVar)\n- [1.5.0](/dotnet/docs/reference/Google.Cloud.Functions.V2/1.5.0/Google.Cloud.Functions.V2.SecretEnvVar)\n- [1.4.0](/dotnet/docs/reference/Google.Cloud.Functions.V2/1.4.0/Google.Cloud.Functions.V2.SecretEnvVar)\n- [1.3.0](/dotnet/docs/reference/Google.Cloud.Functions.V2/1.3.0/Google.Cloud.Functions.V2.SecretEnvVar)\n- [1.2.0](/dotnet/docs/reference/Google.Cloud.Functions.V2/1.2.0/Google.Cloud.Functions.V2.SecretEnvVar)\n- [1.1.0](/dotnet/docs/reference/Google.Cloud.Functions.V2/1.1.0/Google.Cloud.Functions.V2.SecretEnvVar)\n- [1.0.0](/dotnet/docs/reference/Google.Cloud.Functions.V2/1.0.0/Google.Cloud.Functions.V2.SecretEnvVar) \n\n public sealed class SecretEnvVar : IMessage\u003cSecretEnvVar\u003e, IEquatable\u003cSecretEnvVar\u003e, IDeepCloneable\u003cSecretEnvVar\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Cloud Functions v2 API class SecretEnvVar.\n\nConfiguration for a secret environment variable. It has the information\nnecessary to fetch the secret value from secret manager and expose it as an\nenvironment variable. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e SecretEnvVar \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[SecretEnvVar](/dotnet/docs/reference/Google.Cloud.Functions.V2/latest/Google.Cloud.Functions.V2.SecretEnvVar), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[SecretEnvVar](/dotnet/docs/reference/Google.Cloud.Functions.V2/latest/Google.Cloud.Functions.V2.SecretEnvVar), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[SecretEnvVar](/dotnet/docs/reference/Google.Cloud.Functions.V2/latest/Google.Cloud.Functions.V2.SecretEnvVar), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.Functions.V2](/dotnet/docs/reference/Google.Cloud.Functions.V2/latest/Google.Cloud.Functions.V2)\n\nAssembly\n--------\n\nGoogle.Cloud.Functions.V2.dll\n\nConstructors\n------------\n\n### SecretEnvVar()\n\n public SecretEnvVar()\n\n### SecretEnvVar(SecretEnvVar)\n\n public SecretEnvVar(SecretEnvVar other)\n\nProperties\n----------\n\n### Key\n\n public string Key { get; set; }\n\nName of the environment variable.\n\n### ProjectId\n\n public string ProjectId { get; set; }\n\nProject identifier (preferably project number but can also be the\nproject ID) of the project that contains the secret. If not set, it is\nassumed that the secret is in the same project as the function.\n\n### Secret\n\n public string Secret { get; set; }\n\nName of the secret in secret manager (not the full resource name).\n\n### Version\n\n public string Version { get; set; }\n\nVersion of the secret (version number or the string 'latest'). It is\nrecommended to use a numeric version for secret environment variables as\nany updates to the secret value is not reflected until new instances\nstart."]]