HTTPS endpoint of Azure event hub - azure

I am using service that can only send messages using webhook. The only thing I can set up in that webhook are HTTP endpoint, user name and password (you can see it on the screenshot below). I would like to send messages to my event hub, but I don't know how to find its HTTP endpoint. The only thing I could find was SAS Endpoint.

Event Hubs offers a REST API that allows you to perform a subset of the operations supported by its AMQP API. Publishing basic events via REST is possible and would use the endpoint: https://{servicebusNamespace}.servicebus.windows.net/{eventHubPath}/messages.
The full set of documentation for the REST API can be found here, and the specifics for sending events here.

Related

Is there any way to validate events payload schema while using Azure Event Hub API?

I must send events to Azure Event Hub directly using http protocol. How can I validate payload json schema of the event in Azure (same as validating in a web api) before the event ingestion?
Inspection of event payloads and indexing are not within the feature scope of Event Hubs (or Apache Kafka).
See the Note Section here:
https://learn.microsoft.com/en-us/azure/event-hubs/event-hubs-features#event-retention

Adding request-id (or operation-id) to HTTPS request made by a web hook event suscription of an azure event grid topic

I have 2 Web APIs in .NET Core which communicate between themselves sending events to an azure event grid topic. This event grid topic has 2 web hooks event subscriptions (one for each API) that do a HTTPS request to the other API whenever a event is send to the topic.
Also I have an Application Insight for logging and monitoring both APIs. I want to be able to relate the logs of both APIs. I know that this is done out of the box for HTTP requests between both APIs using a Request-Id header. Is it possible to add such thing in the web hooks?
Or if not, is it possible to implement a custom middleware or filter to handle this?

Can I use a custom hostname for Azure Event grid Topic

I have an Azure Event Grid topic:
https://xxx.westeurope-1.eventgrid.azure.net/api/events
Is there any way to direct clients to publish events to https://xxx.mydomain.com/api/events without getting certificate validation errors, etc.?
It would appear, after researching further documentation and speaking to Microsoft that this is currently not possible. If you create a CNAME entry in your own DNS to point to the Azure fqdn of the endpoint, certificate errors are (understandably) generated.
You could use some type of API gateway to accomplish this. The gateway would have your desired domain name and route for the public to submit requests. A service
behind the gateway would forward the request to the event topic's endpoint.
Another option, but based on the same idea mentioned above, would be to use Azure Functions. The function becomes the gateway and the client publishes to the function's endpoint. Code within the Azure Function bundles the request and forwards it to the event topic.
I'm currently using the Functions approach. My function accepts a generic JSON body, validates a few things, packages it up so it has everything the event topic needs (access keys, headers, correct properties for the event schema, etc), and sends it off to the event topic endpoint. If everything works, I send the client a 200 HTTP status from the Azure Function. If there's a problem, I send a 400 or 500 series status as appropriate.

How to make an Approval step in Azure Logic app calling my own APIs similar to office365 approval connector?

I wanna build a small workflow using Azure Logic Apps that contains an "Approval" step, which is simply an API call in my own system, similar to office 365 approval connector.
However, from what I found on the internet, the only way to make a long running task in Azure Logic Apps is to use Webhooks.
In Webhooks, I could not set a value to the parameter I created "Bool-Approved".. so, How can I check it later in a condition step?
The other possible solution maybe is to use Swagger to have an "Bool-Approved" parameter. However, it does not support long running action!
What's the possible solution for me?
As you mentioned, the way to do it is to use the Webhook action, and for that you need to implement the Subscribe/Unsubscribe pattern described here. The webhook action will allow you to get any payload (via an HTTP Post) from the instance-based webhook you are subscribing to.
The points below are a summary of this blog post:
https://www.mexia.com.au/correlation-identifier-pattern-on-logic-apps/
To implement the Subscribe/Unsubscribe Webhook pattern you need to consider:
Subscription store: A database to store the unique message Id and the
instance-based callback URL provided by the webhook action.
Subscribe and Start Request Processing API: this is a RESTful API that is in charge of starting the processing of the request and storing the
subscription.
Unsubscribe and Stop Request Processing API: this is another RESTful API that is only going to be called if the webhook action on the main workflow times out. This API is in charge of stopping the processing and deleting the subscription from the store.
Instance-based webhook: this webhook is to be triggered by your own custom approval event. Once triggered, your webhook is in charge of getting the instance-based callback URL from the store and invoking it. After making the call back to the main workflow instance, the subscription is to be deleted. This is the webhook that is in charge of sending the payload you require to the waiting webhook action in your Logic App.
The subsequent actions will be able to use that response body, so you can implement your conditions, etc.
You can follow the blog post mentioned above to see a detailed example and get more details on how to implement it.
make you api return HTTP code 200 if the response if "ok" and 400 if the response is "not ok". This way you can force logic app to behave the way you need it to behave..

Send IoT Message to Azure Event Hub by URL

I am now using a Beacon Reveiver to get the iBeacon Information.
Here is the problem:
the receiver platform server only allow me to type a url.
How should I do to send the information to azure eventhub??
I found this API:
https://NAMESPACE.servicebus.windows.net/EVENTHUB-NAME/publishers/PUBLISHER-NAME/messages
I tried it ,but it seems doesn't work.
Do i miss anything?? or Can anyone teach me how to add the authentication in url? What should I do now?
Thanks
You must set an authentication HTTP header in order to send events to Event Hubs. You can't include authentication information in the request URL.
Even though you can't send messages directly to Event Hubs, you can develop a custom Web API that uses your own URL-based authentication mechanism and forwards the requests to Event Hubs (or another service). That defeats the purpose of using Event Hubs to some degree but gives you more flexibility.

Resources