Input bindings allow you to pull data in at the beginning of an execution. The parameters for the input binding can either be set statically in the function.json
or attribute definition, use the %env_variable_name%
syntax to reference a value from environment variables, or pull from surfaced trigger metadata (e.g. the route parameter of an HTTP triggered function). More details on bindings can be found in the Azure Functions documentation. You can always leverage the Dapr SDK directly within your function instead of using an input binding.
Retrieve the current state for a specified key at the beginning of an execution.
{
"type": "daprState",
"direction": "in",
"dataType": "string",
"name": "state",
"stateStore": "statestore",
"key": "{key}"
}
[HttpTrigger(AuthorizationLevel.Function, "get", Route = "state/{key}")] HttpRequest req,
[DaprState("statestore", Key = "{key}")] string state,
Property Name | Description |
---|---|
StateStore | The name of the state store to retrieve state. |
Key | The name of the key to retrieve from the specified state store. |
Retrieve the value of a dapr secret at the beginning of an execution.
NOTE:
%secret-key%
would resolve from the environment variable ofsecret-key
{
"type": "daprSecret",
"name": "secret",
"secretStoreName": "kubernetes",
"key": "%secret-key%",
"metadata": "metadata.namespace=default",
"direction": "in"
}
// %secret-key% would resolve from the environment variable of `secret-key`
[DaprSecret("kubernetes", "%secret-key%", Metadata = "metadata.namespace=default")] JObject
Property Name | Description |
---|---|
SecretStoreName | The name of the secret store to get the secret. |
Key | The key identifying the name of the secret to get. |
Metadata | Optional. An array of metadata properties in the form "key1=value1&key2=value2". |