External Storage / Microsoft Azure Storage
To use Microsoft Azure as your External Storage of choice, you must set the provider
attribute to azure
within the store
hash and, at a minimum, provide your Azure Storage access key
as well as Azure Storage account
name and a destination container
. The full list of store
hash attibutes for Microsoft Azure storage can be found below.
Alternatively, you can use our Secure Storage Connectors. Simply save your credentials in your Optidash Account and reference them by ID. This mechanism significantly enhances the security of your cloud credentials. When Secure Storage Connectors are in use, you only need to provide the Optidash API with your Connector id
instead of provider
, key
, and secret
properties. You can add a new Connector in your Optidash Account.
Authentication
When passing AWS credentials in your request JSON, you have to set the following authentication properties:
Attribute | Type | Description |
provider |
String | provider must be set to azure |
key |
String | Your Azure Storage Access Key |
account |
String | Your Azure Storage Account name |
{
"store": {
"provider": "aws",
"key": "azure-access-key",
"account": "azure-account-name"
}
}
When using Secure Storage Connectors, you only need to provide your Connector ID:
Attribute | Type | Description |
id |
String | Secure Storage Connector ID |
{
"store": {
"id": "your-connector-id"
}
}
Microsoft Azure Storage properties and settings
Attribute | Type | Required | Description |
container |
String | Yes | Name of a destination container in your Microsoft Azure account. |
path |
String | No | Destination path in your Azure container (without leading slash). Defaults to root. |
metadata |
Hash | No | Custom Azure Blob Metadata. |
headers |
Hash | No | Custom HTTP headers you for your object. |
The Optidash API allows you to set the following custom headers on your objects: Cache-Control
, Content-Type
, Content-Encoding
, Content-Language
and Content-Disposition
{
"store": {
"provider": "microsoft",
"key": "azure-access-key",
"account": "azure-account-name",
"container": "images",
"path": "assets/image.jpg",
"metadata": {
"key": "value"
},
"headers": {
"Cache-Control": "max-age=2592000000"
}
}
}
An example cURL request of using Microsoft Azure Storage as the External Storage provider will look like the following:
curl https://api.optidash.ai/1.0/fetch -X POST -u your-api-key: \
-H "Content-Type: application/json" \
-d '{
"url": "https://www.website.com/image.jpg",
"resize": {
"width": 100,
"height": 75
},
"store": {
"provider": "microsoft",
"key": "azure-access-key",
"account": "azure-account-name",
"container": "images",
"path": "assets/image.jpg"
}
}'
When using Microsoft Azure as your External Storage, the url
property within the JSON response will point to the object's location within the Azure Container and you can safely use that URL in production, for example:
HTTP/1.1 200 OK
Status: 200 OK
Content-Type: application/json
{
"success": true,
"code": 200,
"id": "b33ab63b-ddc0-462d-a1cf-437240c868b8",
"input": {
"name": "image.jpg",
..
},
"output": {
"url": "https://container-name.blob.core.windows.net/assets/image.jpg",
..
}
}