azurestorageconnector
Reactive icon

AzureStorageConnector

Stable version 1.0.0 (Compatible with OutSystems 11)
Uploaded
 on 27 May 2024
 by 
5.0
 (2 ratings)
azurestorageconnector

AzureStorageConnector

Documentation
1.0.0

Version 1.0 - May 2024 - Patrick Langeveld

Azure Storage Connector

The library “Azure Storage Connector” is built on the REST API of the Azure storage service. This library can be used to store files (documents, images, videos e.g.) in the Azure storage, instead of saving them as binary data in the database.

As best practice, it is recommended to avoid saving such files in a relational SQL database.

Preparing the use of the library

The fist step is to make sure that you have signed up to https://portal.azure.com/ . It is possible to use a trail account for a certain period. After this period, you have to pay for services like the Azure storage.

Secondly, it is required to create a resource account to be able to create the storage account.

After creating the resource account a storage account must be created.

By creating a storage account, the setup is finished. Within the storage account, containers can be created/configured. This container is the storage location of a binary file --> blob.

To keep the files secured, it is recommended to keep the authentication level set to private (not anonymous, open for everyone). However, to be make sure that the “Azure Storage Connector” can access the files, a Shared Access Signature is required. This SAS token can be obtained from the storage account and has a limited access period. After exceeding the access period a new token need to be created in the portal.

Now, the configuration is finished and the last steps need to be performed to be able to use the Azure Storage Connector in OutSystems.

First set the Site properties / Settings in service center. For ODC, the settings can be configured per consumer application.

  • Container_Name: Define a default container, this can be helpful to avoid setting the conainer name in every step when you use functions of the connector that contain a container name.
  • SAS_ExpirationDateTime: The datetime that the Shared Access Signature expires. The library will check this datetime against the current datetime to avoid unnecessary calls.
  • SAS_Token: The Shared Access Signature token/key determined from the Azure portal.
  • StorageAccount_Name: The name of the Storage Account that can be obtained from the Azure portal.


REST Functions

https://learn.microsoft.com/en-us/rest/api/storageservices/blob-service-rest-api

--> Create Container (implemented)

--> Delete Blob (implemented)

--> Get Blob (implemented)

--> List Blobs (implemented)

--> List Containers (implemented)

--> Put Blob (implemented)

Abort Copy Blob

Append Block

Copy Blob

Delete Container

Find Blobs By Tags

Get Account Information

Get Blob Metadata

Get Blob Properties

Get Blob Storage Properties

Get Blob Storage Stats

Get Blob Tags

Get Block List

Get Container ACL

Get Container Metadata

Get Container Properties

Get Page Ranges

Get User Delegation Key

Incremental Copy Blob

Lease Blob

Lease Container

Preflight Blob Request

Put Block

Put Block From URL

Put Block List

Put Page

Query Blob Contents

Set Blob Expiry

Set Blob Metadata

Set Blob Properties

Set Blob Storage Properties

Set Blob Tags

Set Blob Tier

Set Container ACL

Set Container Metadata

Snapshot Blob

Undelete Blob

WebBlock BlobImage

For webpages where multiple images need to be shown at the same time (for example, web shops), it can be useful to use the WebBlock BlobImage. Azure does not support a REST call to obtain multiple blobs in once. In this WebBlock, the image will be obtained via the Blob URL and therefore it is not required to obtain each blob via a separate REST call.

Dependencies

The “Azure Storage Connector” library uses the forge component XmlToJson to convert the XML text obtained from the Azure service into Json. Thanks to Borislav Shumarov, Kilian Hekhuis and Tiago Bojikian Costa Vital.

  • XmlToJson