Policies
Archive Request to Azure Storage Policy
Custom Policy Example
Zuplo is extensible, so we don't have a built-in policy for Archive Request to Azure Storage, instead we have a template here that shows you how you can use your superpower (code) to achieve your goals. To learn more about custom policies see the documentation.
In this example shows how you can archive the body of incoming requests to Azure Blob Storage. This can be useful for auditing, logging, or archival scenarios. Additionally, you could use this policy to save the body of a request and then enqueue some async work that uses this body.
Configuration
The example below shows how to configure a custom code policy in the 'policies.json' document that utilizes the above example policy code.
Policy Options
The options for this policy are specified below. All properties are optional unless specifically marked as required.
blobCreateSas
<string> -The Azure shared access token with permission to write to the bucketblobContainerPath
<string> -The path to the Azure blob container
Using the Policy
Using the Policy#
In order to use this policy, you'll need to setup Azure storage. You'll find instructions on how to do that below.
Setup Azure#
First, let's set up Azure. You'll need a container in Azure storage
(docs).
Once you have your container you'll need the URL - you can get it on the
properties
tab of your container as shown below.
Note - this sample is available as a Zup It on GitHub - just click ZupIt! to deploy to your Zuplo account: https://github.com/zuplo/samples-req-archive-filestorage
This URL will be the blobPath
in our policy options.
Next, we'll need a SAS (Shared Access Secret) to authenticate with Azure. You
can generate one of these on the Shared access tokens
tab.
Note, you should minimize the permissions - and select only the Create
permission. Choose a sensible start and expiration time for your token. Note, we
do not recommend restricting IP addresses because Zuplo runs at the edge in over
200 data-centers world-wide.
Then generate your SAS token - copy the token (not the URL) to the clipboard and
enter it into a new environment variable in your zup called BLOB_CREATE_SAS
.
You'll need another environment variable called BLOB_CONTAINER_PATH
.
Read more about how policies work