
# Host Assets on Azure Blob Storage

[Azure Blob Storage](https://learn.microsoft.com/en-us/azure/storage/blobs/) is Microsoft's object storage solution for
the cloud. Store and serve large amounts of unstructured data with high availability and global redundancy.

By using the Azure Blob Storage destination you can immediately send your assets to your own Blob container, making it
quick and easy to host your assets in your own Azure account.

### Setup

Sign up to Microsoft Azure and create a Storage account with a Blob container if you have not already set one up. The
container must exist before files can be sent. Azure credentials are required and must be added via the Shotstack
[dashboard](https://dashboard.shotstack.io).

### Adding credentials

Login to the dashboard and navigate to the [integrations](https://dashboard.shotstack.io/integrations) page, find the
Azure Blob Storage destination and click
[configure](https://dashboard.shotstack.io/integrations/azure-blob-storage).

Enter your storage account name and credentials as shown. You can add different credentials for each Shotstack
environment; sandbox and v1 (production).

### Integration

#### Basic integration

To send files to Azure Blob Storage add the following to the output parameter of a render request JSON payload, JSON
template or the root level of an ingest request:

```json
"destinations": [{
    "provider": "azure-blob-storage",
    "options": {
        "accountName": "mystorageaccount",
        "container": "my-container"
    }
}]
```

This will send the generated or ingested files to the **my-container** container in the **mystorageaccount** storage
account. The filename will be the render id, source id or rendition id plus extension, i.e.
**edc47d30-a504-4f16-8439-24c863a7a782.mp4**. Thumbnail and poster images will also be transferred.

#### Advanced integration

You can also optionally set a virtual directory prefix and custom file name:

```json
"destinations": [{
    "provider": "azure-blob-storage",
    "options": {
        "accountName": "mystorageaccount",
        "container": "my-container",
        "prefix": "videos",
        "filename": "my-video"
    }
}]
```

This will send the rendered files to the **my-container** container with a virtual directory prefix of **videos**. If
the rendered file is an mp4, the filename will be **my-video.mp4**.

When using a custom filename omit the file extension, i.e. .mp4 or .jpg. This will be added based on the rendered file
type. If a poster or thumbnail are created these will have **-poster.jpg** and **-thumbnail.jpg** appended.

#### Sending assets to multiple containers

It is also possible to send files to multiple containers with one request:

```json
"destinations": [{
    "provider": "azure-blob-storage",
    "options": {
        "accountName": "mystorageaccount",
        "container": "my-container"
    }
},{
    "provider": "azure-blob-storage",
    "options": {
        "accountName": "mystorageaccount",
        "container": "my-backup-container",
        "prefix": "backups"
    }
}]
```

This will send rendered assets to **my-container** and to the **backups** prefix of **my-backup-container**. Containers
must be in the same Azure Storage account and accessible by the configured credentials.

### Opting out from the Shotstack destination

By default all generated files are sent to the Shotstack destination. If you are using Azure Blob Storage you may wish
to [opt out](../self-host.md) from hosting your videos with Shotstack using:

```json
"destinations": [{
    "provider": "azure-blob-storage",
    "options": {
        "accountName": "mystorageaccount",
        "container": "my-container"
    }
},{
    "provider": "shotstack",
    "exclude": true
}]
```

This will send the generated video to Azure Blob Storage but not to Shotstack.
