Microsoft Certified: Azure Developer Associate (AZ-204)Connect to and consume Azure services and third-party servicesHard

A company is integrating a legacy on-premises application with a new Azure-based microservices architecture. The on-premises application can only communicate via HTTP/HTTPS and needs to reliably send messages to a specific Azure Service Bus topic. The messages must be processed by multiple microservices, each subscribing to different filters on the topic. Which Azure API Management policy should be used to ensure the messages are correctly routed to the Service Bus topic with the necessary headers, while also ensuring secure communication?

  1. AAuthentication policy with Basic authentication
  2. BInbound policy with 'rewrite-uri' and 'set-body' to an Event Hub
  3. CInbound policy with 'send-request' to a Service Bus queue
  4. DOutbound policy with 'set-header' and 'send-one-way-request' to a Service Bus topic
Show answer & explanation

Correct answer: D. Outbound policy with 'set-header' and 'send-one-way-request' to a Service Bus topic

To send a message from API Management to a Service Bus topic reliably, an outbound policy is needed. The 'send-one-way-request' policy is ideal for fire-and-forget scenarios like sending to a Service Bus topic, while 'set-header' can add necessary Service Bus specific headers. This ensures the message is routed to the topic for multiple subscribers.

Why the other options are wrong

  • A. Authentication policies are for securing access to the API Management gateway, not for sending messages to backend services like Service Bus.
  • B. 'rewrite-uri' and 'set-body' are typically for modifying the request to an API endpoint, not for sending to a messaging service like Event Hubs, and the requirement is for Service Bus topic, not Event Hubs.
  • C. Sending to a Service Bus queue would only allow a single receiver, not multiple subscribers to a topic, and 'send-request' implies waiting for a response, which isn't typical for Service Bus messaging.

API Management 'send-one-way-request' Policy

An Azure API Management outbound policy used to send a fire-and-forget request to a specified URL, typically for asynchronous operations like sending messages to a queue or topic.

  • Does not wait for a response from the backend.
  • Ideal for integrating with messaging services like Azure Service Bus.
  • Can be combined with 'set-header' to add message properties.

Memory trick: APIM acts as a 'smart post office' for your messages, deciding where and how they go.

More Connect to and consume Azure services and third-party services questions