Data Directive to write report to Azure File Share

Hi All,

Wondering if anyone has had any success writing an SSRS report to an Azure File Share?

I have tried setting up a Data Directive on SysRptLst that picks up when a report is run, then outputs to a csv file. This is the code;

    int reportStyle = 1001;
    string printProgram = @"Reports/CustomReports/*report name*";

var reports = (from row in ttSysRptLst

          where (row.PrintProgram == printProgram  )                      
                 //&& row.RptNote.Contains(key) )
                 
                
          select row).ToList();
          
    foreach(var report in reports)
    {
    

    
                string SelCompany = callContextClient.CurrentCompany.ToString();
                string SelPlant = callContextClient.CurrentPlant.ToString();
                string FName = SelCompany + SelPlant + "TimePhase" + DateTime.Now.ToString("yyyyMMdd");
                string fileName =  @"\\*azure fileshare name*" + string.Format(@"{0}.csv",FName);                   
                byte[] bytes = ((byte[])report.RptData);

                using(var svc = Ice.Assemblies.ServiceRenderer.GetService<Ice.Contracts.FileTransferSvcContract>(Db))
                {
                      svc.UploadFile(Epicor.ServiceModel.Utilities.SpecialFolder.UserData, FName, bytes);
                      
                }
                
                   
    }

The code seems to work but I am getting an authorization error on the file share. I think I am missing something to do with authenticating to the Azure share. I’m not sure how to do this, anyone done something similar?

1 Like