In many real-world scenarios, businesses need to automatically generate SSRS reports from Dynamics 365 Finance & Operations (D365FO) and store them externally for auditing, sharing, or integration purposes. This blog walks you through how to execute an SSRS report with parameters, convert it into a PDF byte stream, and upload the output to Azure Blob Storage using X++ and the latest Azure SDK.
In this article, we'll walk through how to:
-
Execute a parameterised SSRS report using X++
-
Render the report as a PDF byte stream
-
Upload the output to Azure Blob Storage using the latest Azure SDK (
Azure.Storage.Blobs
)
✅ Why Use This?
Uploading reports to Azure Blob Storage allows you to:
-
Automate report delivery
-
Store large reports securely
-
Integrate with Power BI, Logic Apps, or third-party APIs
-
Replace manual downloads or email-based report distribution
-
Create a controller class to run the SSRS report with parameters.
-
Create an Azure Storage Account in your Azure subscription.
-
Create Blob containers and optional folders to organise your report files.
-
Get the connection string from Azure to authenticate from X++.
-
Render the SSRS report to a byte stream in PDF format.
-
Upload the stream to Azure Blob Storage using Azure.Storage.Blobs
.
Create a controller class to run the SSRS report with parameters.
Create an Azure Storage Account in your Azure subscription.
Create Blob containers and optional folders to organise your report files.
Get the connection string from Azure to authenticate from X++.
Render the SSRS report to a byte stream in PDF format.
Upload the stream to Azure Blob Storage using Azure.Storage.Blobs
.
🛠 Prerequisites
- Add references to these .NET assemblies:
Azure.Storage.Blobs
System.IO
Ensure your storage account connection string and container are correctly configured.
- Add references to these .NET assemblies:
Azure.Storage.Blobs
System.IO
Ensure your storage account connection string and container are correctly configured.
🌐 How to Set Up Azure Storage for Report Uploads
Follow these steps in the Azure Portal to create the required storage setup:
🔹 Step 1: Log in
Visit https://portal.azure.com and sign in with your Azure credentials.
🔹 Step 2: Create Storage Account
-
Navigate to Storage accounts
-
Click + Create
-
Fill in details: Subscription, Resource Group, Name, Region
-
Choose Standard performance and Hot access tier (default)
🔹 Step 3: Create Blob Container
-
Once the storage account is created, go to it
-
Select Storage browser from the left menu
-
Click on Blob containers
-
Create a new container (e.g.,
reportupload
)-
Set access level to
Private
(recommended for security)
-
🔹 Step 4: (Optional) Create Folders
-
Open your container
-
Click + Add directory to create folders like
ReportUpload
🔹 Step 5: Get the Connection String
-
Go to the Access keys section under Security + networking
-
Copy the Connection string of key1
-
Example format:
🔄 What's Changed?
The legacy WindowsAzure.Storage
package is deprecated. The new library:
-
Uses
Azure.Storage.Blobs
. -
Has updated method names and authentication mechanisms.
-
It is available via NuGet:
Azure.Storage.Blobs
public static void main(Args _args)
ExampleUploadReportToBlobStorage uploadObj = new ExampleUploadReportToBlobStorage();
uploadObj.uploadFileToBlob(containerClient);
}
str connectionString =
System.Byte[] reportBytes = ExampleUploadReportToBlobStorage::getSSRSBytes("ReportOutput");
str blobPath = "ReportUpload/UploadFile.pdf"; // folder + filename
BlobClient blobClient = containerClient.GetBlobClient(blobPath);
}
SrsReportRunController controller = new SrsReportRunController();
ReportParametersDataContract contract = controller.parmReportContract().parmRdpContract() as ReportParametersDataContract;
settings = controller.parmReportContract().parmPrintSettings();
settings.printMediumType(SRSPrintMediumType::File);
srsService.preRunReport(controller.parmReportContract());
Microsoft.Dynamics.AX.Framework.Reporting.Shared.ReportingService.ParameterValue[] paramArray =
controller.parmReportContract().parmReportPath(),
paramArray,
settings.fileFormat(),
settings.deviceinfo());
}
🔐 Security Tips
-
Avoid hardcoding the connection string in production. Use Key Vault or Azure App Configuration.
-
Always restrict access to the container using RBAC or SAS tokens instead of full account keys.
Set your Blob container access level to Private unless you explicitly need public access.
-
Use Shared Access Signatures (SAS) or Managed Identities in production scenarios.
📌 Business Use Cases
This solution is ideal for:
-
Automatically exporting and archiving daily/weekly/monthly reports
-
Sharing output with external systems or teams via Azure Storage
-
Generating custom reports on demand and storing them securely in the cloud
✅ Summary
In this post, we’ve seen how to:
✔️ Execute an SSRS report with parameters using X++
✔️ Render it as a PDF and convert it into a byte stream
✔️ Upload the output to Azure Blob Storage securely using the latest Azure SDK
This approach enables automated, scalable, and secure report storage in the cloud, perfect for compliance, integrations, and downstream analytics.