Introduction: This document describes how to access Azure blob storage via APIs from CPI/ PO/PI, including steps required at Azure side to give access to an external system like CPI.
Let’s set up Azure blob storage first.
Make sure that you have proper resource group assigned to your user id and storage account created under that resource group on Azure Portal.
Copy SAS url
https://<storageAccount>.blob.core.windows.net/cpiblob?st=2023-11-16T04:31:42Z&se=2023-11-16T12:31:42Z&si=PolicyforCPIblob&sv=2022-11-02&sr=c&sig=2mfvSkWmlqL4dxgfsdnsdlAB9%2FtS0gCwBUtEaRmaL9YP8AA%3D
Copy SAS Token to use in CPI Azure Storage Adapter
st=2023-11-16T04:31:42Z&se=2023-11-16T12:31:42Z&si=PolicyforCPIblob&sv=2022-11-02&sr=c&sig=2mfvSkWmlqL4dxgfsdnsdlAB9%2FtS0gCwBUtEaRmaL9YP8AA%3D
If you want to access blob storage using http adapter of SAP PO/PI/ CPI or any testing tool, then here you go
Now we have URL to access that container.
Let’s divide the URL into 3 parts
Part1- https://<storageAccount>.blob.core.windows.net/<ContainerName>?st=2023-11-16T04:31:42Z&se=2023-11-16T12:31:42Z&si=PolicyforCPIblob&sv=2022-11-02&sr=c&sig=2mfvSkWmlqL4dxgfsdnsdlAB9%2FtS0gCwBUtEaRmaL9YP8AA%3D Part3- https://<storageAccount>.blob.core.windows.net/<ContainerName>?st=2023-11-16T04:31:42Z&se=2023-11-16T12:31:42Z&si=PolicyforCPIblob&sv=2022-11-02&sr=c&sig=2mfvSkWmlqL4dxgfsdnsdlAB9%2FtS0gCwBUtEaRmaL9YP8AA%3D Part2- as per below table
Activity | Azure Blob Permission (in access policy) | http Operation | Header | Part2 |
Read the file names from storage | List | Get | ?restype=container&comp=list& | |
Read file from storage | Read | Get | /<FileName with extension>? | |
Create File | Create | Put | x-ms-blob-type=blockblob | /<FileName with extension>? |
Append File | Add | Put | x-ms-blob-type=appendblob | /<FileName with extension>?comp=appendblock |
Delete File | Delete | Delete | x-ms-blob-type=blockblob | /<FileName with extension>? |
Overwrite file | Write | Put | x-ms-blob-type=blockblob | /<FileName with extension>? |
***Append file option is not available with older version of blob
let’s take an example, if we need to create a file with name test.txt in the blob using http api,
Then…
Part1- https: //<storageAccount>.blob.core.windows.net/<ContainerName>
Here we are using container cpiblob
Part2- /<FileName with extension>?
Here we are using filename test.txt
Part3- st=2023-11-16T04:31:42Z&se=2023-11-16T12:31:42Z&si=PolicyforCPIblob&sv=2022-11-02&sr=c&sig=2mfvSkWmlqL4dxgfsdnsdlAB9%2FtS0gCwBUtEaRmaL9YP8AA%3D
So, complete URL is
https: //<storageAccount>.blob.core.windows.net/cpiblob/test.txt? st=2023-11-16T04:31:42Z&se=2023-11-16T12:31:42Z&si=PolicyforCPIblob&sv=2022-11-02&sr=c&sig=2mfvSkWmlqL4dxgfsdnsdlAB9%2FtS0gCwBUtEaRmaL9YP8AA%3D
Above URL can be used in any receiver http or rest adapter to create a file in blob storage.
Let’s create an iflow in CPI to write a file into blob using Azure Storage Adapter.
Create an iFlow where message will come over http protocol with header “FileName”, iflow will read payload and name of the file from FileName header and write the file in blob storage with the same name and data.
Conclusion: This document explains setting at Azure side for blob access via API and how to use Azure storage adapter in CPI.