question

juucustodio avatar image
juucustodio asked ·

Event Hub Connection String Error using ARM template

I am working with ARM template and I have one Event Hub and I need connect to many Logic Apps. For this i use the API Connection. (Example image below)
9711-estrutura.png

In the Api Connection (eventhubs) when I not set connection string in the ARM template. The API Connection status is "Error".

Then I set the Connection String from my Event Hub in API Connection, then the Api Connection status is "Connected". (Ok here, I thinked tha my problem was solved) But not... When a i run one Logic App i received one message that my Connection String is invalid.


I set the Connection String from my Event Hub in my ARM template of API Connection like the example below:
(The complete code is in: https://gist.github.com/juucustodio/4a17efea4f0c60c7e1cf64892dd1f54f ).
9721-connection-string-get.png

I checked that my connection string was ok. And yes, it is right. I also tried to use type how "String" and after how "Custom". Both not work.

The problem is: When I get the Connection String from Event Hub using the Azure Portal and in the Azure Portal I set the connection in my Api Connection, my Logic Apps work. But not work using ARM template.

I try get from portal and past my connection string directly in my ARM template (just to test). Like the image below.
9722-connection-string-direta.png

And again not work in ARM template, just that i past this Connection String using the portal. (equivalent to the example shown in the image below)
9731-edit-api.png

Has anyone experienced this type of problem?

azure-logic-appsazure-event-hubs
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

juucustodio avatar image
juucustodio answered ·

I found the solution to this problem.

I change my ARM template.

Before:

 "parameterValues": {    
     "connectionString": {
         "type": "string",
         "value": "[listKeys(resourceId(concat('Microsoft.EventHub/namespaces/',parameters('resourceType'),'/authorizationRules'),variables('namespaceName'),parameters('resourceName'),parameters('policy')),'2015-08-01').primaryConnectionString]"
    }

}

After:

 "parameterValues": {
     "connectionString": "[listKeys(resourceId(concat('Microsoft.EventHub/namespaces/',parameters('resourceType'),'/authorizationRules'),variables('namespaceName'),parameters('resourceName'),parameters('policy')),'2015-08-01').primaryConnectionString]"
  }

Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.