Back Up Record Data to Azure Storage
Overview
This article introduces how to back up Kintone record data to
Azure Storage
using
webhooks
.
What is Azure Storage?
Azure Storage is a feature of Microsoft Azure. It works flexibly with Azure services, achieving integrations using triggers and bindings with minimal amount of code. It is able to store NoSQL table data blobs, queues and files.
Integration Image
When a record is added into Kintone, a webhook including the record's data is sent. Azure Functions catches the webhook, and stores the record data into Azure Table Storage.
Prepare the Kintone App
The following App template is used to create an App for integration with Azure functions:
AzureFunctions integration (product DB).zip
Refer to the
App Templates
article in the Kintone Help site for steps to install App templates into the Kintone domain. Refer to
Creating an App from a Template
article for the steps to create an App from a template.
Prepare Azure Storage
The "Microsoft Azure Storage Explorer" client tool is used in this article to utilize Azure Storage. Download and install the tool from the
Microsoft Azure website
.
Learn how to use Azure Storage Explorer with
Get started with Storage Explorer
.
Prepare Azure Functions
Create an Azure Function
Create the settings with reference to the
Create your first function in the Azure Portal
article on the Microsoft Azure website.
Bind settings
Once the function is created, choose "New Output".
Choose "Azure Table Storage".
For the "Table name", input a name that matches the table name in Azure Storage.
Check that the same name is used in Azure Storage.
Once the Azure Table Storage configuration has finished, delete the default HTTP output settings on Azure Functions.
If there is only Azure Table Storage left in the settings for the output, the setup is complete.
Sample Code
index.js for Azure Functions
Prepare the following JavaScript code for Azure Functions.
|
|
RowKey
, PartitionKey
, id
, name
, and price
are the field names of the table where data will be sent to.
function.json for Azure Functions
Prepare the following JSON file for Azure Functions.
|
|
This JSON configures the in/out settings for Azure Functions. The JSON sets HTTP Triggers as the input and the Table of Azure Storage as the output.
The values below must be reconfigured accordingly to the Azure Storage environment.
|
|
Webhook settings for the Kintone App
For Azure Functions to receive data, webhooks need to be set up on the Kintone App.
Webhooks will be set up on the Kintone App, so that data is sent to Azure Functions when a new record is added.
First on Azure Functions, click on the "Get function URL" link for index.json.
Copy the URL displayed in the dialog.
Navigate to the Kintone domain. Follow the
steps in the Kintone Help site
for configuring a new webhook. Set the Events as Record is added and the Webhook Endpoint as the URL obtained in the previous step. Save the settings and Update the App. Now ever time a new record is added to the Kintone App, the App sends the record data to Azure Functions. The index.js code then processes the data.
Test the integration
Add several records into your Kintone App. The data of the records should be added into Azure Storage, as shown below.