This blog has three parts
Click here to refer Part 1
Please complete the the basic setups in Azure and Business central mentioned in Part 1.
2. Create a setup page with action button to trigger the code to create Invoice
3. Create a page extension for Document attachment to download the blob file.
4. In the below code snapshot, we are storing the shared access key in an Interface Storage service Authorization and initializing the Azure Blob client to read the source and destination container
5. Get a List of blobs from ABS Container Container Content and create a loop to get the blob from the source container as stream and use PutBlobBlockBlobStream function of the destination blob client to copy the stream file to the destination.
6. Create a function to create a invoice and to get the blob file as stream and attach to the purchase invoice as a document attachment.
7. Create a Purchase Header from line 48 to 51. Get the blob as stream on line71 and import the stream to document attachments and finally delete the blob file from the source in line 77
8. Publish the code.
9. Run the Job action button on the setup page
Original Post https://chrisdsilvablog.wordpress.com/2023/07/17/how-to-attach-a-blob-file-from-azure-to-business-central-document-attachment/