Web job to read from csv in azure storage blob


  • Hi

    I have a console job which does two things 

    1) run SPO power-shell  script  in c# console job, writes the output to csv

    2) c# reads from file and writes to sharepoint online

    I have packaged this as azure web job and deployed to azure portal, Now i get errors first it is not able to write to csv file 

    second steps also fails

    So i am trying to add a csv file to azure storage blob type ( which can delete existing file and write new one everytime, so powershell can write to blob storage, then c# need to read from this storage. 

    Is there any better approach then this or if this is fine can some you help me with example how to read /write from blob and where to save the file.


    • Moved by Md Shihab Monday, May 8, 2017 2:21 AM Better suited to Sharepoint
    Tuesday, April 25, 2017 5:44 AM

All replies

    1. Can you share the error message or error code?
    2. Are you referring to any documents?

    How to use Azure blob storage with the WebJobs SDK

    Get started with Azure Blob storage using .NET/C#

    You could try this PowerShell script explained here: How to add a csv file or Uploading a file to Azure Blob Storage

    Additional information: You can store the CSV using Azure Blob Storage. By ensuring the container has the correct permissions, you can then obtain the link directly to the blob and send to the user. In addition, you can use SASUrls to limit the duration of URL validity.

    Export to Azure Blob Storage

    Thursday, April 27, 2017 5:18 PM
  • I used the PSObject which was return by invoker function in PS in C#  and used that to populate the data. So i did not had to use the blob storage.

    But there is another problem when i run the script on my local it runs fine, but the same code when runs in web job it breaks.


    [05/02/2017 04:16:51 > abb3f6: INFO] Powershell execution start
    [05/02/2017 04:17:58 > abb3f6: ERR ] 
    [05/02/2017 04:17:58 > abb3f6: ERR ] Unhandled Exception: System.Management.Automation.CommandNotFoundException: The term 'Connect-SPOService' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    [05/02/2017 04:17:58 > abb3f6: ERR ]    at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
    [05/02/2017 04:17:58 > abb3f6: ERR ]    at System.Management.Automation.RunspaceInvoke.Invoke(String script, IEnumerable input)

    Thanks for your help
    Tuesday, May 2, 2017 11:52 AM