'Azure Stream Analytics Job - Transformation Query - correct formatting in ARM template

When editing a Stream Analytics transformation query in the Portal, you can format it for readability across multiple lines...e.g.

SELECT 
INTO [Output1]
FROM [Input1]
PARTITION BY PartitionId
WHERE etc etc etc

When putting this into an ARM template for CI/CD, this is entered as one massive long string and would end up displaying in the portal as...

SELECT * INTO [Output1] FROM [Input1] PARTITION BY PartitionId WHERE etc etc etc to infinity....

The official documentation is pretty useless and doesn't give any clues for the query part of the template, just that it is a "string"...

https://docs.microsoft.com/en-us/azure/templates/microsoft.streamanalytics/2016-03-01/streamingjobs/transformations

There is a Microsoft sample template that is the only example I could find with a transform query specified... https://github.com/Azure/azure-quickstart-templates/blob/master/101-streamanalytics-create/azuredeploy.json ...and it looks like it is trying to do spacing...

"query": "SELECT\r\n    *\r\nINTO\r\n    [YourOutputAlias]\r\nFROM\r\n    [YourInputAlias]"

...but failing badly - see screenshot

Has anyone managed to do this?

Also does anyone know why you can see the transformation query in the Azure Resource Explorer (https://resources.azure.com/)? Or that it cannot be exported from the portal with the rest of the Stream Job? (done at Resource Group level)

Thanks in advance

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source