Run Stream Analytic Transformation Query Programmatically using .NET

Viewed 84

I am trying to use .NET to automate the running of Stream Analytic Transformation Query. I've read the documentation of the two framework

Microsoft.Azure.Management.StreamAnalytics

Microsoft.Azure.Management.StreamAnalytics.Models

and also this guide on how to run a Stream Analytic Job using .NET.

They explain how to Create, Run and Stop a Job but what I need is a bit different. In relation to the following picture image

I manually, upload a json file (upload sample Input in the image), Test the query (Test query button in the image) and download the result (button not shown in the image).

I want to do all this steps programmatically using .NET but not sure on what objects I need to use. The following shows how to create a Transformation, in my case I have one and want to run it. (I don't want to run the Job because I do not have authorization to do this in my Azure subscription but have authorization to run the query).

// Create a transformation
Transformation transformation = new Transformation()
{
    Query = "Select Id, Name from <your input name>", // '<your input name>' should be replaced with the value you put for the 'inputName' variable above or in a previous step
    StreamingUnits = 1
};
Transformation createTransformationResult = streamAnalyticsManagementClient.Transformations.CreateOrReplace(transformation, resourceGroupName, streamingJobName, transformationName);

The ITransformationsOperations Interface doesn't have any method to run a tranformation. Is it possible to do it, can anyone help?

1 Answers

To my knowledge the SDK only allows to manage remote resources deployed in a subscription that you own. The query testing experience available through the portal is not part of it, as the backend is an internal service.

If you want to run a query locally and programmatically, you can use the npm package available as part of the CI/CD tooling.

Related