I have a stream analytics job which uses a number of javascript UDFs and UDAs. I would like to be able to deploy this using an Azure resource manager template.
The documentation at https://learn.microsoft.com/en-us/rest/api/streamanalytics/stream-analytics-function seems rather outdated and only describes Scalar
functions, which I assume means UDFs.
Are there any documentation or examples showing how to create UDAs using an ARM template?
For UDAs you should use "type":"Aggregate" in your Functions section of the template. Example below.
{
"properties": {
"type": "Aggregate", //Aggregate type.
"properties": {
"inputs": [ // accumulate input parameter(s).
{
"dataType": "any", // Input data type
}
],
"output": { // Output
"dataType": "any" // Output data type
},
"binding": {
"type": "Microsoft.StreamAnalytics/JavascriptUdf",
"properties": { // Aggregate definition
"script": "function main() {
this.init = function () {
this.state = 0;
}
this.accumulate = function (value, timestamp) {
this.state += value;
}
this.computeResult = function () {
return this.state;
}
}"
}
}
}
}
}
Microsoft docs reference: https://learn.microsoft.com/en-us/rest/api/streamanalytics/stream-analytics-aggregate