Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ This component supports **output binding** with the following operations:
- `get` : [Get blob](#get-blob)
- `delete` : [Delete blob](#delete-blob)
- `list`: [List blobs](#list-blobs)
- `presign`: [Generate presigned SAS URL](#presign-blob)

The Blob storage component's **input binding** triggers and pushes events using [Azure Event Grid]({{% ref eventgrid.md %}}).

Expand Down Expand Up @@ -168,17 +169,45 @@ Then you can upload it as you would normally:

{{< /tabpane >}}

#### Share blob with a presigned SAS URL

To generate a presigned SAS URL when creating a blob, include the `signTTL` metadata key on a `create` request. The SAS URL provides temporary read-only access to the blob.
Valid values for `signTTL` are [Go duration strings](https://pkg.go.dev/time#ParseDuration) (e.g. `"15m"`, `"1h"`, `"24h"`).

> **Note:** This feature requires the binding to be configured with an account key or connection string. Microsoft Entra ID authentication is not supported for SAS URL generation.

{{< tabpane text=true >}}

{{% tab "Windows" %}}
```bash
curl -d "{ \"operation\": \"create\", \"data\": \"Hello World\", \"metadata\": { \"blobName\": \"my-test-file.txt\", \"signTTL\": \"15m\" } }" \
http://localhost:<dapr-port>/v1.0/bindings/<binding-name>
```
{{% /tab %}}

{{% tab "Linux" %}}
```bash
curl -d '{ "operation": "create", "data": "Hello World", "metadata": { "blobName": "my-test-file.txt", "signTTL": "15m" } }' \
http://localhost:<dapr-port>/v1.0/bindings/<binding-name>
```
{{% /tab %}}

{{< /tabpane >}}

#### Response

The response body will contain the following JSON:

```json
{
"blobURL": "https://<your account name>. blob.core.windows.net/<your container name>/<filename>"
"blobURL": "https://<your account name>.blob.core.windows.net/<your container name>/<filename>",
"blobName": "<filename>",
"presignURL": "https://<your account name>.blob.core.windows.net/<your container name>/<filename>?sv=2023-11-03&se=2024-01-01T00%3A15%3A00Z&sr=b&sp=r&sig=<signature>"
}

```

> The `presignURL` field is only present when `signTTL` is provided in the request metadata.

### Get blob

To perform a get blob operation, invoke the Azure Blob Storage binding with a `POST` method and the following JSON body:
Expand Down Expand Up @@ -405,6 +434,57 @@ The list of blobs will be returned as JSON array in the following form:
]
```

### Presign blob

To generate a presigned SAS URL for an existing blob, invoke the Azure Blob Storage binding with a `POST` method and the following JSON body. The SAS URL provides temporary read-only access to the blob without requiring authentication.

> **Note:** This operation requires the binding to be configured with an account key or connection string. Microsoft Entra ID authentication is not supported for SAS URL generation.

```json
{
"operation": "presign",
"metadata": {
"blobName": "my-test-file.txt",
"signTTL": "15m"
}
}
```

The metadata parameters are:

- `blobName` - the name of the blob to generate a SAS URL for
- `signTTL` - the time-to-live for the SAS URL. Valid values are [Go duration strings](https://pkg.go.dev/time#ParseDuration) (e.g. `"15m"`, `"1h"`, `"24h"`)

#### Example

{{< tabpane text=true >}}

{{% tab "Windows" %}}
```bash
curl -d "{ \"operation\": \"presign\", \"metadata\": { \"blobName\": \"my-test-file.txt\", \"signTTL\": \"15m\" } }" \
http://localhost:<dapr-port>/v1.0/bindings/<binding-name>
```
{{% /tab %}}

{{% tab "Linux" %}}
```bash
curl -d '{ "operation": "presign", "metadata": { "blobName": "my-test-file.txt", "signTTL": "15m" } }' \
http://localhost:<dapr-port>/v1.0/bindings/<binding-name>
```
{{% /tab %}}

{{< /tabpane >}}

#### Response

The response body contains the following JSON:

```json
{
"presignURL": "https://<your account name>.blob.core.windows.net/<your container name>/my-test-file.txt?sv=2023-11-03&se=2024-01-01T00%3A15%3A00Z&sr=b&sp=r&sig=<signature>"
}
```

## Metadata information

By default the Azure Blob Storage output binding auto generates a UUID as the blob filename and is not assigned any system or custom metadata to it. It is configurable in the metadata property of the message (all optional).
Expand Down
Loading