{"id":659,"date":"2023-11-02T00:43:46","date_gmt":"2023-11-02T00:43:46","guid":{"rendered":"http:\/\/draith.com\/?p=659"},"modified":"2024-02-13T00:51:22","modified_gmt":"2024-02-13T00:51:22","slug":"quick-dive-integrating-logic-apps-with-azure-openai","status":"publish","type":"post","link":"http:\/\/draith.azurewebsites.net\/?p=659","title":{"rendered":"Quick Dive: Integrating Logic Apps with Azure OpenAI"},"content":{"rendered":"\n<p>Let\u2019s cut to the chase: Integrating Azure Logic Apps with Azure OpenAI unlocks a plethora of possibilities, from automating content creation to enhancing data analysis. Below is a step-by-step guide to melding these powerful tools.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Step 1: Set Up Azure OpenAI<\/h4>\n\n\n\n<p>First, you need an Azure OpenAI service instance. Go to the Azure Portal, search for Azure OpenAI Service, and create a new instance. Once deployed, grab your API key and endpoint URL from the resource management section.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Step 2: Create Your Logic App<\/h4>\n\n\n\n<p>Navigate back to the Azure Portal and create a new Logic App:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Choose your subscription and resource group.<\/li>\n\n\n\n<li>Pick a region close to you for lower latency.<\/li>\n\n\n\n<li>Name your Logic App.<\/li>\n\n\n\n<li>Click &#8220;Review + create&#8221; and then &#8220;Create&#8221; after validation passes.<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">Step 3: Design Your Logic App Workflow<\/h4>\n\n\n\n<p>Once your Logic App is ready, it&#8217;s time to design the workflow:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open your Logic App in the Azure Portal and go to the Logic App Designer.<\/li>\n\n\n\n<li>Start with a common trigger like &#8220;When an HTTP request is received&#8221; if you want your Logic App to act based on external requests.<\/li>\n\n\n\n<li>Add a new step by searching for &#8220;HTTP&#8221; in the actions list and choose the &#8220;HTTP &#8211; HTTP&#8221; action. This will be used to call the Azure OpenAI API.<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">Step 4: Configure the HTTP Action for Azure OpenAI<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Method: <code>POST<\/code><\/li>\n\n\n\n<li>URI: Enter the endpoint URL of your Azure OpenAI service.<\/li>\n\n\n\n<li>Headers: Add two headers:\n<ul class=\"wp-block-list\">\n<li><code>Content-Type<\/code> with the value <code>application\/json<\/code><\/li>\n\n\n\n<li><code>Authorization<\/code> with the value <code>Bearer &lt;Your Azure OpenAI API Key&gt;<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Body: Craft the JSON payload according to your task. For example, to generate text, your body might look like this:<\/li>\n<\/ul>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;javascript&quot;,&quot;mime&quot;:&quot;application\/json&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;JSON&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;json&quot;}\">{\n  &quot;prompt&quot;: &quot;Write a brief about integrating Azure OpenAI with Logic Apps.&quot;,\n  &quot;temperature&quot;: 0.7,\n  &quot;max_tokens&quot;: 100\n}\n<\/pre><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">Step 5: Process the Response<\/h4>\n\n\n\n<p>After calling the Azure OpenAI API, you&#8217;ll want to handle the response:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Add a &#8220;Parse JSON&#8221; action to interpret the API response.<\/li>\n\n\n\n<li>In the &#8220;Content&#8221; box, select the body of the HTTP action.<\/li>\n\n\n\n<li>Define the schema based on the Azure OpenAI response format. For text generation, you&#8217;ll focus on extracting the generated text from the response.<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">Step 6: Add Final Actions<\/h4>\n\n\n\n<p>Decide what to do with the Azure OpenAI&#8217;s response. You could:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Send an email with the generated content.<\/li>\n\n\n\n<li>Save the response to a database or a file in Azure Blob Storage.<\/li>\n\n\n\n<li>Respond to the initial HTTP request with the generated content.<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">Step 7: Test Your Logic App<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Save your Logic App and run a test by triggering it based on your chosen trigger method.<\/li>\n\n\n\n<li>Monitor the run in the &#8220;Overview&#8221; section of your Logic App to ensure everything executes as expected.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Let\u2019s cut to the chase: Integrating Azure Logic Apps with Azure OpenAI unlocks a plethora of possibilities, from automating content creation to enhancing data analysis. Below is a step-by-step guide to melding these powerful tools. Step 1: Set Up Azure OpenAI First, you need an Azure OpenAI service instance. Go to the Azure Portal, search &hellip; <a href=\"http:\/\/draith.azurewebsites.net\/?p=659\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Quick Dive: Integrating Logic Apps with Azure OpenAI&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[26,4,5,13],"class_list":["post-659","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-ai","tag-azure","tag-azure-automation","tag-logic-apps"],"_links":{"self":[{"href":"http:\/\/draith.azurewebsites.net\/index.php?rest_route=\/wp\/v2\/posts\/659","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/draith.azurewebsites.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/draith.azurewebsites.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/draith.azurewebsites.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/draith.azurewebsites.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=659"}],"version-history":[{"count":1,"href":"http:\/\/draith.azurewebsites.net\/index.php?rest_route=\/wp\/v2\/posts\/659\/revisions"}],"predecessor-version":[{"id":660,"href":"http:\/\/draith.azurewebsites.net\/index.php?rest_route=\/wp\/v2\/posts\/659\/revisions\/660"}],"wp:attachment":[{"href":"http:\/\/draith.azurewebsites.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=659"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/draith.azurewebsites.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=659"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/draith.azurewebsites.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=659"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}