I'm a Sr Content Dev working on expanding the IoT Hub routing tutorial (https://docs.microsoft.com/en-us/azure/iot-hub/tutorial-routing) to add ARM templates, and to add routing setup scripts in PowerShell and CLI (and ARM). Everything works except CLI.
When setting up the routing endpoint using CLI for the service bus queue, it fails.
az iot hub routing-endpoint create \
--connection-string $sbqConnectionString \
--endpoint-name $endpointName \
--endpoint-resource-group $resourceGroup \
--endpoint-subscription-id $subscriptionID \
--endpoint-type $endpointType \
--hub-name $iotHubName \
--resource-group $resourceGroup
Here's the error:
ConnectionString is invalid, endpointName:sbqueueEP, exceptionMessage:The Queue connection string is missing 'Endpoint'. If you contact a support representative please include this correlation identifier: 5858003f-e3e0-41b9-a829-37c837e91f21, timestamp: 2009-0219-18:33:352, errorcode:IH400116.
I echoed the connection string out to the screen, and it is correct, and starts with "Endpoint=", so the connection string is definitely NOT missing the word "endpoint" as stated in the error message. I have a screenshot if you want to see it.
Sapan Saxena said this works for him today. It didn't work for me on Friday 2/15, it didn't work this morning (2/19), and it still doesn't work this afternoon.
This is related to GH issue 8578 about setting up and endpoint using CLI for a storage account. Different error, though.
If you want the whole CLI script, ping me (internally).
Thx,
Robin
The awesome @v-Ajnava has mucked around with this and found that the problem is that when you retrieve the connection string, it is returned with double-quotes around it. Then when you turn around and send it into this cmdlet, it fails. If you change the double quotes to single quotes, it works. It would be nice if that cmdlet would accept connection string in double quotes. Is that something that can be changed, or do I have to figure out how to do string manipulation in CLI to change them to single quotes?
/cc: @ash2017
What command are you using to get the connection string?
@tjprescott command used to get the connection string :
sbqConnectionString=$(az servicebus queue authorization-rule keys list --name "sbauthrule1" --namespace-name "ContosoSBNamespace13571" --queue-name "ContosoSBQueue13571" --resource-group v-ajnavtest --subscription "subid" --query primaryConnectionString)
echo "service bus queue connection string = " $sbqConnectionString
o/p :
service bus queue connection string = "Endpoint=sb://contososbnamespace13571.servicebus.windows.net/;SharedAccessKeyName=sbauthrule1;SharedAccessKey=****;EntityPath=ContosoSBQueue13571"
• az iot hub routing-endpoint create --connection-string $sbqConnectionString --endpoint-name $endpointName --endpoint-resource-group $resourceGroup --endpoint-subscription-id $subscriptionID --endpoint-type $endpointType --hub-name $iotHubName --resource-group $resourceGroup
• Error: BadRequest
Response content:
msrest.http_logger : {"code":400116,"httpStatusCode":"BadRequest","message":"ConnectionString is invalid, endpointName:sbqueueEP1, exceptionMessage:The Queue connection string is missing 'Endpoint'. If you contact a support representative please include this correlation identifier: 0bcbd277-8b5a-476a-829e-fd91071fe9b6, timestamp: 2019-02-20 05:03:42Z, errorcode: IH400116."}
msrest.exceptions : ConnectionString is invalid, endpointName:sbqueueEP1, exceptionMessage:The Queue connection string is missing 'Endpoint'. If you contact a support representative please include this correlation identifier: 0bcbd277-8b5a-476a-829e-fd91071fe9b6, timestamp: 2019-02-20 05:03:42Z, errorcode: IH400116.
ConnectionString is invalid, endpointName:sbqueueEP1, exceptionMessage:The Queue connection string is missing 'Endpoint'. If you contact a support representative please include this correlation identifier: 0bcbd277-8b5a-476a-829e-fd91071fe9b6, timestamp: 2019-02-20 05:03:42Z, errorcode: IH400116.
Hi @v-Ajnava try adding -o tsv to that command, which should strip the quotes and is intended for scripting purposes.
sbqConnectionString=$(az servicebus queue authorization-rule keys list --name "sbauthrule1" --namespace-name "ContosoSBNamespace13571" --queue-name "ContosoSBQueue13571" --resource-group v-ajnavtest --subscription "subid" --query primaryConnectionString -o tsv)
@tjprescott it worked ! Thanks !
Glad to hear it @v-Ajnava! You may find this document generally useful:
https://github.com/Azure/azure-cli/blob/dev/doc/use_cli_effectively.md
cc/ @robinsh
I will now close this issue.
hey @tjprescott Thanks so much for your help. I'm looking forward to finishing these articles, and CLI was the only one I couldn't get to work.
What does "-o tsv" mean? it is output and tab-separated-values? I'm going to put it in an article, and if I don't say something about it, someone will ask.
Thx.
Hi @robinsh you are exactly right on the meaning.
@tjprescott Thanks much. I'll put it in the docs, which will save someone from asking the question!