Skip to Content
Technical Articles
Author's profile photo Dharam Verma

Steps to access Azure Blob Storage via REST API from SAP CPI using Azure Storage Adapter and SAP PO/PI using http adapter

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.

  • Go inside the resource group then storage account on Azure portal
  • At left side, click on containers.
  • Click on +Container to create container to store blob.


  • Give any name in small case and click on create.
  • Click on created container.


  • Container has no file in it.
  • Click on access policy and the add policy to add stored access policy.
  • Give any name of identifier, select permissions and start/end date then click ok and save it.

  • Now click on Shared Access Token, select stored access policy created earlier from drop down list and click on generate SAS token and URL at bottom.


Copy SAS url



Copy SAS Token to use in CPI Azure Storage Adapter




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><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><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,


Part1-  https: //<storageAccount><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> 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.


  • Create a security material with secure parameter option.


  • Give any proper name and paste SAS token (Copied earlier from Azure Portal) in secure parameter and deploy it.


  • Let’s create a simple iflow without any condition or exception handing because this iflow is getting created just for a POC purpose.
  • Content Modifier to create BlobPath property from incoming Header FileName
  • Content Modifier to delete Header FileName


  • Create connection to receiver with Azure Adapter and Blob Type message protocol.


  • Put Security Material name as Token Alias.


  • Set operation as Upload Block Blob, Put your Storage Acccount Name, Container Name and put property BlobPath in BlobPath.

  • Deploy it


  • Let’s test it from Postman
  1.         Write something in body
  2.         Set FileName Header with Test.txt value
  3. Click on send and you can see file created in blob storage



Conclusion: This document explains setting at Azure side for blob access via API and how to use Azure storage adapter in CPI.



Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.