Overview
Build a sample app from start to finish in Optimizely Connect Platform (OCP).
Build a sample app in Optimizely Connect Platform (OCP) that lets customers synchronize data from an Azure storage account to Optimizely Data Platform (ODP).
You will learn how to:
- register and scaffold an app
- add objects and fields to ODP schema
- build a setting form that allows authentication in a third-party service (in this case, an Azure storage account)
- build a function that listens to events from an Azure storage account and imports new data to ODP
- build a job that periodically imports data from an Azure storage account to ODP
- test and troubleshoot your app in a sandbox environment
- publish your app to the ODP App Directory
Note
The full source code of this sample app is available in the ocp-quickstart GitHub repository.
App considerations
Any customers using this app should have a third-party system that can send data to an Azure storage account. For simplicity, this quickstart guide assumes that the data format is fixed and defined by the app.
Note
Typically, the app needs to handle the data format defined by a third-party service.
App description
Ecommerce clients have successfully integrated their online stores with ODP. However, some also have offline stores that they want to integrate. These clients push their offline store data and order information to an Azure storage account.
This quickstart guide shows how to write an OCP app that pulls this data from Azure and writes it to ODP.
Orders are pushed individually as JSON files that contain the following details for order, customer, and offline store:
order_id
– stringprice_total
– numbercustomer_email
– stringcustomer_clubcard_id
– stringcustomer_clubcard_creation_date
– timestampoffline_store_id
– stringitems
- an array of order items, where each item contains:product_id
– stringquantity
– numberprice
– numbersubtotal
– numberdiscount
– number
Offline stores are kept in a single JSONL file that is updated throughout the day:
id
– stringname
– stringlocation
– string
Prerequisites
- Configure the OCP CLI.
- An Azure account. If you want a free trial account, see Azure's page on creating a free account.
- A sandbox ODP account to test your app. Use the same request forms listed in the Request an OCP developer account section.
- Configure resources in Azure.
- Get information from your Azure account so you can test your app.
Configure resources in Azure
Configure the following resources in Azure:
- An Azure resource group and storage account. Standard performance and local redundancy are sufficient, and other default settings are okay.
- Two containers in your Azure storage account; one for offline store data and one for offline orders data. Select the
private container
option for both. - Register the Event Grid resource provider for your subscription.
- An app registration in Azure (Azure app) to access Azure resources programatically. Default settings are okay.
- A client secret for the app registration.
Note
Store the secret securely when you create it because you cannot view it again.
- The service principal associated with your app registration must have the following permissions:
Microsoft.EventGrid/eventSubscriptions/read
Microsoft.EventGrid/eventSubscriptions/write
Microsoft.Storage/storageAccounts/blobServices/read
Microsoft.Storage/storageAccounts/blobServices/containers/read
Note
The easiest way is to assign the
EventGrid EventSubscription Contributor
andStorage Blob Data Reader
roles to your service principal at the resource scope. Alternatively, you can assign roles at another scope (such as a storage account or subscription) or create and assign a custom role.
Get information from your Azure account
After you configure everything in Azure, you need the following information from your Azure account to test your app:
- Azure client ID –
Application (client) ID
field of your Azure app registration. - Azure tenant ID – Find your Entra ID Formerly Azure AD) tenant or
Directory (tenant) ID
of your Azure app registration. - Azure client secret – The secret you created for your Azure app registration.
- Azure Subscription Id – Find your Azure subscription.
- Azure resource group
- Azure storage account name
- Azure storage container name
Your next step is to initialize the app and define its schema.
Updated 7 months ago