Setup edge hub input for azure stream analytics using the azure cli or python SDK
I am trying to create an azure stream analytics job using azure cli or python SDK with both input and output as edge hub. I tried using None and GatewayMessageBus as the input types but both of them did not work. It gives an error message: (BadRequest) The JSON provided in the request body is invalid. The required property 'datasource type' is missing from the request.
Below is the example using azure cli:
az stream-analytics input create --properties "{"type":"Stream","datasource":{"type":"GatewayMessageBus","properties":{}},"serialization":{"type":"Json","properties":{"encoding":"UTF8"}}}" --input-name "input7425" --job-name "analytics123" --resource-group "edge-analytics"
Command group 'stream-analytics' is experimental and under development. Reference and support levels: https://aka.ms/CLI_refstatus
(BadRequest) The JSON provided in the request body is invalid. The required property 'datasource type' is missing from the request.
Code: BadRequest
Message: The JSON provided in the request body is invalid. The required property 'datasource type' is missing from the request.
(my-new-environment) rnekkanti@Rajivs-MBP ~ % az stream-analytics input create --properties "{"type":"Stream","datasource":{"type":None,"properties":{}},"serialization":{"type":"Json","properties":{"encoding":"UTF8"}}}" --input-name "input7425" --job-name "analytics123" --resource-group "edge-analytics"
Command group 'stream-analytics' is experimental and under development. Reference and support levels: https://aka.ms/CLI_refstatus
(BadRequest) The JSON provided in the request body is invalid. The required property 'datasource type' is missing from the request.
Code: BadRequest
Message: The JSON provided in the request body is invalid. The required property 'datasource type' is missing from the request.
I also tried using the python sdk and it gives the same error message:
client.inputs.create_or_replace(resource_group_name, job_name123, input_name="input7970", input={
"properties": {
"compression": {
"type": "None"
},
"datasource": {
"properties": {},
"type": None
},
"serialization": {
"encoding": "UTF8",
"format": None,
"type": "Json"
},
"type": "Stream"
}
},
)
client.inputs.create_or_replace(resource_group_name, job_name123, input_name="input7970", input={
"properties": {
"datasource": {"properties": {"topic": "EdgeTopic1"}, "type": "GatewayMessageBus"},
"type": "Stream",
}
},
)
Getting the error message: azure.core.exceptions.HttpResponseError: (BadRequest) The JSON provided in the request body is invalid. The required property 'datasource type' is missing from the request.
Code: BadRequest
Message: The JSON provided in the request body is invalid. The required property 'datasource type' is missing from the request.
I tried using the azure python sdk sample and it did not work:
What is the issue here ?