Export to Azure Blob (via SIC)
- 7 months ago
Hello,
have you considered using SFTP enabled access to the Azure BS? If you access to the BS via the public internet, you don't need SIC with this approach. The client must enable SFTP access for the blob storage and you can upload files using the WinSCP .net methods as you would do with any SFTP Server. if you require private network access, you need SIC but you don't need to use SIC BR as you can connect using the OneStream bound port from an Extender BR or Assembly BR (it's documented in SIC guide).
Inb my experience, if SFTP access for the Blob Storage is an option for your client, it simplifies a lot the integration architecture.
- 7 months ago
franciscoamores - Appreciated. I get it about SIC for Database and it is working without any issues and same as API call because it does not require any DLL. I am having issues with the Azure BLOB as SFTP. Below is my code and I am getting an error. Not sure what I am doing wrong. Any Help would be appreciated.
SIC Rule Public Shared Function RunOperation() As Byte() Dim sftpHost As String = "localhost" ' Replace with your SFTP server address Dim sftpPort As Integer = "20541" Dim sftpUsername As String = "user" ' Replace with your SFTP username Dim sftpPassword As String = "pass" ' Replace with your SFTP password Dim remoteFilePath As String = "path" Dim fileBuffer As Byte() Dim tempFilePath As String = Path.GetTempFileName() ' Setup session options Dim sessionOptions As New SessionOptions With sessionOptions .Protocol = Protocol.Sftp .HostName = sftpHost .PortNumber = sftpPort .UserName = sftpUsername .Password = sftpPassword End With Using session As New Session() ' Connect to the SFTP server session.Open(sessionOptions) ' Setup transfer options Dim transferOptions As New TransferOptions With { .TransferMode = TransferMode.Binary } ' Download the file to a temporary file session.GetFiles(remoteFilePath, tempFilePath, False, Nothing) ' Read the temporary file into a memory buffer fileBuffer = File.ReadAllBytes(tempFilePath) ' Delete the temporary file File.Delete(tempFilePath) ' Disconnect from the SFTP server session.Close() End Using Return fileBuffer End Function
Extender Rule
Dim objGatewayDetails As GatewayDetails = BRApi.Utilities.GetGatewayConnectionInfo(si,"azureblob") ' Setup the objects to read Gateway Details from BRAPIs Dim objRemoteRequestResultDto As RemoteRequestResultDto =BRApi.Utilities.ExecRemoteGatewayBusinessRule(si, "AzureBlobSFTP", Nothing, objGatewayDetails.GatewayName,"RunOperation","AzureBlobSFTP", True, 600) If (objRemoteRequestResultDto.RemoteResultStatus = RemoteMessageResultType.Success) Then Dim bytesFromFile As Byte() bytesFromFile = objRemoteRequestResultDto.ObjectResultValue Dim groupFolderPath As String = BRAPi.Utilities.GetFileShareFolder(si,FileShareFolderTypes.BatchHarvest, api) Using sw As StreamWriter = New StreamWriter(groupFolderPath &"\Azurefile.csv") sw.Write(bytesFromFile) sw.Close() End Using Else brapi.ErrorLog.LogMessage(si, "No data received.") End If
Error
Summary: Smart Integration Connector Gateway general error at: 'azureblob CompileCacheAndRunRemoteFunction ID: 893621a2-f32a-49a9-872a-2d2b7fe227cb'. SendRelayRequest.