[{"data":1,"prerenderedAt":359},["ShallowReactive",2],{"articles-azure-native-service-bus-publishing-with-api-management":3},{"id":4,"title":5,"body":6,"date":343,"description":344,"extension":345,"image":346,"imageAuthor":347,"imageLicense":348,"imageSource":349,"meta":350,"navigation":166,"path":351,"published":166,"seo":352,"slug":353,"stem":354,"tags":355,"__hash__":358},"articles\u002Farticles\u002Fazure-native-service-bus-publishing-with-api-management.md","Azure: Native Service Bus Publishing With API Management",{"type":7,"value":8,"toc":334},"minimark",[9,13,16,21,24,27,30,33,37,45,48,51,55,58,61,64,78,250,253,257,260,263,266,270,273,280,287,290,294,297,300,304,330],[10,11,12],"p",{},"For platform engineers and developers working within the Azure ecosystem, the line between synchronous and asynchronous services often requires building extra connective tissue — typically in the form of an Azure Function or a Logic App — just to put a message onto a Service Bus. This adds complexity, cost, and another component to manage.",[10,14,15],{},"That's why the introduction of the native Service Bus message publishing policy in Azure API Management (APIM) is a significant development. This new policy, announced in preview on October 19, 2025, promises to streamline this asynchronous messaging directly into the API gateway.",[17,18,20],"h2",{"id":19},"why-a-native-service-bus-policy","Why A Native Service Bus Policy?",[10,22,23],{},"The primary driver behind this feature is simplification.",[10,25,26],{},"Previously, if you wanted an HTTP-based API call in APIM to trigger an asynchronous backend process, you commonly used a Logic App or Azure Function component to work as a channel adapter. This component's sole job was to take the message, perhaps apply some transformation and publish it to a Service Bus.",[10,28,29],{},"The new policy eliminates the need for this individual entirely. By allowing APIM to publish messages directly to a Service Bus queue or topic, you can decouple your frontend APIs from your backend event consumers with a single policy.",[10,31,32],{},"This reduces usage costs, the number of required components and it consolidates messaging concerns into APIM, all while improving maintainability at the gateway level. This shift further simplifies the topology of integrations on Azure, allowing APIM to serve as a unified gateway for both synchronous and asynchronous communication.",[17,34,36],{"id":35},"what-is-the-native-publishing-policy","What Is The Native Publishing Policy?",[10,38,39,40,44],{},"The built-in policy named ",[41,42,43],"code",{},"\u003Csend-service-bus-message>",", currently in preview, empowers you to configure an APIM operation to send a message to Service Bus as part of its inbound or outbound processing flow.",[10,46,47],{},"The communication is secured using Managed Identities, which is a best practice that removes the need to store Service Bus connection strings as secrets within APIM. You enable a system- or user-assigned managed identity on your APIM instance and grant it the \"Azure Service Bus Data Sender\" role on the target queue or topic. The policy itself is then configured with the details of the Service Bus namespace and the payload you wish to send.",[10,49,50],{},"With this in place, APIM handles the authentication and message publishing natively, reducing what used to be a multi-step, code-driven process into a few lines of declarative XML.",[17,52,54],{"id":53},"how-to-implement-native-service-bus-publishing","How To Implement Native Service Bus Publishing",[10,56,57],{},"The main advice for implementation is to start with a \"fire-and-forget\" mindset. The most powerful use case is to accept an HTTP request, immediately queue it for backend processing, and return a 201 Created or 202 Accepted response to the client.",[10,59,60],{},"This makes the API highly responsive while ensuring the workload is safely queued.",[10,62,63],{},"Implementation is straightforward.",[65,66,67,71],"ol",{},[68,69,70],"li",{},"Ensure your APIM instance has a managed identity enabled and has been granted the Azure Service Bus Data Sender role on the target Service Bus resource.",[68,72,73,74,77],{},"Within your API operation's ",[41,75,76],{},"\u003Cinbound>"," policy, you would add the following:",[79,80,85],"pre",{"className":81,"code":82,"language":83,"meta":84,"style":84},"language-xml shiki shiki-themes github-dark-default","\u003C!--\n  send-service-bus-message Policy XML\n-->\n\u003Cpolicies>\n    \u003Cinbound>\n        \u003Cbase \u002F>\n        \u003Csend-service-bus-message\n            namespace=\"your-namespace.servicebus.windows.net\"\n            queue-name=\"your-queue-name\"\n            ignore-error=\"false\">\n            \u003Cpayload>@(context.Request.Body.As\u003Cstring>(preserveContent: true))\u003C\u002Fpayload>\n        \u003C\u002Fsend-service-bus-message>\n\n        \u003Creturn-response>\n            \u003Cset-status code=\"201\" reason=\"Created\" \u002F>\n            \u003Cset-body>Message queued successfully.\u003C\u002Fset-body>\n        \u003C\u002Freturn-response>\n    \u003C\u002Finbound>\n    \u003Cbackend>\n        \u003C\u002Fbackend>\n    \u003Coutbound>\n        \u003Cbase \u002F>\n    \u003C\u002Foutbound>\n    \u003Con-error>\n        \u003Cbase \u002F>\n    \u003C\u002Fon-error>\n\u003C\u002Fpolicies>\n","xml","",[41,86,87,95,101,107,113,119,125,131,137,143,149,155,161,168,174,180,186,192,198,204,210,216,221,227,233,238,244],{"__ignoreMap":84},[88,89,92],"span",{"class":90,"line":91},"line",1,[88,93,94],{},"\u003C!--\n",[88,96,98],{"class":90,"line":97},2,[88,99,100],{},"  send-service-bus-message Policy XML\n",[88,102,104],{"class":90,"line":103},3,[88,105,106],{},"-->\n",[88,108,110],{"class":90,"line":109},4,[88,111,112],{},"\u003Cpolicies>\n",[88,114,116],{"class":90,"line":115},5,[88,117,118],{},"    \u003Cinbound>\n",[88,120,122],{"class":90,"line":121},6,[88,123,124],{},"        \u003Cbase \u002F>\n",[88,126,128],{"class":90,"line":127},7,[88,129,130],{},"        \u003Csend-service-bus-message\n",[88,132,134],{"class":90,"line":133},8,[88,135,136],{},"            namespace=\"your-namespace.servicebus.windows.net\"\n",[88,138,140],{"class":90,"line":139},9,[88,141,142],{},"            queue-name=\"your-queue-name\"\n",[88,144,146],{"class":90,"line":145},10,[88,147,148],{},"            ignore-error=\"false\">\n",[88,150,152],{"class":90,"line":151},11,[88,153,154],{},"            \u003Cpayload>@(context.Request.Body.As\u003Cstring>(preserveContent: true))\u003C\u002Fpayload>\n",[88,156,158],{"class":90,"line":157},12,[88,159,160],{},"        \u003C\u002Fsend-service-bus-message>\n",[88,162,164],{"class":90,"line":163},13,[88,165,167],{"emptyLinePlaceholder":166},true,"\n",[88,169,171],{"class":90,"line":170},14,[88,172,173],{},"        \u003Creturn-response>\n",[88,175,177],{"class":90,"line":176},15,[88,178,179],{},"            \u003Cset-status code=\"201\" reason=\"Created\" \u002F>\n",[88,181,183],{"class":90,"line":182},16,[88,184,185],{},"            \u003Cset-body>Message queued successfully.\u003C\u002Fset-body>\n",[88,187,189],{"class":90,"line":188},17,[88,190,191],{},"        \u003C\u002Freturn-response>\n",[88,193,195],{"class":90,"line":194},18,[88,196,197],{},"    \u003C\u002Finbound>\n",[88,199,201],{"class":90,"line":200},19,[88,202,203],{},"    \u003Cbackend>\n",[88,205,207],{"class":90,"line":206},20,[88,208,209],{},"        \u003C\u002Fbackend>\n",[88,211,213],{"class":90,"line":212},21,[88,214,215],{},"    \u003Coutbound>\n",[88,217,219],{"class":90,"line":218},22,[88,220,124],{},[88,222,224],{"class":90,"line":223},23,[88,225,226],{},"    \u003C\u002Foutbound>\n",[88,228,230],{"class":90,"line":229},24,[88,231,232],{},"    \u003Con-error>\n",[88,234,236],{"class":90,"line":235},25,[88,237,124],{},[88,239,241],{"class":90,"line":240},26,[88,242,243],{},"    \u003C\u002Fon-error>\n",[88,245,247],{"class":90,"line":246},27,[88,248,249],{},"\u003C\u002Fpolicies>\n",[10,251,252],{},"This configuration captures the incoming request body, sends it to the specified queue, and immediately sends a 201 response to the client, preventing the caller from having to wait for any backend processing.",[17,254,256],{"id":255},"how-this-enhances-cloud-integration","How This Enhances Cloud Integration",[10,258,259],{},"This policy solidifies APIM's role as the central hub for modern cloud integrations. It's no longer just a gateway for synchronous REST or SOAP APIs; it is now also a first-class citizen in an event-driven architecture (EDA). Platform engineers can now design systems where IoT devices, partners, or mobile clients can send data via a standard, secured, and rate-limited HTTP POST, and have that data seamlessly fanned out to multiple microservices via Service Bus topics.",[10,261,262],{},"This capability bridges the gap between the synchronous, request-response integration style and the asynchronous, event-based integration style. It allows developers to build more scalable and resilient systems, as the API gateway can absorb traffic spikes by queuing requests, protecting backend services from being overwhelmed.",[10,264,265],{},"This direct integration simplifies governance, as all communication — whether sync or async — is now managed, secured, and observed from the single pane of glass that APIM provides.",[17,267,269],{"id":268},"when-to-be-cautious","When To Be Cautious",[10,271,272],{},"It is crucial to understand that this policy is purpose-built for one-way message publishing. It is not designed for synchronous request-reply scenarios.",[10,274,275,276,279],{},"If your client sends a request and needs to wait for a specific response generated by the backend consumer of that message, this policy is not the right tool. In that scenario, you would still use a traditional ",[41,277,278],{},"\u003Cforward-request>"," to a backend that can perform the work and return a synchronous response.",[10,281,282,283,286],{},"The ",[41,284,285],{},"send-service-bus-message"," policy is for \"fire-and-forget\" patterns. The client's request is acknowledged, but the client does not receive a response from the eventual processor.",[10,288,289],{},"Using it for the wrong pattern will lead to a disconnected client and an architecture that doesn't meet its requirements.",[17,291,293],{"id":292},"get-started-and-share-your-thoughts","Get Started And Share Your Thoughts",[10,295,296],{},"The new native Service Bus publishing policy in Azure API Management is a powerful tool for simplifying event-driven setups. It reduces complexity, lowers operational overhead, and empowers developers and platform engineers to build more resilient, decoupled systems.",[10,298,299],{},"What are your thoughts? How do you see this new policy changing your implementation patterns on Azure?",[17,301,303],{"id":302},"links","Links",[305,306,307,316,323],"ul",{},[68,308,309],{},[310,311,315],"a",{"href":312,"rel":313},"https:\u002F\u002Ftechcommunity.microsoft.com\u002Fblog\u002Fintegrationsonazureblog\u002Fintroducing-native-service-bus-message-publishing-from-azure-api-management-prev\u002F4462644",[314],"nofollow","Introducing native Service Bus message publishing from Azure API Management (preview)",[68,317,318],{},[310,319,322],{"href":320,"rel":321},"https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fazure\u002Fapi-management\u002Fsend-service-bus-message-policy",[314],"Send Service Bus message policy — Microsoft Learn",[68,324,325],{},[310,326,329],{"href":327,"rel":328},"https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fazure\u002Fapi-management\u002Fapi-management-howto-send-service-bus",[314],"How to send a message to a Service Bus queue or topic — Microsoft Learn",[331,332,333],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":84,"searchDepth":97,"depth":97,"links":335},[336,337,338,339,340,341,342],{"id":19,"depth":97,"text":20},{"id":35,"depth":97,"text":36},{"id":53,"depth":97,"text":54},{"id":255,"depth":97,"text":256},{"id":268,"depth":97,"text":269},{"id":292,"depth":97,"text":293},{"id":302,"depth":97,"text":303},"2025-10-30","Azure API Management can now publish directly to Service Bus with a native policy, cutting the Function or Logic App you used to need just to bridge sync and async traffic.","md","\u002Farticles\u002Fazure-native-service-bus-publishing-with-api-management\u002Fcover.png","André Karwath aka Aka","CC BY-SA 2.5","https:\u002F\u002Fcommons.wikimedia.org\u002Fwiki\u002FFile:Lightning_cloud_to_cloud_(aka).jpg",{},"\u002Farticles\u002Fazure-native-service-bus-publishing-with-api-management",{"title":5,"description":344},"azure-native-service-bus-publishing-with-api-management","articles\u002Fazure-native-service-bus-publishing-with-api-management",[356,357],"api","cloud-integration","zSyR4oy-Q3OLWSiTZ9Pu3MYiOn9iT4Mcr998BD-n0Es",1787256356992]