<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6011381329995167460</id><updated>2025-12-16T20:46:41.669+05:30</updated><category term="Azure"/><category term="PaaS"/><category term="Tips / Tricks"/><category term="AI"/><category term=".Net"/><category term="Web App"/><category term="Security"/><category term="Bot"/><category term="Logic App"/><category term="Python&#xa;Gen AI&#xa;Data Science"/><category term="Container"/><category term="Docker"/><category term="Gen AI"/><category term="Intelligence"/><category term="iPaaS"/><category term="AKS"/><category term="Arc"/><category term="Artificial Intelligence"/><category term="Azure Arc"/><category term="Azure Speech"/><category term="C#"/><category term="Cognitive"/><category term="Integration"/><category term="K8s"/><category term="Kubernetes"/><category term="Langchain"/><category term="LlamaIndex"/><category term="Streamlit"/><category term="AWS"/><category term="Automation"/><category term="GitOps"/><category term="JSON"/><category term="Key Vault"/><category term="Microservices"/><category term="Networking"/><category term="Python"/><category term="RAG"/><category term="Secret"/><category term="Storage"/><category term="Table"/><category term="ARM Template"/><category term="App Services"/><category term="Application Gateway"/><category term="Azure Open AI"/><category term="Azure Service Bus"/><category term="Business Continuity"/><category term="Collection"/><category term="Compliance"/><category term="Data Factory"/><category term="Data Science"/><category term="Design Patterns"/><category term="DevOps"/><category term="Disaster Recovery"/><category term="Emulator"/><category term="Failover"/><category term="Front Door"/><category term="Garbage"/><category term="Google Play"/><category term="Google Speech"/><category term="Gpt"/><category term="JavaScript"/><category term="LLM-Guard"/><category term="Managed Identity"/><category term="Managed Indentity"/><category term="Memory"/><category term="Mobile App"/><category term="Opera Store"/><category term="PowerShell"/><category term="SLA"/><category term="Semantic Kernel"/><category term="Speech"/><category term="Sql-Server"/><category term="Vision"/><category term="XML"/><title type='text'>Keep it Simple</title><subtitle type='html'>A blog about Azure Cloud and its various services and usage</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://techiemate.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://techiemate.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Atanu Gupta</name><uri>http://www.blogger.com/profile/05529718294081550882</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_LZ_SzyDY_u8HW4LiUYlsEJKSSMR5zYs-ow0dK7kjPtYVYnB_nHhGXM3Ad8Gt9AxMhbi0UO3mSjuYBQq2Sli5kUe05z21o-xTJYAM-Pw6TErhMe4ITlrqdadJSCp_xYQS1rf5k8diG7IlmVmai1fllCvN7o9A8b0JSaV5Gn6SCwv5zw/s220/1714907742840.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>63</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6011381329995167460.post-6729340938979305354</id><published>2025-04-20T10:30:00.001+05:30</published><updated>2025-04-21T07:14:16.945+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term=".Net"/><category scheme="http://www.blogger.com/atom/ns#" term="Azure"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><title type='text'>Go Beyond the Azure Portal 🏃‍♂️ Unlocking the Power of Azure REST APIs</title><content type='html'>&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span face=&quot;source-serif-pro, Georgia, Cambria, &amp;quot;Times New Roman&amp;quot;, Times, serif&quot; style=&quot;background-color: white; color: #242424; letter-spacing: -0.003em;&quot;&gt;When we think about managing resources in Azure, the first tools that usually come to mind are the Azure Portal, Azure CLI, PowerShell, or perhaps even ARM templates, Bicep, and Terraform. These tools are super useful, user-friendly and powerful, no doubt — but here’s something that often goes unnoticed..&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span face=&quot;source-serif-pro, Georgia, Cambria, &amp;quot;Times New Roman&amp;quot;, Times, serif&quot; style=&quot;background-color: white; color: #242424; letter-spacing: -0.003em;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span face=&quot;source-serif-pro, Georgia, Cambria, &amp;quot;Times New Roman&amp;quot;, Times, serif&quot; style=&quot;background-color: white; color: #242424; letter-spacing: -0.003em;&quot;&gt;👉&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;tl ki&quot; face=&quot;source-serif-pro, Georgia, Cambria, &amp;quot;Times New Roman&amp;quot;, Times, serif&quot; style=&quot;box-sizing: inherit; color: #242424; font-weight: 700; letter-spacing: -0.003em;&quot;&gt;Everything you do in Azure — every button clicked, every script executed — ultimately calls an Azure REST API under the hood.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span face=&quot;source-serif-pro, Georgia, Cambria, &amp;quot;Times New Roman&amp;quot;, Times, serif&quot; style=&quot;background-color: white; color: #242424; letter-spacing: -0.003em;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span face=&quot;source-serif-pro, Georgia, Cambria, &amp;quot;Times New Roman&amp;quot;, Times, serif&quot; style=&quot;background-color: white; color: #242424; letter-spacing: -0.003em;&quot;&gt;Yes,&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;tl ki&quot; face=&quot;source-serif-pro, Georgia, Cambria, &amp;quot;Times New Roman&amp;quot;, Times, serif&quot; style=&quot;box-sizing: inherit; color: #242424; font-weight: 700; letter-spacing: -0.003em;&quot;&gt;every single action.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span face=&quot;source-serif-pro, Georgia, Cambria, &amp;quot;Times New Roman&amp;quot;, Times, serif&quot; style=&quot;background-color: white; color: #242424; letter-spacing: -0.003em;&quot;&gt;And once you realize this, a whole new world opens up.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span face=&quot;source-serif-pro, Georgia, Cambria, &amp;quot;Times New Roman&amp;quot;, Times, serif&quot; style=&quot;background-color: white; color: #242424; letter-spacing: -0.003em;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4jTh6GvAe-98sl_8Vxe5HfO1nmOwXsd1UBGSZcNRDctCOpQuWMJfNExY_jt7SN0K4-avilfLm15GuhRoE2PO-d7T4ePzigqLpVLmOFMArf7oZgOvYWSzbczhQb4aWAP_HnbT0Z-RNUaSzNGD4AY4oNldp1sRfaeQbGMfz3TOnTSNPhtU2kbuYa01gWio/s1536/39252eec-c31d-4ec3-bd02-33ac7e09d506.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1024&quot; data-original-width=&quot;1536&quot; height=&quot;427&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4jTh6GvAe-98sl_8Vxe5HfO1nmOwXsd1UBGSZcNRDctCOpQuWMJfNExY_jt7SN0K4-avilfLm15GuhRoE2PO-d7T4ePzigqLpVLmOFMArf7oZgOvYWSzbczhQb4aWAP_HnbT0Z-RNUaSzNGD4AY4oNldp1sRfaeQbGMfz3TOnTSNPhtU2kbuYa01gWio/w640-h427/39252eec-c31d-4ec3-bd02-33ac7e09d506.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;h2 style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;span face=&quot;source-serif-pro, Georgia, Cambria, &amp;quot;Times New Roman&amp;quot;, Times, serif&quot; style=&quot;background-color: white; color: #242424; font-size: 20px; letter-spacing: -0.06px; text-align: left;&quot;&gt;🚀&amp;nbsp;&lt;/span&gt;Why should you care about Azure Rest APIs?&lt;/h2&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;At first glance, working directly with REST APIs might seem like an over-complication. After all, the portal and CLI abstract away the hard parts, right?&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;But what if you’re in a scenario where:&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;ul&gt;&lt;li&gt;You need to automate a process that the CLI doesn’t natively support&lt;/li&gt;&lt;li&gt;You’re building a custom dashboard or internal tool for Azure management and operations&lt;/li&gt;&lt;li&gt;You want tighter control over what’s happening under the hood&lt;/li&gt;&lt;li&gt;Your company’s higher management at CXO levels do not have time to go into the Azure portal or not that technical to run scripts to find out information.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;In such cases, going directly to the source — the Azure REST APIs — can be incredibly powerful.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;h2&gt;&lt;span face=&quot;sohne, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif&quot; style=&quot;background-color: white; color: #242424; font-size: 24px; letter-spacing: -0.016em; text-align: start;&quot;&gt;🧠 T&lt;/span&gt;he hidden power of talking to Azure natively&lt;/h2&gt;&lt;div&gt;&lt;span face=&quot;source-serif-pro, Georgia, Cambria, &amp;quot;Times New Roman&amp;quot;, Times, serif&quot; style=&quot;background-color: white; color: #242424; letter-spacing: -0.003em; text-align: start;&quot;&gt;Throughout my cloud career, I’ve leaned on REST APIs in many mission-critical situations.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span face=&quot;source-serif-pro, Georgia, Cambria, &amp;quot;Times New Roman&amp;quot;, Times, serif&quot; style=&quot;background-color: white; color: #242424; letter-spacing: -0.003em; text-align: start;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;span style=&quot;background-color: white; text-align: start;&quot;&gt;&lt;span face=&quot;source-serif-pro, Georgia, Cambria, Times New Roman, Times, serif&quot; style=&quot;color: #242424;&quot;&gt;&lt;span style=&quot;letter-spacing: -0.048px;&quot;&gt;🔄 Automating various workflows and sometimes creating a small repeatable landing zone.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;background-color: white; text-align: start;&quot;&gt;&lt;span face=&quot;source-serif-pro, Georgia, Cambria, Times New Roman, Times, serif&quot; style=&quot;color: #242424;&quot;&gt;&lt;span style=&quot;letter-spacing: -0.048px;&quot;&gt;📊&amp;nbsp; Querying hundreds of resources across multiple subscriptions in parallel&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;background-color: white; text-align: start;&quot;&gt;&lt;span face=&quot;source-serif-pro, Georgia, Cambria, Times New Roman, Times, serif&quot; style=&quot;color: #242424;&quot;&gt;&lt;span style=&quot;letter-spacing: -0.048px;&quot;&gt;🔐 Giving the people in authority a dashboard/tool which they can carry along with them and check stuff on the fly&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;background-color: white; text-align: start;&quot;&gt;&lt;span face=&quot;source-serif-pro, Georgia, Cambria, Times New Roman, Times, serif&quot; style=&quot;color: #242424;&quot;&gt;&lt;span style=&quot;letter-spacing: -0.048px;&quot;&gt;🛠️ Building internal tools that allow teams to act on Azure without accessing the portal&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;span face=&quot;source-serif-pro, Georgia, Cambria, &amp;quot;Times New Roman&amp;quot;, Times, serif&quot; style=&quot;background-color: white; color: #242424; letter-spacing: -0.048px; text-align: start;&quot;&gt;And you know what’s fascinating? These APIs are stable, well-documented, and consistent once you get a hang of them.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span face=&quot;source-serif-pro, Georgia, Cambria, &amp;quot;Times New Roman&amp;quot;, Times, serif&quot; style=&quot;background-color: white; color: #242424; letter-spacing: -0.048px; text-align: start;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;h2&gt;&lt;span face=&quot;sohne, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif&quot; style=&quot;background-color: white; color: #242424; font-size: 24px; letter-spacing: -0.016em; text-align: start;&quot;&gt;🛠️&amp;nbsp;&lt;/span&gt;&lt;span face=&quot;source-serif-pro, Georgia, Cambria, &amp;quot;Times New Roman&amp;quot;, Times, serif&quot; style=&quot;background-color: white; color: #242424; letter-spacing: -0.048px; text-align: start;&quot;&gt;Getting Started: It&#39;s easier than you think&lt;/span&gt;&lt;/h2&gt;&lt;div style=&quot;text-align: start;&quot;&gt;&lt;span face=&quot;source-serif-pro, Georgia, Cambria, Times New Roman, Times, serif&quot; style=&quot;color: #242424;&quot;&gt;&lt;span style=&quot;letter-spacing: -0.048px;&quot;&gt;To interact with Azure REST APIs, you’ll need three main components:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: start;&quot;&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;span face=&quot;source-serif-pro, Georgia, Cambria, Times New Roman, Times, serif&quot; style=&quot;color: #242424;&quot;&gt;&lt;span style=&quot;letter-spacing: -0.048px;&quot;&gt;&lt;b&gt;An access token:&lt;/b&gt; Usually acquired through Azure AD using client credentials or user login.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span face=&quot;source-serif-pro, Georgia, Cambria, Times New Roman, Times, serif&quot; style=&quot;color: #242424;&quot;&gt;&lt;span style=&quot;letter-spacing: -0.048px;&quot;&gt;&lt;b&gt;The right endpoint:&lt;/b&gt; Every service has its own base URL and API version. Example: https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups?api-version=2021-04-01&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span face=&quot;source-serif-pro, Georgia, Cambria, Times New Roman, Times, serif&quot; style=&quot;color: #242424;&quot;&gt;&lt;span style=&quot;letter-spacing: -0.048px;&quot;&gt;&lt;b&gt;A tool to call the API: &lt;/b&gt;You can use curl, Postman, or programmatically use any language with HTTP capabilities (Python, PowerShell, C#, etc.).&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;background-color: white; letter-spacing: -0.048px; text-align: start;&quot;&gt;&lt;span face=&quot;source-serif-pro, Georgia, Cambria, Times New Roman, Times, serif&quot; style=&quot;color: #242424;&quot;&gt;🔗 Here’s the official documentation to start with: &lt;a href=&quot;https://learn.microsoft.com/en-us/rest/api/azure/&quot; target=&quot;_blank&quot;&gt;Azure REST API Reference&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span face=&quot;sohne, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif&quot; style=&quot;background-color: white; color: #242424; font-size: 24px; letter-spacing: -0.016em; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;h2&gt;&lt;span face=&quot;sohne, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif&quot; style=&quot;background-color: white; color: #242424; font-size: 24px; letter-spacing: -0.016em; text-align: left;&quot;&gt;🧩&lt;/span&gt;&lt;span face=&quot;sohne, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif&quot; style=&quot;color: #242424; font-size: 24px; letter-spacing: -0.016em;&quot;&gt;Real-World example: List resource group across subscriptions&lt;/span&gt;&lt;/h2&gt;&lt;div&gt;While the CLI can do this one subscription at a time, using REST APIs with the right bearer token and a script, you can hit multiple subscriptions in parallel. This is a life-saver for large enterprises where scale and speed matter.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;Imagine being able to:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Traverse hundreds of subscriptions&lt;/li&gt;&lt;li&gt;Apply filters and tags dynamically&lt;/li&gt;&lt;li&gt;Export metadata directly into your CMDB or data lake&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;All without touching the portal.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;h2&gt;&lt;span face=&quot;sohne, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif&quot; style=&quot;background-color: white; color: #242424; font-size: 24px; letter-spacing: -0.016em; text-align: start;&quot;&gt;🔓&amp;nbsp;&lt;/span&gt;Once you master it, Your Are Unstoppable&lt;/h2&gt;&lt;/div&gt;&lt;div&gt;Working with Azure REST APIs does come with a learning curve. Understanding headers, tokens, scopes, API versions, and request bodies can take some practice. But once you master it:&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;You can build your own CLI.&lt;/li&gt;&lt;li&gt;You can automate things that no one else in your team has thought possible.&lt;/li&gt;&lt;li&gt;You stop waiting for tools to support features — you build them yourself.&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;And perhaps most importantly — you start thinking like Azure itself.&lt;/div&gt;&lt;h1 class=&quot;vd ve pk bf vf kj vg kk km kn vh ko kq hr vi hs hv kt vj ku kx ky vk kz lc vl bk&quot; data-selectable-paragraph=&quot;&quot; id=&quot;29c1&quot; style=&quot;background-color: white; box-sizing: inherit; color: #242424; font-family: sohne, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif; font-size: 24px; letter-spacing: -0.016em; line-height: 30px; margin: 1.95em 0px -0.28em; text-align: start;&quot;&gt;🎯&amp;nbsp;&lt;span style=&quot;background-color: transparent; text-align: justify;&quot;&gt;Final Thoughts&lt;/span&gt;&lt;/h1&gt;&lt;div&gt;&lt;span style=&quot;background-color: transparent; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;background-color: transparent; text-align: justify;&quot;&gt;This is one of the most underutilized and unexplored areas I’ve seen in the Azure world. Everyone’s using the portal, scripts, and pipelines — but very few are tapping into the raw power of REST APIs that make all of it work.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;background-color: transparent; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;background-color: transparent; text-align: justify;&quot;&gt;If you’re a cloud architect, developer, or SRE looking to take your Azure game to the next level, start exploring this world. It’s deep, it’s powerful, and it’s incredibly satisfying.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;background-color: transparent; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;background-color: transparent; text-align: justify;&quot;&gt;✨ The sky’s the limit — and now, you’re flying without training wheels.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;background-color: transparent; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;background-color: transparent; text-align: justify;&quot;&gt;&lt;b&gt;Have you used Azure REST APIs in your work? Got any interesting use cases or stories? Drop a comment or let’s connect — I’d love to hear how others are using this hidden superpower!&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span face=&quot;source-serif-pro, Georgia, Cambria, &amp;quot;Times New Roman&amp;quot;, Times, serif&quot; style=&quot;background-color: white; color: #242424; letter-spacing: -0.048px; text-align: start;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techiemate.blogspot.com/feeds/6729340938979305354/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techiemate.blogspot.com/2025/04/go-beyond-azure-portal-unlocking-power.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/6729340938979305354'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/6729340938979305354'/><link rel='alternate' type='text/html' href='http://techiemate.blogspot.com/2025/04/go-beyond-azure-portal-unlocking-power.html' title='Go Beyond the Azure Portal 🏃‍♂️ Unlocking the Power of Azure REST APIs'/><author><name>Atanu Gupta</name><uri>http://www.blogger.com/profile/05529718294081550882</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_LZ_SzyDY_u8HW4LiUYlsEJKSSMR5zYs-ow0dK7kjPtYVYnB_nHhGXM3Ad8Gt9AxMhbi0UO3mSjuYBQq2Sli5kUe05z21o-xTJYAM-Pw6TErhMe4ITlrqdadJSCp_xYQS1rf5k8diG7IlmVmai1fllCvN7o9A8b0JSaV5Gn6SCwv5zw/s220/1714907742840.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4jTh6GvAe-98sl_8Vxe5HfO1nmOwXsd1UBGSZcNRDctCOpQuWMJfNExY_jt7SN0K4-avilfLm15GuhRoE2PO-d7T4ePzigqLpVLmOFMArf7oZgOvYWSzbczhQb4aWAP_HnbT0Z-RNUaSzNGD4AY4oNldp1sRfaeQbGMfz3TOnTSNPhtU2kbuYa01gWio/s72-w640-h427-c/39252eec-c31d-4ec3-bd02-33ac7e09d506.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6011381329995167460.post-8504176397500054082</id><published>2024-08-16T14:43:00.003+05:30</published><updated>2024-08-16T14:45:25.919+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="AI"/><category scheme="http://www.blogger.com/atom/ns#" term="Compliance"/><category scheme="http://www.blogger.com/atom/ns#" term="Gen AI"/><category scheme="http://www.blogger.com/atom/ns#" term="Intelligence"/><category scheme="http://www.blogger.com/atom/ns#" term="LLM-Guard"/><category scheme="http://www.blogger.com/atom/ns#" term="Python"/><category scheme="http://www.blogger.com/atom/ns#" term="RAG"/><category scheme="http://www.blogger.com/atom/ns#" term="Security"/><title type='text'>Securing Your LLM Applications: Detecting PII in Prompts with LLM-Guard ⚔️</title><content type='html'>&lt;p&gt;&lt;/p&gt;&lt;p&gt;In
 the era of Generative AI, where Large Language Models (LLMs) are 
increasingly woven into the fabric of modern applications, the need for 
safeguarding sensitive information has never been more critical. As 
organizations integrate LLMs into their workflows, the challenge of 
detecting and anonymizing Personally Identifiable Information (PII) in 
prompts — especially those processed in-memory — becomes paramount. 
Enter &lt;b class=&quot;abu gq&quot;&gt;LLM Guard&lt;/b&gt;, your AI-powered sentinel in the battle against data exposure. &lt;br /&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiItlK6ad9pRYt7DF4VV1mKfFQbiko0-Kmihya3OxTN7GYclhyphenhyphenUNCWPf4QkyFS55kSvHgfHqrJyZyC2WL5RLg5RcF5JE2nyAWAdiKX1_4oWa-1KNRL51h-zQ89j11cn27cpFAI6_DvZkKzebrkkO3wPtohjPOKfCSZRiMKq2Ub_ZvByeKn4S2PSeXDcXQ4/s2401/PAI-social-product-LLM%20Guard-v-1200x675-1.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1351&quot; data-original-width=&quot;2401&quot; height=&quot;360&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiItlK6ad9pRYt7DF4VV1mKfFQbiko0-Kmihya3OxTN7GYclhyphenhyphenUNCWPf4QkyFS55kSvHgfHqrJyZyC2WL5RLg5RcF5JE2nyAWAdiKX1_4oWa-1KNRL51h-zQ89j11cn27cpFAI6_DvZkKzebrkkO3wPtohjPOKfCSZRiMKq2Ub_ZvByeKn4S2PSeXDcXQ4/w640-h360/PAI-social-product-LLM%20Guard-v-1200x675-1.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;h2 class=&quot;ade adf xg am adg adh adi adj mi adk adl adm mn acd adn ado adp ach adq adr ads acl adt adu adv adw br&quot; data-selectable-paragraph=&quot;&quot; id=&quot;82c1&quot;&gt;Why PII Matters: The Stakes Are High&lt;/h2&gt;&lt;p class=&quot;pw-post-body-paragraph abs abt xg abu b abv adx abx aby abz ady acb acc acd adz acf acg ach aea acj ack acl aeb acn aco acp jw br&quot; data-selectable-paragraph=&quot;&quot; id=&quot;a163&quot;&gt;PII
 is the linchpin of an individual’s digital identity. It’s not just a 
collection of data points; it’s a digital fingerprint that, when 
mishandled, can lead to dire consequences. Whether it’s GDPR or HIPAA, 
global regulations demand stringent measures for PII protection. But 
what happens when this sensitive information makes its way into LLM 
prompts? If left unchecked, it could inadvertently proliferate across 
storage points, model training datasets, and third-party services, 
amplifying the risk of data breaches and privacy violations.&lt;/p&gt;&lt;h2 class=&quot;ade adf xg am adg adh adi adj mi adk adl adm mn acd adn ado adp ach adq adr ads acl adt adu adv adw br&quot; data-selectable-paragraph=&quot;&quot; id=&quot;db40&quot;&gt;Anatomy of a Privacy Breach: The Attack Surface&lt;/h2&gt;&lt;p class=&quot;pw-post-body-paragraph abs abt xg abu b abv adx abx aby abz ady acb acc acd adz acf acg ach aea acj ack acl aeb acn aco acp jw br&quot; data-selectable-paragraph=&quot;&quot; id=&quot;8180&quot;&gt;Consider
 this scenario: A company uses an LLM to automate customer service. The 
prompts sent to the LLM contain user queries, some of which include PII 
like names, addresses, or credit card numbers. If the model provider 
stores these prompts, either for improving the model or for other 
purposes, the PII is now exposed to risks outside of the company’s 
control. This scenario underscores the importance of ensuring that any 
PII in prompts is detected and anonymized before it ever reaches the 
LLM.&lt;/p&gt;&lt;h2 class=&quot;ade adf xg am adg adh adi adj mi adk adl adm mn acd adn ado adp ach adq adr ads acl adt adu adv adw br&quot; data-selectable-paragraph=&quot;&quot; id=&quot;a244&quot;&gt;The Role of Anonymize Scanner in LLM Guard&lt;/h2&gt;&lt;p class=&quot;pw-post-body-paragraph abs abt xg abu b abv adx abx aby abz ady acb acc acd adz acf acg ach aea acj ack acl aeb acn aco acp jw br&quot; data-selectable-paragraph=&quot;&quot; id=&quot;4b76&quot;&gt;The &lt;b class=&quot;abu gq&quot;&gt;Anonymize Scanner&lt;/b&gt;
 within LLM Guard acts as your digital guardian, scrutinizing prompts in
 real-time and ensuring they remain free from PII. Here’s how it works:&lt;/p&gt;&lt;ul&gt;&lt;li class=&quot;abs abt xg abu b abv abw abx aby abz aca acb acc acd ace acf acg ach aci acj ack acl acm acn aco acp aec aed aee br&quot; data-selectable-paragraph=&quot;&quot; id=&quot;7e45&quot;&gt;&lt;b class=&quot;abu gq&quot;&gt;PII Detection:&lt;/b&gt;
 The scanner identifies PII entities across various categories, 
including credit card numbers, personal names, phone numbers, URLs, 
email addresses, IP addresses, UUIDs, social security numbers, crypto 
wallet addresses, and IBAN codes.&lt;/li&gt;&lt;li class=&quot;abs abt xg abu b abv aef abx aby abz aeg acb acc acd aeh acf acg ach aei acj ack acl aej acn aco acp aec aed aee br&quot; data-selectable-paragraph=&quot;&quot; id=&quot;a835&quot;&gt;&lt;b class=&quot;abu gq&quot;&gt;Anonymization:&lt;/b&gt; Once detected, the scanner can anonymize or redact this information, ensuring that the LLM only processes sanitized data.&lt;/li&gt;&lt;li class=&quot;abs abt xg abu b abv aef abx aby abz aeg acb acc acd aeh acf acg ach aei acj ack acl aej acn aco acp aec aed aee br&quot; data-selectable-paragraph=&quot;&quot; id=&quot;3f85&quot;&gt;&lt;b class=&quot;abu gq&quot;&gt;In-Memory Operation:&lt;/b&gt;
 Unlike traditional methods that might focus on data at rest or in 
transit, LLM Guard operates directly on prompts in RAM, offering 
real-time protection without the latency of I/O operations.&lt;/li&gt;&lt;/ul&gt;&lt;h2 class=&quot;ade adf xg am adg adh adi adj mi adk adl adm mn acd adn ado adp ach adq adr ads acl adt adu adv adw br&quot; data-selectable-paragraph=&quot;&quot; id=&quot;124f&quot;&gt;Understanding PII Entities: A Closer Look&lt;/h2&gt;&lt;p class=&quot;pw-post-body-paragraph abs abt xg abu b abv adx abx aby abz ady acb acc acd adz acf acg ach aea acj ack acl aeb acn aco acp jw br&quot; data-selectable-paragraph=&quot;&quot; id=&quot;1676&quot;&gt;Let’s break down the types of PII the Anonymize Scanner targets:&lt;/p&gt;&lt;ul&gt;&lt;li class=&quot;abs abt xg abu b abv abw abx aby abz aca acb acc acd ace acf acg ach aci acj ack acl acm acn aco acp aec aed aee br&quot; data-selectable-paragraph=&quot;&quot; id=&quot;8d5b&quot;&gt;&lt;b class=&quot;abu gq&quot;&gt;Credit Cards:&lt;/b&gt; The scanner is adept at identifying credit card formats, including specific patterns like those for Visa or American Express.&lt;/li&gt;&lt;li class=&quot;abs abt xg abu b abv aef abx aby abz aeg acb acc acd aeh acf acg ach aei acj ack acl aej acn aco acp aec aed aee br&quot; data-selectable-paragraph=&quot;&quot; id=&quot;8176&quot;&gt;&lt;b class=&quot;abu gq&quot;&gt;Names:&lt;/b&gt;
 It recognizes full names, including first, middle, and last names, 
ensuring that any personally identifiable name data is flagged.&lt;/li&gt;&lt;li class=&quot;abs abt xg abu b abv aef abx aby abz aeg acb acc acd aeh acf acg ach aei acj ack acl aej acn aco acp aec aed aee br&quot; data-selectable-paragraph=&quot;&quot; id=&quot;775d&quot;&gt;&lt;b class=&quot;abu gq&quot;&gt;Phone Numbers:&lt;/b&gt;
 From a simple 10-digit number to complex international formats, the 
scanner is equipped to detect various phone number patterns.&lt;/li&gt;&lt;li class=&quot;abs abt xg abu b abv aef abx aby abz aeg acb acc acd aeh acf acg ach aei acj ack acl aej acn aco acp aec aed aee br&quot; data-selectable-paragraph=&quot;&quot; id=&quot;7281&quot;&gt;&lt;b class=&quot;abu gq&quot;&gt;URLs &amp;amp; Email Addresses:&lt;/b&gt;
 Whether it’s a URL pointing to a personal site or an email address in a
 customer query, the scanner can identify and anonymize these elements.&lt;/li&gt;&lt;li class=&quot;abs abt xg abu b abv aef abx aby abz aeg acb acc acd aeh acf acg ach aei acj ack acl aej acn aco acp aec aed aee br&quot; data-selectable-paragraph=&quot;&quot; id=&quot;5730&quot;&gt;&lt;b class=&quot;abu gq&quot;&gt;IP Addresses:&lt;/b&gt; Both IPv4 and IPv6 addresses are within the scanner’s purview, crucial for applications dealing with network data.&lt;/li&gt;&lt;li class=&quot;abs abt xg abu b abv aef abx aby abz aeg acb acc acd aeh acf acg ach aei acj ack acl aej acn aco acp aec aed aee br&quot; data-selectable-paragraph=&quot;&quot; id=&quot;b00f&quot;&gt;&lt;b class=&quot;abu gq&quot;&gt;UUIDs &amp;amp; Social Security Numbers:&lt;/b&gt;
 Unique identifiers and social security numbers are some of the most 
sensitive data types, and the scanner is finely tuned to detect these.&lt;/li&gt;&lt;li class=&quot;abs abt xg abu b abv aef abx aby abz aeg acb acc acd aeh acf acg ach aei acj ack acl aej acn aco acp aec aed aee br&quot; data-selectable-paragraph=&quot;&quot; id=&quot;9b3f&quot;&gt;&lt;b class=&quot;abu gq&quot;&gt;Crypto Wallets &amp;amp; IBANs:&lt;/b&gt;
 As financial transactions become more digital, detecting and 
anonymizing crypto wallet addresses and IBAN codes is vital to prevent 
fraud and ensure compliance.&lt;/li&gt;&lt;/ul&gt;&lt;p class=&quot;pw-post-body-paragraph abs abt xg abu b abv abw abx aby abz aca acb acc acd ace acf acg ach aci acj ack acl acm acn aco acp jw br&quot; data-selectable-paragraph=&quot;&quot; id=&quot;3667&quot;&gt;&lt;b class=&quot;abu gq&quot;&gt;Detecting PII in Prompts Using LLM Guard&lt;/b&gt;&lt;/p&gt;&lt;p class=&quot;pw-post-body-paragraph abs abt xg abu b abv abw abx aby abz aca acb acc acd ace acf acg ach aci acj ack acl acm acn aco acp jw br&quot; data-selectable-paragraph=&quot;&quot; id=&quot;c12d&quot;&gt;To
 illustrate the power of LLM Guard, let’s walk through a sample yet 
practical example. Below is a Python snippet that demonstrates how to 
use the &lt;code class=&quot;co aek ael aem aen b&quot;&gt;Anonymize&lt;/code&gt; scanner to detect and redact PII in a prompt before it is processed by an LLM:&lt;/p&gt;&lt;pre class=&quot;act acu acv acw acx aeo aen aep la aeq bk br&quot;&gt;&lt;span class=&quot;rc adf xg aen b bo aer aes s aet aeu&quot; data-selectable-paragraph=&quot;&quot; id=&quot;7a6e&quot;&gt;&lt;span class=&quot;hljs-comment&quot;&gt;# Install the necessary package&lt;/span&gt;&lt;br /&gt;pip install llm_guard&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-comment&quot;&gt;# Importing required modules&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;from&lt;/span&gt; llm_guard &lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; scan_prompt&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;from&lt;/span&gt; llm_guard.input_scanners &lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; Anonymize&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-comment&quot;&gt;# Define a prompt that contains PII&lt;/span&gt;&lt;br /&gt;prompt = &lt;span class=&quot;hljs-string&quot;&gt;&quot;&quot;&quot;Make an SQL insert statement to add a new user to our database.&lt;br /&gt;Name is John Doe.&lt;br /&gt;Email is test@test.com.&lt;br /&gt;Phone number is 555-123-4567.&quot;&quot;&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-comment&quot;&gt;# Scan the prompt for PII and sanitize it&lt;/span&gt;&lt;br /&gt;sanitized_prompt, results_valid, results_score = scan_prompt(input_scanners, prompt)&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-comment&quot;&gt;# Check if the prompt contains any invalid PII data&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;hljs-built_in&quot;&gt;any&lt;/span&gt;(results_valid.values()) &lt;span class=&quot;hljs-keyword&quot;&gt;is&lt;/span&gt; &lt;span class=&quot;hljs-literal&quot;&gt;False&lt;/span&gt;:&lt;br /&gt;    &lt;span class=&quot;hljs-built_in&quot;&gt;print&lt;/span&gt;(&lt;span class=&quot;hljs-string&quot;&gt;f&quot;Prompt &lt;span class=&quot;hljs-subst&quot;&gt;{prompt}&lt;/span&gt; is not valid, scores: &lt;span class=&quot;hljs-subst&quot;&gt;{results_score}&lt;/span&gt;&quot;&lt;/span&gt;)&lt;br /&gt;    exit(&lt;span class=&quot;hljs-number&quot;&gt;1&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-comment&quot;&gt;# Output the sanitized prompt&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;hljs-built_in&quot;&gt;print&lt;/span&gt;(&lt;span class=&quot;hljs-string&quot;&gt;f&quot;Prompt: &lt;span class=&quot;hljs-subst&quot;&gt;{sanitized_prompt}&lt;/span&gt;&quot;&lt;/span&gt;)&lt;/span&gt;&lt;/pre&gt;&lt;p class=&quot;pw-post-body-paragraph abs abt xg abu b abv abw abx aby abz aca acb acc acd ace acf acg ach aci acj ack acl acm acn aco acp jw br&quot; data-selectable-paragraph=&quot;&quot; id=&quot;39d1&quot;&gt;&lt;b class=&quot;abu gq&quot;&gt;Output&lt;/b&gt;:&lt;/p&gt;&lt;pre class=&quot;act acu acv acw acx aeo aen aep la aeq bk br&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgl-vSIwkpRqciBYi6m2OeMj34DWhHGTK6FJ3PZKWyuawGossWXyPhKCeL5fYUzbM6MDIDp8e0pamsFRU7D4N4eSds1svb5GvjEVf1cz9SYilUpaog6m-mj-p0z6Xz-hq8VznwJAbsG_w2WccIe4SaDTbDEf2zpKUvyNvq4mkFjyh0ir0OG6MFQ6dVMoM0/s878/1.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;241&quot; data-original-width=&quot;878&quot; height=&quot;176&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgl-vSIwkpRqciBYi6m2OeMj34DWhHGTK6FJ3PZKWyuawGossWXyPhKCeL5fYUzbM6MDIDp8e0pamsFRU7D4N4eSds1svb5GvjEVf1cz9SYilUpaog6m-mj-p0z6Xz-hq8VznwJAbsG_w2WccIe4SaDTbDEf2zpKUvyNvq4mkFjyh0ir0OG6MFQ6dVMoM0/w640-h176/1.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;span class=&quot;rc adf xg aen b bo aer aes s aet aeu&quot; data-selectable-paragraph=&quot;&quot; id=&quot;a24c&quot;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;p class=&quot;pw-post-body-paragraph abs abt xg abu b abv abw abx aby abz aca acb acc acd ace acf acg ach aci acj ack acl acm acn aco acp jw br&quot; data-selectable-paragraph=&quot;&quot; id=&quot;3af9&quot;&gt;&lt;b class=&quot;abu gq&quot;&gt;Explanation:&lt;/b&gt;&lt;/p&gt;&lt;ul&gt;&lt;li class=&quot;abs abt xg abu b abv abw abx aby abz aca acb acc acd ace acf acg ach aci acj ack acl acm acn aco acp aec aed aee br&quot; data-selectable-paragraph=&quot;&quot; id=&quot;e8c5&quot;&gt;The &lt;code class=&quot;co aek ael aem aen b&quot;&gt;scan_prompt&lt;/code&gt; function utilizes the &lt;code class=&quot;co aek ael aem aen b&quot;&gt;Anonymize&lt;/code&gt; scanner to inspect the prompt for any PII entities.&lt;/li&gt;&lt;li class=&quot;abs abt xg abu b abv aef abx aby abz aeg acb acc acd aeh acf acg ach aei acj ack acl aej acn aco acp aec aed aee br&quot; data-selectable-paragraph=&quot;&quot; id=&quot;25a9&quot;&gt;The
 scanner detects sensitive information such as names, email addresses, 
and phone numbers, replacing them with placeholders like &lt;code class=&quot;co aek ael aem aen b&quot;&gt;[REDACTED_PERSON_1]&lt;/code&gt;, &lt;code class=&quot;co aek ael aem aen b&quot;&gt;[REDACTED_EMAIL_ADDRESS_1]&lt;/code&gt;, and &lt;code class=&quot;co aek ael aem aen b&quot;&gt;[REDACTED_PHONE_NUMBER_1]&lt;/code&gt;.&lt;/li&gt;&lt;li class=&quot;abs abt xg abu b abv aef abx aby abz aeg acb acc acd aeh acf acg ach aei acj ack acl aej acn aco acp aec aed aee br&quot; data-selectable-paragraph=&quot;&quot; id=&quot;e9b3&quot;&gt;The sanitized prompt is then printed, showcasing how the PII has been effectively anonymized.&lt;/li&gt;&lt;/ul&gt;&lt;p class=&quot;pw-post-body-paragraph abs abt xg abu b abv abw abx aby abz aca acb acc acd ace acf acg ach aci acj ack acl acm acn aco acp jw br&quot; data-selectable-paragraph=&quot;&quot; id=&quot;f956&quot;&gt;This
 real-time detection and redaction process is crucial for maintaining 
the privacy and security of your data when interfacing with LLMs.&lt;/p&gt;&lt;h2 class=&quot;ade adf xg am adg adh adi adj mi adk adl adm mn acd adn ado adp ach adq adr ads acl adt adu adv adw br&quot; data-selectable-paragraph=&quot;&quot; id=&quot;edfa&quot;&gt;Fortifying Your LLM Applications&lt;/h2&gt;&lt;p class=&quot;pw-post-body-paragraph abs abt xg abu b abv adx abx aby abz ady acb acc acd adz acf acg ach aea acj ack acl aeb acn aco acp jw br&quot; data-selectable-paragraph=&quot;&quot; id=&quot;578e&quot;&gt;Integrating
 LLM Guard into your application stack is more than just a compliance 
checkbox; it’s a proactive stance in the ongoing battle for data 
privacy. By ensuring that PII is detected and anonymized in-memory, 
before it even has a chance to be processed by an LLM, you’re not only 
protecting your users but also fortifying your applications against 
potential breaches.&lt;/p&gt;&lt;p class=&quot;pw-post-body-paragraph abs abt xg abu b abv abw abx aby abz aca acb acc acd ace acf acg ach aci acj ack acl acm acn aco acp jw br&quot; data-selectable-paragraph=&quot;&quot; id=&quot;e6c3&quot;&gt;In
 a world where AI is becoming omnipresent, LLM Guard offers a robust 
solution to a critical problem. Don’t wait for a breach to prioritize 
PII protection — make it a cornerstone of your LLM deployment strategy.&lt;/p&gt;&lt;p class=&quot;pw-post-body-paragraph abs abt xg abu b abv abw abx aby abz aca acb acc acd ace acf acg ach aci acj ack acl acm acn aco acp jw br&quot; data-selectable-paragraph=&quot;&quot; id=&quot;fa65&quot;&gt;Stay tuned for more on LLM-Guard guardrail features. 🙂&lt;picture&gt;&lt;source type=&quot;image/webp&quot;&gt;&lt;/source&gt;&lt;source data-testid=&quot;og&quot;&gt;&lt;/source&gt;&lt;/picture&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://techiemate.blogspot.com/feeds/8504176397500054082/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techiemate.blogspot.com/2024/08/securing-your-llm-applications.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/8504176397500054082'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/8504176397500054082'/><link rel='alternate' type='text/html' href='http://techiemate.blogspot.com/2024/08/securing-your-llm-applications.html' title='Securing Your LLM Applications: Detecting PII in Prompts with LLM-Guard ⚔️'/><author><name>Atanu Gupta</name><uri>http://www.blogger.com/profile/05529718294081550882</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_LZ_SzyDY_u8HW4LiUYlsEJKSSMR5zYs-ow0dK7kjPtYVYnB_nHhGXM3Ad8Gt9AxMhbi0UO3mSjuYBQq2Sli5kUe05z21o-xTJYAM-Pw6TErhMe4ITlrqdadJSCp_xYQS1rf5k8diG7IlmVmai1fllCvN7o9A8b0JSaV5Gn6SCwv5zw/s220/1714907742840.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiItlK6ad9pRYt7DF4VV1mKfFQbiko0-Kmihya3OxTN7GYclhyphenhyphenUNCWPf4QkyFS55kSvHgfHqrJyZyC2WL5RLg5RcF5JE2nyAWAdiKX1_4oWa-1KNRL51h-zQ89j11cn27cpFAI6_DvZkKzebrkkO3wPtohjPOKfCSZRiMKq2Ub_ZvByeKn4S2PSeXDcXQ4/s72-w640-h360-c/PAI-social-product-LLM%20Guard-v-1200x675-1.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6011381329995167460.post-431376732781410473</id><published>2024-07-03T17:35:00.004+05:30</published><updated>2024-07-03T17:35:43.926+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term=".Net"/><category scheme="http://www.blogger.com/atom/ns#" term="AI"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="Gen AI"/><category scheme="http://www.blogger.com/atom/ns#" term="Gpt"/><category scheme="http://www.blogger.com/atom/ns#" term="Semantic Kernel"/><title type='text'>✨Building a Smart Image Parser with .NET, Semantic Kernel, and GPT-4o 🧿</title><content type='html'>&lt;p&gt;Hey there, tech enthusiasts! Today, we’re diving into the magical world 
of AI, .NET, and the Semantic Kernel. Imagine a world where you provide 
an image URL, and in just a few lines of code, your program analyzes 
every tiny detail in that image. Sounds cool, right? Well, buckle up, 
because we’re about to embark on a fun journey to create exactly that!&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgX9rp869t_wIiK1Lo8TIj1IUqNO5WJHhoWhJuXm47HpYaPoBIQgv6RQ_xrdHscQPHm3O80PZRzZA-N8kdy7gdl4PTS_MGCL2FFYgJyWmvk19GZ8_huViENdGxDYREn6p2rIOIbnBnoljOhTNZEZycCr0tyXwQIRZ2s7_8AQMv6A4zkVIu0n8nt_ubpqdQ/s1187/Home-Page-AzureSemanticKernel-AI.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;578&quot; data-original-width=&quot;1187&quot; height=&quot;312&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgX9rp869t_wIiK1Lo8TIj1IUqNO5WJHhoWhJuXm47HpYaPoBIQgv6RQ_xrdHscQPHm3O80PZRzZA-N8kdy7gdl4PTS_MGCL2FFYgJyWmvk19GZ8_huViENdGxDYREn6p2rIOIbnBnoljOhTNZEZycCr0tyXwQIRZ2s7_8AQMv6A4zkVIu0n8nt_ubpqdQ/w640-h312/Home-Page-AzureSemanticKernel-AI.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;h1 class=&quot;mm mn fp be mo mp mq mr ms mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;92b7&quot;&gt;The Magic Ingredients&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph la lb fp lc b ld nk lf lg lh nl lj lk ll nm ln lo lp nn lr ls lt no lv lw lx fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;f57f&quot;&gt;Here’s what we’ll be using:&lt;/p&gt;&lt;ul class=&quot;&quot;&gt;&lt;li class=&quot;la lb fp lc b ld le lf lg lh li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx np nq nr bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;982d&quot;&gt;.NET (because we love a sturdy framework)&lt;/li&gt;&lt;li class=&quot;la lb fp lc b ld ns lf lg lh nt lj lk ll nu ln lo lp nv lr ls lt nw lv lw lx np nq nr bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;7bcb&quot;&gt;Semantic Kernel (because semantics matter, folks)&lt;/li&gt;&lt;li class=&quot;la lb fp lc b ld ns lf lg lh nt lj lk ll nu ln lo lp nv lr ls lt nw lv lw lx np nq nr bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;e545&quot;&gt;GPT-4o (the brain behind the operation)&lt;/li&gt;&lt;/ul&gt;&lt;p class=&quot;pw-post-body-paragraph la lb fp lc b ld le lf lg lh li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;92e1&quot;&gt;Without further ado, let’s jump into the code snippets and see how we can make this happen.&lt;/p&gt;&lt;h1 class=&quot;mm mn fp be mo mp mq mr ms mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;0d7d&quot;&gt;The Controller — Where the Magic Begins&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph la lb fp lc b ld nk lf lg lh nl lj lk ll nm ln lo lp nn lr ls lt no lv lw lx fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;8ba0&quot;&gt;First, we need to set up our controller. This is where all the action happens. Let’s take a look at the code:&lt;/p&gt;&lt;p class=&quot;pw-post-body-paragraph la lb fp lc b ld nk lf lg lh nl lj lk ll nm ln lo lp nn lr ls lt no lv lw lx fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;8ba0&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre class=&quot;mb mc md me mf nx ny nz bo oa ba bj&quot;&gt;&lt;span class=&quot;ob mn fp ny b bf oc od l oe of&quot; data-selectable-paragraph=&quot;&quot; id=&quot;8a78&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;using&lt;/span&gt; Microsoft.AspNetCore.Mvc;&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;using&lt;/span&gt; Microsoft.SemanticKernel;&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;using&lt;/span&gt; Microsoft.SemanticKernel.ChatCompletion;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;namespace&lt;/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;AzureSemanticKernel.AI.Controllers&lt;/span&gt;&lt;br /&gt;{&lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;OpenAiController&lt;/span&gt; : &lt;span class=&quot;hljs-title&quot;&gt;Controller&lt;/span&gt;&lt;br /&gt;    {&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;hljs-built_in&quot;&gt;string&lt;/span&gt; open_ai_key = Environment.GetEnvironmentVariable(&lt;span class=&quot;hljs-string&quot;&gt;&quot;OPEN_AI_KEY&quot;&lt;/span&gt;);&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;hljs-built_in&quot;&gt;string&lt;/span&gt; open_ai_org = Environment.GetEnvironmentVariable(&lt;span class=&quot;hljs-string&quot;&gt;&quot;OPEN_AI_ORG_ID&quot;&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;        [&lt;span class=&quot;hljs-meta&quot;&gt;HttpPost&lt;/span&gt;]&lt;br /&gt;        &lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;async&lt;/span&gt; Task&amp;lt;&lt;span class=&quot;hljs-built_in&quot;&gt;string&lt;/span&gt;&amp;gt; &lt;span class=&quot;hljs-title&quot;&gt;GetGpt4oImageResponse&lt;/span&gt;(&lt;span class=&quot;hljs-params&quot;&gt;&lt;span class=&quot;hljs-built_in&quot;&gt;string&lt;/span&gt; imgUrl&lt;/span&gt;)&lt;/span&gt;&lt;br /&gt;        {&lt;br /&gt;            &lt;span class=&quot;hljs-keyword&quot;&gt;try&lt;/span&gt;&lt;br /&gt;            {&lt;br /&gt;                &lt;span class=&quot;hljs-keyword&quot;&gt;var&lt;/span&gt; kernelBuilder = Kernel.CreateBuilder();&lt;br /&gt;&lt;br /&gt;                kernelBuilder.AddOpenAIChatCompletion(&lt;span class=&quot;hljs-string&quot;&gt;&quot;gpt-4o&quot;&lt;/span&gt;, open_ai_key, open_ai_org);&lt;br /&gt;&lt;br /&gt;                &lt;span class=&quot;hljs-keyword&quot;&gt;var&lt;/span&gt; kernel = kernelBuilder.Build();&lt;br /&gt;&lt;br /&gt;                &lt;span class=&quot;hljs-keyword&quot;&gt;var&lt;/span&gt; chat = kernel.GetRequiredService&amp;lt;IChatCompletionService&amp;gt;();&lt;br /&gt;&lt;br /&gt;                &lt;span class=&quot;hljs-keyword&quot;&gt;var&lt;/span&gt; history = &lt;span class=&quot;hljs-keyword&quot;&gt;new&lt;/span&gt; ChatHistory();&lt;br /&gt;                history.AddSystemMessage(&lt;span class=&quot;hljs-string&quot;&gt;&quot;You are a friendly and helpful assistant that responds to questions directly&quot;&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;                &lt;span class=&quot;hljs-keyword&quot;&gt;var&lt;/span&gt; message = &lt;span class=&quot;hljs-keyword&quot;&gt;new&lt;/span&gt; ChatMessageContentItemCollection&lt;br /&gt;                {&lt;br /&gt;                    &lt;span class=&quot;hljs-keyword&quot;&gt;new&lt;/span&gt; TextContent(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Can you do a detail analysis and tell me all the minute details that present in this image?&quot;&lt;/span&gt;),&lt;br /&gt;                    &lt;span class=&quot;hljs-keyword&quot;&gt;new&lt;/span&gt; ImageContent(&lt;span class=&quot;hljs-keyword&quot;&gt;new&lt;/span&gt; Uri(imgUrl))&lt;br /&gt;                };&lt;br /&gt;&lt;br /&gt;                history.AddUserMessage(message);&lt;br /&gt;&lt;br /&gt;                &lt;span class=&quot;hljs-keyword&quot;&gt;var&lt;/span&gt; result = &lt;span class=&quot;hljs-keyword&quot;&gt;await&lt;/span&gt; chat.GetChatMessageContentAsync(history);&lt;br /&gt;&lt;br /&gt;                &lt;span class=&quot;hljs-keyword&quot;&gt;return&lt;/span&gt; result.Content;&lt;br /&gt;            }&lt;br /&gt;            &lt;span class=&quot;hljs-keyword&quot;&gt;catch&lt;/span&gt; (Exception ex)&lt;br /&gt;            {&lt;br /&gt;                &lt;span class=&quot;hljs-keyword&quot;&gt;return&lt;/span&gt; ex.Message;&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;h1 class=&quot;mm mn fp be mo mp mq mr ms mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;86cc&quot;&gt;Breaking Down the Magic&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph la lb fp lc b ld nk lf lg lh nl lj lk ll nm ln lo lp nn lr ls lt no lv lw lx fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;d817&quot;&gt;Let’s dissect this code and understand what each part does.&lt;/p&gt;&lt;p class=&quot;pw-post-body-paragraph la lb fp lc b ld nk lf lg lh nl lj lk ll nm ln lo lp nn lr ls lt no lv lw lx fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;d817&quot;&gt;&lt;span class=&quot;lc fq&quot;&gt;1.&amp;nbsp;&lt;/span&gt;&lt;strong class=&quot;lc fq&quot;&gt;Namespace and Using Statements&lt;/strong&gt;:&lt;/p&gt;&lt;ul class=&quot;&quot;&gt;&lt;li class=&quot;la lb fp lc b ld le lf lg lh li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx np nq nr bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;e090&quot;&gt;Just the usual suspects. Nothing to see here. Add those packages and move on!&lt;/li&gt;&lt;/ul&gt;&lt;p class=&quot;pw-post-body-paragraph la lb fp lc b ld le lf lg lh li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;e518&quot;&gt;2. &lt;strong class=&quot;lc fq&quot;&gt;Controller Setup&lt;/strong&gt;:&lt;/p&gt;&lt;ul class=&quot;&quot;&gt;&lt;li class=&quot;la lb fp lc b ld le lf lg lh li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx np nq nr bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;d0f9&quot;&gt;We create an &lt;code class=&quot;cw oh oi oj ny b&quot;&gt;OpenAiController&lt;/code&gt;
 and define our API key and organization ID from environment variables. 
Remember, hard-coding keys is like leaving your front door open with a 
&quot;Please Rob Me&quot; sign.&lt;/li&gt;&lt;/ul&gt;&lt;p class=&quot;pw-post-body-paragraph la lb fp lc b ld le lf lg lh li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;56ae&quot;&gt;3. &lt;strong class=&quot;lc fq&quot;&gt;GetGpt4oImageResponse Method&lt;/strong&gt;:&lt;/p&gt;&lt;ul class=&quot;&quot;&gt;&lt;li class=&quot;la lb fp lc b ld le lf lg lh li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx np nq nr bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;29a8&quot;&gt;This is where the fun begins! We define an asynchronous method to process the image URL.&lt;/li&gt;&lt;li class=&quot;la lb fp lc b ld ns lf lg lh nt lj lk ll nu ln lo lp nv lr ls lt nw lv lw lx np nq nr bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;bae3&quot;&gt;&lt;strong class=&quot;lc fq&quot;&gt;Kernel Creation&lt;/strong&gt;:
 We create a kernel builder and add our GPT-4o chat completion service. 
Think of the kernel as the magical cauldron where all the ingredients 
mix together.&lt;/li&gt;&lt;li class=&quot;la lb fp lc b ld ns lf lg lh nt lj lk ll nu ln lo lp nv lr ls lt nw lv lw lx np nq nr bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;1772&quot;&gt;&lt;strong class=&quot;lc fq&quot;&gt;Chat Service&lt;/strong&gt;:
 We get the chat service from the kernel. This service is like our 
friendly neighborhood barista who knows exactly how we like our coffee.&lt;/li&gt;&lt;li class=&quot;la lb fp lc b ld ns lf lg lh nt lj lk ll nu ln lo lp nv lr ls lt nw lv lw lx np nq nr bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;b9ad&quot;&gt;&lt;strong class=&quot;lc fq&quot;&gt;Chat History&lt;/strong&gt;:
 We initialize the chat history and add a system message to set the tone
 for our AI assistant. We want our assistant to be friendly and helpful,
 just like your favorite support agent.&lt;/li&gt;&lt;li class=&quot;la lb fp lc b ld ns lf lg lh nt lj lk ll nu ln lo lp nv lr ls lt nw lv lw lx np nq nr bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;aaaf&quot;&gt;&lt;strong class=&quot;lc fq&quot;&gt;User Message&lt;/strong&gt;:
 We create a message collection with a text prompt and the image URL. 
This is like giving the barista your order — “I want a detailed analysis
 with extra foam, please!”&lt;/li&gt;&lt;li class=&quot;la lb fp lc b ld ns lf lg lh nt lj lk ll nu ln lo lp nv lr ls lt nw lv lw lx np nq nr bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;05b2&quot;&gt;&lt;strong class=&quot;lc fq&quot;&gt;Response Handling&lt;/strong&gt;:
 We send the message to the chat service and wait for the response. If 
all goes well, we return the content. If something goes wrong, we catch 
the exception and return the error message (because nobody likes an 
unhandled exception ruining the party).&lt;/li&gt;&lt;/ul&gt;&lt;h1 class=&quot;mm mn fp be mo mp mq mr ms mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;c53b&quot;&gt;Configuration — The Secret Sauce&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph la lb fp lc b ld nk lf lg lh nl lj lk ll nm ln lo lp nn lr ls lt no lv lw lx fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;c3ab&quot;&gt;Finally, let’s not forget the configuration setup in &lt;code class=&quot;cw oh oi oj ny b&quot;&gt;Program.cs&lt;/code&gt;:&lt;/p&gt;&lt;pre class=&quot;mb mc md me mf nx ny nz bo oa ba bj&quot;&gt;&lt;span class=&quot;ob mn fp ny b bf oc od l oe of&quot; data-selectable-paragraph=&quot;&quot; id=&quot;b0cb&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;using&lt;/span&gt; DotNetEnv;&lt;br /&gt;&lt;br /&gt;Env.Load();&lt;/span&gt;&lt;/pre&gt;&lt;p class=&quot;pw-post-body-paragraph la lb fp lc b ld le lf lg lh li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;2fdd&quot;&gt;This
 simple line ensures our environment variables are loaded, so our API 
keys and organization IDs are safely tucked away. It’s like having a 
secret recipe locked in a vault.&lt;/p&gt;&lt;h1 class=&quot;mm mn fp be mo mp mq mr ms mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;12d1&quot;&gt;Wrapping Up&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph la lb fp lc b ld nk lf lg lh nl lj lk ll nm ln lo lp nn lr ls lt no lv lw lx fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;5413&quot;&gt;And
 there you have it! In just a few lines of code, we’ve created a 
powerful image parser that uses .NET, Semantic Kernel, and GPT-4o to 
analyze images and return detailed descriptions. Now you can impress 
your friends, family, and maybe even your boss with your new found AI 
prowess.&lt;/p&gt;&lt;p class=&quot;pw-post-body-paragraph la lb fp lc b ld le lf lg lh li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;ccd2&quot;&gt;Remember,
 the key to keeping your code exciting is to blend functionality with a 
dash of humor and a sprinkle of creativity. Happy coding, and may your 
bugs be few and your features be many! 🎉&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://techiemate.blogspot.com/feeds/431376732781410473/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techiemate.blogspot.com/2024/07/building-smart-image-parser-with-net.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/431376732781410473'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/431376732781410473'/><link rel='alternate' type='text/html' href='http://techiemate.blogspot.com/2024/07/building-smart-image-parser-with-net.html' title='✨Building a Smart Image Parser with .NET, Semantic Kernel, and GPT-4o 🧿'/><author><name>Atanu Gupta</name><uri>http://www.blogger.com/profile/05529718294081550882</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_LZ_SzyDY_u8HW4LiUYlsEJKSSMR5zYs-ow0dK7kjPtYVYnB_nHhGXM3Ad8Gt9AxMhbi0UO3mSjuYBQq2Sli5kUe05z21o-xTJYAM-Pw6TErhMe4ITlrqdadJSCp_xYQS1rf5k8diG7IlmVmai1fllCvN7o9A8b0JSaV5Gn6SCwv5zw/s220/1714907742840.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgX9rp869t_wIiK1Lo8TIj1IUqNO5WJHhoWhJuXm47HpYaPoBIQgv6RQ_xrdHscQPHm3O80PZRzZA-N8kdy7gdl4PTS_MGCL2FFYgJyWmvk19GZ8_huViENdGxDYREn6p2rIOIbnBnoljOhTNZEZycCr0tyXwQIRZ2s7_8AQMv6A4zkVIu0n8nt_ubpqdQ/s72-w640-h312-c/Home-Page-AzureSemanticKernel-AI.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6011381329995167460.post-5157601003834861023</id><published>2024-06-28T17:50:00.002+05:30</published><updated>2024-07-01T10:45:15.986+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term=".Net"/><category scheme="http://www.blogger.com/atom/ns#" term="AI"/><category scheme="http://www.blogger.com/atom/ns#" term="Azure"/><category scheme="http://www.blogger.com/atom/ns#" term="Azure Open AI"/><category scheme="http://www.blogger.com/atom/ns#" term="Bot"/><category scheme="http://www.blogger.com/atom/ns#" term="Gen AI"/><title type='text'>✨Building an Engaging Chat Program with Azure OpenAI and .NET Semantic Kernel 🧿</title><content type='html'>&lt;p&gt;In the ever-evolving landscape of artificial intelligence and cloud 
computing, creating interactive and intelligent applications has become 
more accessible and powerful. Today, we’ll dive into the fascinating 
world of integrating Azure OpenAI with .NET Semantic Kernel to build a 
simple yet engaging chat program. This blog post will walk you through 
the key components of the application, highlighting the elegance and 
efficiency of the integration.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5vt1VUBSuDXchLRTgoZMXZvxH7SGyqfT8htgAFnJ-vW-2G6_dWQUp5IlreeID95l0orK9V2yn0JfbDEE6VlrjjDKc5gBb9l1e84aPZ8MDCWOUu8qTnfi5EwTzdw-xB6Ra0zPtbgZkvKp1QiYYIAEV0Q4rQnQa_Q3qc2k3ctxdadBe1ubsMd1YGW8qAkM/s748/81f01ij0a2L._AC_UF1000,1000_QL80_.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;528&quot; data-original-width=&quot;748&quot; height=&quot;452&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5vt1VUBSuDXchLRTgoZMXZvxH7SGyqfT8htgAFnJ-vW-2G6_dWQUp5IlreeID95l0orK9V2yn0JfbDEE6VlrjjDKc5gBb9l1e84aPZ8MDCWOUu8qTnfi5EwTzdw-xB6Ra0zPtbgZkvKp1QiYYIAEV0Q4rQnQa_Q3qc2k3ctxdadBe1ubsMd1YGW8qAkM/w640-h452/81f01ij0a2L._AC_UF1000,1000_QL80_.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&amp;nbsp;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;h1 class=&quot;mm mn fp be mo mp mq mr ms mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;638a&quot;&gt;Setting the Stage: Loading Configuration&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph la lb fp lc b ld nk lf lg lh nl lj lk ll nm ln lo lp nn lr ls lt no lv lw lx fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;cc57&quot;&gt;The
 first step in our journey is setting up the environment configuration. 
Using the DotNetEnv library, we can effortlessly load environment 
variables from a &lt;code class=&quot;cw np nq nr ns b&quot;&gt;.env&lt;/code&gt; file. This approach keeps our sensitive information secure and makes the configuration process seamless.&lt;/p&gt;&lt;pre class=&quot;mb mc md me mf nt ns nu bo nv ba bj&quot;&gt;&lt;span class=&quot;nw mn fp ns b bf nx ny l nz oa&quot; data-selectable-paragraph=&quot;&quot; id=&quot;f6c9&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;using&lt;/span&gt; DotNetEnv;&lt;br /&gt;&lt;br /&gt;Env.Load();&lt;/span&gt;&lt;/pre&gt;&lt;p class=&quot;pw-post-body-paragraph la lb fp lc b ld le lf lg lh li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;134f&quot;&gt;This
 line of code ensures that our application can access the necessary 
Azure OpenAI credentials and other configuration details stored in the &lt;code class=&quot;cw np nq nr ns b&quot;&gt;.env&lt;/code&gt; file.&lt;/p&gt;&lt;h1 class=&quot;mm mn fp be mo mp mq mr ms mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;a512&quot;&gt;Initializing the Kernel: The Common Class&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph la lb fp lc b ld nk lf lg lh nl lj lk ll nm ln lo lp nn lr ls lt no lv lw lx fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;8238&quot;&gt;The heart of our chat program lies in the initialization of the Semantic Kernel. The &lt;code class=&quot;cw np nq nr ns b&quot;&gt;Common&lt;/code&gt; class is responsible for setting up the kernel using the credentials and model details from the environment variables.&lt;/p&gt;&lt;pre class=&quot;mb mc md me mf nt ns nu bo nv ba bj&quot;&gt;&lt;span class=&quot;nw mn fp ns b bf nx ny l nz oa&quot; data-selectable-paragraph=&quot;&quot; id=&quot;ef98&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;using&lt;/span&gt; Microsoft.SemanticKernel;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;namespace&lt;/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;AzureSemanticKernel.AI&lt;/span&gt;&lt;br /&gt;{&lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;Common&lt;/span&gt;&lt;br /&gt;    {&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;hljs-built_in&quot;&gt;string&lt;/span&gt; key = Environment.GetEnvironmentVariable(&lt;span class=&quot;hljs-string&quot;&gt;&quot;AZURE_OPENAI_KEY&quot;&lt;/span&gt;);&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;hljs-built_in&quot;&gt;string&lt;/span&gt; model = Environment.GetEnvironmentVariable(&lt;span class=&quot;hljs-string&quot;&gt;&quot;AZURE_OPENAI_MODEL&quot;&lt;/span&gt;);&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;hljs-built_in&quot;&gt;string&lt;/span&gt; endpoint = Environment.GetEnvironmentVariable(&lt;span class=&quot;hljs-string&quot;&gt;&quot;AZURE_OPENAI_ENDPOINT&quot;&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;        &lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;static&lt;/span&gt; Kernel &lt;span class=&quot;hljs-title&quot;&gt;initializeKernel&lt;/span&gt;()&lt;/span&gt;&lt;br /&gt;        {&lt;br /&gt;            &lt;span class=&quot;hljs-keyword&quot;&gt;var&lt;/span&gt; kernelBuilder = Kernel.CreateBuilder();&lt;br /&gt;            kernelBuilder.Services.AddAzureOpenAIChatCompletion(model, endpoint, key);&lt;br /&gt;            &lt;span class=&quot;hljs-keyword&quot;&gt;var&lt;/span&gt; kernel = kernelBuilder.Build();&lt;br /&gt;&lt;br /&gt;            &lt;span class=&quot;hljs-keyword&quot;&gt;return&lt;/span&gt; kernel;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;p class=&quot;pw-post-body-paragraph la lb fp lc b ld le lf lg lh li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;2cba&quot;&gt;In
 this class, we retrieve the API key, model, and endpoint from the 
environment variables and use them to configure the kernel. The &lt;code class=&quot;cw np nq nr ns b&quot;&gt;initializeKernel&lt;/code&gt; method creates and returns a fully initialized kernel ready to handle chat requests.&lt;/p&gt;&lt;h1 class=&quot;mm mn fp be mo mp mq mr ms mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;218d&quot;&gt;Bringing It All Together: The Main Controller&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph la lb fp lc b ld nk lf lg lh nl lj lk ll nm ln lo lp nn lr ls lt no lv lw lx fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;4cb2&quot;&gt;Now that we have our configuration and kernel setup, let’s look at how we can create a simple yet powerful chat controller. The &lt;code class=&quot;cw np nq nr ns b&quot;&gt;SimpleController&lt;/code&gt;
 class is where the magic happens. It receives user messages, processes 
them using the Semantic Kernel, and returns the responses.&lt;/p&gt;&lt;pre class=&quot;mb mc md me mf nt ns nu bo nv ba bj&quot;&gt;&lt;span class=&quot;nw mn fp ns b bf nx ny l nz oa&quot; data-selectable-paragraph=&quot;&quot; id=&quot;4bc7&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;using&lt;/span&gt; Microsoft.AspNetCore.Mvc;&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;using&lt;/span&gt; Microsoft.SemanticKernel;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;namespace&lt;/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;AzureSemanticKernel.AI.Controllers&lt;/span&gt;&lt;br /&gt;{&lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;SimpleController&lt;/span&gt; : &lt;span class=&quot;hljs-title&quot;&gt;Controller&lt;/span&gt;&lt;br /&gt;    {        &lt;br /&gt;        [&lt;span class=&quot;hljs-meta&quot;&gt;HttpPost&lt;/span&gt;]&lt;br /&gt;        &lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;async&lt;/span&gt; Task&amp;lt;&lt;span class=&quot;hljs-built_in&quot;&gt;string&lt;/span&gt;&amp;gt; &lt;span class=&quot;hljs-title&quot;&gt;GetChatKernelResponse&lt;/span&gt;(&lt;span class=&quot;hljs-params&quot;&gt;&lt;span class=&quot;hljs-built_in&quot;&gt;string&lt;/span&gt; userMessage&lt;/span&gt;)&lt;/span&gt;&lt;br /&gt;        {&lt;br /&gt;            &lt;span class=&quot;hljs-keyword&quot;&gt;try&lt;/span&gt;&lt;br /&gt;            {&lt;br /&gt;                &lt;span class=&quot;hljs-keyword&quot;&gt;var&lt;/span&gt; kernel = Common.initializeKernel();&lt;br /&gt;&lt;br /&gt;                &lt;span class=&quot;hljs-keyword&quot;&gt;var&lt;/span&gt; result = &lt;span class=&quot;hljs-keyword&quot;&gt;await&lt;/span&gt; kernel.InvokePromptAsync(userMessage);&lt;br /&gt;&lt;br /&gt;                &lt;span class=&quot;hljs-keyword&quot;&gt;return&lt;/span&gt; result.ToString();&lt;br /&gt;            }&lt;br /&gt;            &lt;span class=&quot;hljs-keyword&quot;&gt;catch&lt;/span&gt; (Exception ex)&lt;br /&gt;            {&lt;br /&gt;                &lt;span class=&quot;hljs-keyword&quot;&gt;return&lt;/span&gt; ex.Message;&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;p class=&quot;pw-post-body-paragraph la lb fp lc b ld le lf lg lh li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;130a&quot;&gt;The &lt;code class=&quot;cw np nq nr ns b&quot;&gt;GetChatKernelResponse&lt;/code&gt;
 action handles POST requests with user messages. It initializes the 
kernel, invokes the chat completion prompt, and returns the response. 
Error handling ensures that any exceptions are caught and their messages
 are returned to the user.&lt;/p&gt;&lt;p class=&quot;pw-post-body-paragraph la lb fp lc b ld le lf lg lh li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;130a&quot;&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;iframe allowfullscreen=&quot;&quot; class=&quot;BLOG_video_class&quot; height=&quot;266&quot; src=&quot;https://www.youtube.com/embed/SghgZAHfIV0&quot; width=&quot;546&quot; youtube-src-id=&quot;SghgZAHfIV0&quot;&gt;&lt;/iframe&gt;&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&amp;nbsp;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;h1 class=&quot;mm mn fp be mo mp mq mr ms mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;c50d&quot;&gt;Conclusion&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph la lb fp lc b ld nk lf lg lh nl lj lk ll nm ln lo lp nn lr ls lt no lv lw lx fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;107b&quot;&gt;By
 leveraging Azure OpenAI and .NET Semantic Kernel, we’ve created a 
simple yet robust chat program with just few lines of code. This 
integration demonstrates the power and flexibility of modern AI and 
cloud technologies. Whether you’re a seasoned developer or just 
starting, this project showcases how easily you can build engaging and 
intelligent applications.&lt;/p&gt;&lt;p class=&quot;pw-post-body-paragraph la lb fp lc b ld le lf lg lh li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;e1d2&quot;&gt;As
 AI continues to evolve, the possibilities for creating interactive and 
responsive applications are endless. Dive into the code, experiment with
 different models and prompts, and unleash the full potential of Azure 
OpenAI and .NET Semantic Kernel in your projects. Happy coding!&lt;/p&gt;&lt;p class=&quot;pw-post-body-paragraph la lb fp lc b ld le lf lg lh li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;130a&quot;&gt;&amp;nbsp;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://techiemate.blogspot.com/feeds/5157601003834861023/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techiemate.blogspot.com/2024/06/building-engaging-chat-program-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/5157601003834861023'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/5157601003834861023'/><link rel='alternate' type='text/html' href='http://techiemate.blogspot.com/2024/06/building-engaging-chat-program-with.html' title='✨Building an Engaging Chat Program with Azure OpenAI and .NET Semantic Kernel 🧿'/><author><name>Atanu Gupta</name><uri>http://www.blogger.com/profile/05529718294081550882</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_LZ_SzyDY_u8HW4LiUYlsEJKSSMR5zYs-ow0dK7kjPtYVYnB_nHhGXM3Ad8Gt9AxMhbi0UO3mSjuYBQq2Sli5kUe05z21o-xTJYAM-Pw6TErhMe4ITlrqdadJSCp_xYQS1rf5k8diG7IlmVmai1fllCvN7o9A8b0JSaV5Gn6SCwv5zw/s220/1714907742840.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5vt1VUBSuDXchLRTgoZMXZvxH7SGyqfT8htgAFnJ-vW-2G6_dWQUp5IlreeID95l0orK9V2yn0JfbDEE6VlrjjDKc5gBb9l1e84aPZ8MDCWOUu8qTnfi5EwTzdw-xB6Ra0zPtbgZkvKp1QiYYIAEV0Q4rQnQa_Q3qc2k3ctxdadBe1ubsMd1YGW8qAkM/s72-w640-h452-c/81f01ij0a2L._AC_UF1000,1000_QL80_.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6011381329995167460.post-7188226802234667307</id><published>2024-06-24T10:52:00.010+05:30</published><updated>2024-06-24T11:00:25.235+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Automation"/><category scheme="http://www.blogger.com/atom/ns#" term="Azure"/><category scheme="http://www.blogger.com/atom/ns#" term="Azure Service Bus"/><category scheme="http://www.blogger.com/atom/ns#" term="Business Continuity"/><category scheme="http://www.blogger.com/atom/ns#" term="Disaster Recovery"/><category scheme="http://www.blogger.com/atom/ns#" term="Failover"/><category scheme="http://www.blogger.com/atom/ns#" term="PowerShell"/><title type='text'>🎉 Automating Disaster Recovery for Azure Service Bus: A Seamless Solution ✨</title><content type='html'>&lt;p&gt;Disaster recovery is a critical component of any robust IT infrastructure. For &lt;strong class=&quot;lh fq&quot;&gt;Azure Service Bus&lt;/strong&gt;,
 a highly reliable cloud messaging service, automating the failover 
process is crucial for minimizing downtime and ensuring business 
continuity. While the Azure portal provides an easy way to initiate a 
failover with a click of a button, relying on manual intervention is not
 ideal for enterprise-grade solutions. Automation is the key.&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhr_8zidJKJhgH2LnEudXkPgadMDYc9js7MXA_NsO7XNDWOLbyQBSyR_9_snmyvMZ1i4kafCpkqligHqSa3FkPYpslDN3827CULuqANlA8qN-nsBXOOit8XS9Mb4PzBrU3xTK1EHCFUTE-HE91Ujyasej5FXT8TaeDRoPo0qaepLsXETYwzFED7vlBlTXY/s1200/img-cWihibf5BgxicXzwBCd5nKhm.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;677&quot; data-original-width=&quot;1200&quot; height=&quot;362&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhr_8zidJKJhgH2LnEudXkPgadMDYc9js7MXA_NsO7XNDWOLbyQBSyR_9_snmyvMZ1i4kafCpkqligHqSa3FkPYpslDN3827CULuqANlA8qN-nsBXOOit8XS9Mb4PzBrU3xTK1EHCFUTE-HE91Ujyasej5FXT8TaeDRoPo0qaepLsXETYwzFED7vlBlTXY/w640-h362/img-cWihibf5BgxicXzwBCd5nKhm.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;649c&quot;&gt;In
 this blog post, we’ll explore an automated approach to handling 
disaster recovery for Azure Service Bus using a PowerShell script. This 
script seamlessly initiates the failover process and manages the 
underlying tasks, making it easier for infrastructure architects to 
ensure continuity without manual intervention.&lt;/p&gt;&lt;h1 class=&quot;mr ms fp be mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl nm nn no bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;e029&quot;&gt;Why Automate Service Bus Failover?&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li np lk ll lm nq lo lp lq nr ls lt lu ns lw lx ly nt ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;c876&quot;&gt;Azure
 Service Bus offers geo-disaster recovery capabilities that ensure high 
availability and data protection. However, initiating a failover 
manually can be risky and not recommended in production scenarios. 
Automation provides several benefits:&lt;/p&gt;&lt;ol&gt;&lt;li class=&quot;lf lg fp lh b li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc nu nv nw bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;e90c&quot;&gt;&lt;strong class=&quot;lh fq&quot;&gt;Consistency&lt;/strong&gt;: Automated scripts ensure that the failover process is executed the same way every time, reducing the risk of human error.&lt;/li&gt;&lt;li class=&quot;lf lg fp lh b li nx lk ll lm ny lo lp lq nz ls lt lu oa lw lx ly ob ma mb mc nu nv nw bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;2be5&quot;&gt;&lt;strong class=&quot;lh fq&quot;&gt;Speed&lt;/strong&gt;: Automation can trigger failover processes instantly, minimizing downtime.&lt;/li&gt;&lt;li class=&quot;lf lg fp lh b li nx lk ll lm ny lo lp lq nz ls lt lu oa lw lx ly ob ma mb mc nu nv nw bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;62e6&quot;&gt;&lt;strong class=&quot;lh fq&quot;&gt;Efficiency&lt;/strong&gt;: Automated processes can handle multiple tasks simultaneously, such as reconfiguring namespaces and cleaning up resources.&lt;/li&gt;&lt;/ol&gt;&lt;h1 class=&quot;mr ms fp be mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl nm nn no bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;08e0&quot;&gt;Understanding the Burn Down of the Primary Namespace&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li np lk ll lm nq lo lp lq nr ls lt lu ns lw lx ly nt ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;dfb8&quot;&gt;One
 critical aspect of Azure Service Bus failover is that after the 
failover, the primary namespace is essentially “burned down.” This means
 that the primary namespace becomes inactive, and all its entities, such
 as queues and topics, need to be cleaned up. This cleanup process 
ensures that the primary namespace is ready to be reconfigured or 
decommissioned.&lt;/p&gt;&lt;h1 class=&quot;mr ms fp be mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl nm nn no bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;51ac&quot;&gt;The PowerShell Script&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li np lk ll lm nq lo lp lq nr ls lt lu ns lw lx ly nt ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;857a&quot;&gt;Let’s
 dive into the PowerShell script that automates the Azure Service Bus 
failover process. This script ensures that the primary and secondary 
namespaces are provisioned and manages the failover with minimal manual 
intervention.&lt;/p&gt;&lt;h2 class=&quot;oc ms fp be mt od oe of mx og oh oi nb lq oj ok ol lu om on oo ly op oq or os bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;225d&quot;&gt;Step 1: Parameter Initialization&lt;/h2&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li np lk ll lm nq lo lp lq nr ls lt lu ns lw lx ly nt ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;b57f&quot;&gt;First,
 we set the necessary parameters, such as subscription ID, resource 
group name, primary and secondary namespaces, and the alias name.&lt;/p&gt;&lt;pre class=&quot;mg mh mi mj mk ot ou ov bo ow ba bj&quot;&gt;&lt;span class=&quot;ox ms fp ou b bf oy oz l pa pb&quot; data-selectable-paragraph=&quot;&quot; id=&quot;d0a3&quot;&gt;&lt;span class=&quot;hljs-variable&quot;&gt;$connection&lt;/span&gt; = Connect-AzAccount -ErrorAction Stop&lt;br /&gt;Write-Host &lt;span class=&quot;hljs-string&quot;&gt;&quot;Connected to Azure successfully.&quot;&lt;/span&gt; -ForegroundColor Yellow&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-comment&quot;&gt;#************** Parameters ********************************************************************************************************************&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;hljs-variable&quot;&gt;$subscriptionId&lt;/span&gt; = &lt;span class=&quot;hljs-string&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;hljs-variable&quot;&gt;$resourceGroupName&lt;/span&gt; = &lt;span class=&quot;hljs-string&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;hljs-variable&quot;&gt;$sbusPrimaryNamespace&lt;/span&gt; = &lt;span class=&quot;hljs-string&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;hljs-variable&quot;&gt;$sbusSecondaryNamespace&lt;/span&gt; = &lt;span class=&quot;hljs-string&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;hljs-variable&quot;&gt;$sbusAliasName&lt;/span&gt; = &lt;span class=&quot;hljs-string&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;br /&gt;$partnerId = &quot;/subscriptions/$subscriptionId/resourceGroups/$resourceGroupName/providers/Microsoft.ServiceBus/ `
             namespaces/$sbusPrimaryNamespace&quot;&lt;br /&gt;&lt;span class=&quot;hljs-comment&quot;&gt;#***********************************************************************************************************************************************&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;h2 class=&quot;oc ms fp be mt od oe of mx og oh oi nb lq oj ok ol lu om on oo ly op oq or os bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;b7e7&quot;&gt;Step 2: Provisioning Functions&lt;/h2&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li np lk ll lm nq lo lp lq nr ls lt lu ns lw lx ly nt ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;2a01&quot;&gt;We
 define functions to ensure that both namespaces are fully provisioned 
before and after the failover. These functions poll the provisioning 
state and wait until it reaches the ‘Succeeded’ state for both normal 
and Geo-provisioned.&lt;/p&gt;&lt;pre class=&quot;mg mh mi mj mk ot ou ov bo ow ba bj&quot;&gt;&lt;span class=&quot;ox ms fp ou b bf oy oz l pa pb&quot; data-selectable-paragraph=&quot;&quot; id=&quot;542e&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;function&lt;/span&gt; Wait-ForNamespaceProvisioning {&lt;br /&gt;    param (&lt;br /&gt;        [string]&lt;span class=&quot;hljs-variable&quot;&gt;$resourceGroupName&lt;/span&gt;,&lt;br /&gt;        [string]&lt;span class=&quot;hljs-variable&quot;&gt;$namespaceName&lt;/span&gt;&lt;br /&gt;    )&lt;br /&gt;    &lt;br /&gt;    &lt;span class=&quot;hljs-variable&quot;&gt;$maxRetries&lt;/span&gt; = 30&lt;br /&gt;    &lt;span class=&quot;hljs-variable&quot;&gt;$retryCount&lt;/span&gt; = 0&lt;br /&gt;    &lt;span class=&quot;hljs-variable&quot;&gt;$delay&lt;/span&gt; = 60  &lt;span class=&quot;hljs-comment&quot;&gt;# Delay in seconds between retries&lt;/span&gt;&lt;br /&gt;    &lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;do&lt;/span&gt; {&lt;br /&gt;        &lt;span class=&quot;hljs-variable&quot;&gt;$namespace&lt;/span&gt; = Get-AzServiceBusNamespace -ResourceGroupName &lt;span class=&quot;hljs-variable&quot;&gt;$resourceGroupName&lt;/span&gt; -NamespaceName &lt;span class=&quot;hljs-variable&quot;&gt;$namespaceName&lt;/span&gt;&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; (&lt;span class=&quot;hljs-variable&quot;&gt;$namespace&lt;/span&gt;.ProvisioningState -eq &lt;span class=&quot;hljs-string&quot;&gt;&quot;Succeeded&quot;&lt;/span&gt;) {&lt;br /&gt;            Write-Output &lt;span class=&quot;hljs-string&quot;&gt;&quot;Namespace &lt;span class=&quot;hljs-variable&quot;&gt;$namespaceName&lt;/span&gt; is provisioned.&quot;&lt;/span&gt;&lt;br /&gt;            &lt;span class=&quot;hljs-built_in&quot;&gt;return&lt;/span&gt;&lt;br /&gt;        }&lt;br /&gt;        &lt;br /&gt;        Write-Output &lt;span class=&quot;hljs-string&quot;&gt;&quot;Namespace &lt;span class=&quot;hljs-variable&quot;&gt;$namespaceName&lt;/span&gt; is still in provisioning state: &lt;span class=&quot;hljs-subst&quot;&gt;$($namespace.ProvisioningState)&lt;/span&gt;.&quot;&lt;/span&gt;&lt;br /&gt;        Start-Sleep -Seconds &lt;span class=&quot;hljs-variable&quot;&gt;$delay&lt;/span&gt;&lt;br /&gt;        &lt;span class=&quot;hljs-variable&quot;&gt;$retryCount&lt;/span&gt;++&lt;br /&gt;&lt;br /&gt;    } &lt;span class=&quot;hljs-keyword&quot;&gt;while&lt;/span&gt; (&lt;span class=&quot;hljs-variable&quot;&gt;$namespace&lt;/span&gt;.ProvisioningState -ne &lt;span class=&quot;hljs-string&quot;&gt;&quot;Succeeded&quot;&lt;/span&gt; -and &lt;span class=&quot;hljs-variable&quot;&gt;$retryCount&lt;/span&gt; -lt &lt;span class=&quot;hljs-variable&quot;&gt;$maxRetries&lt;/span&gt;)&lt;br /&gt;    &lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; (&lt;span class=&quot;hljs-variable&quot;&gt;$namespace&lt;/span&gt;.ProvisioningState -ne &lt;span class=&quot;hljs-string&quot;&gt;&quot;Succeeded&quot;&lt;/span&gt;) {&lt;br /&gt;        throw &lt;span class=&quot;hljs-string&quot;&gt;&quot;Namespace &lt;span class=&quot;hljs-variable&quot;&gt;$namespaceName&lt;/span&gt; did not reach &#39;Succeeded&#39; state within the allotted time.&quot;&lt;/span&gt;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;function&lt;/span&gt; Wait-ForNamespaceGeoProvisioning {&lt;br /&gt;    param (&lt;br /&gt;        [string]&lt;span class=&quot;hljs-variable&quot;&gt;$resourceGroupName&lt;/span&gt;,&lt;br /&gt;        [string]&lt;span class=&quot;hljs-variable&quot;&gt;$namespaceName&lt;/span&gt;&lt;br /&gt;    )&lt;br /&gt;    &lt;br /&gt;    &lt;span class=&quot;hljs-variable&quot;&gt;$maxRetries&lt;/span&gt; = 30&lt;br /&gt;    &lt;span class=&quot;hljs-variable&quot;&gt;$retryCount&lt;/span&gt; = 0&lt;br /&gt;    &lt;span class=&quot;hljs-variable&quot;&gt;$delay&lt;/span&gt; = 60  &lt;span class=&quot;hljs-comment&quot;&gt;# Delay in seconds between retries&lt;/span&gt;&lt;br /&gt;    &lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;do&lt;/span&gt; {&lt;br /&gt;        &lt;/span&gt;$namespace = Get-AzServiceBusGeoDRConfiguration -ResourceGroupName $resourceGroupName `
                     -NamespaceName $namespaceName&lt;/pre&gt;&lt;pre class=&quot;mg mh mi mj mk ot ou ov bo ow ba bj&quot;&gt;&lt;span class=&quot;ox ms fp ou b bf oy oz l pa pb&quot; data-selectable-paragraph=&quot;&quot;&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; (&lt;span class=&quot;hljs-variable&quot;&gt;$namespace&lt;/span&gt;.ProvisioningState -eq &lt;span class=&quot;hljs-string&quot;&gt;&quot;Succeeded&quot;&lt;/span&gt;) {&lt;br /&gt;            Write-Output &lt;span class=&quot;hljs-string&quot;&gt;&quot;Namespace &lt;span class=&quot;hljs-variable&quot;&gt;$namespaceName&lt;/span&gt; is geo provisioned.&quot;&lt;/span&gt;&lt;br /&gt;            &lt;span class=&quot;hljs-built_in&quot;&gt;return&lt;/span&gt;&lt;br /&gt;        }&lt;br /&gt;        &lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt;(&lt;span class=&quot;hljs-variable&quot;&gt;$null&lt;/span&gt; -eq &lt;span class=&quot;hljs-variable&quot;&gt;$namespace&lt;/span&gt;){ &lt;br /&gt;            Write-Output &lt;span class=&quot;hljs-string&quot;&gt;&quot;Namespace &lt;span class=&quot;hljs-variable&quot;&gt;$namespaceName&lt;/span&gt; is geo provisioned.&quot;&lt;/span&gt;&lt;br /&gt;            &lt;span class=&quot;hljs-built_in&quot;&gt;return&lt;/span&gt; &lt;br /&gt;        }&lt;br /&gt;        &lt;br /&gt;        Write-Output &lt;span class=&quot;hljs-string&quot;&gt;&quot;Namespace &lt;span class=&quot;hljs-variable&quot;&gt;$namespaceName&lt;/span&gt; is still in geo provisioning state: &lt;span class=&quot;hljs-subst&quot;&gt;$($namespace.ProvisioningState)&lt;/span&gt;.&quot;&lt;/span&gt;&lt;br /&gt;        Start-Sleep -Seconds &lt;span class=&quot;hljs-variable&quot;&gt;$delay&lt;/span&gt;&lt;br /&gt;        &lt;span class=&quot;hljs-variable&quot;&gt;$retryCount&lt;/span&gt;++&lt;br /&gt;&lt;br /&gt;    } &lt;span class=&quot;hljs-keyword&quot;&gt;while&lt;/span&gt; (&lt;span class=&quot;hljs-variable&quot;&gt;$namespace&lt;/span&gt;.ProvisioningState -ne &lt;span class=&quot;hljs-string&quot;&gt;&quot;Succeeded&quot;&lt;/span&gt; -and &lt;span class=&quot;hljs-variable&quot;&gt;$retryCount&lt;/span&gt; -lt &lt;span class=&quot;hljs-variable&quot;&gt;$maxRetries&lt;/span&gt;)&lt;br /&gt;    &lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; (&lt;span class=&quot;hljs-variable&quot;&gt;$namespace&lt;/span&gt;.ProvisioningState -ne &lt;span class=&quot;hljs-string&quot;&gt;&quot;Succeeded&quot;&lt;/span&gt;) {&lt;br /&gt;        throw &lt;span class=&quot;hljs-string&quot;&gt;&quot;Namespace &lt;span class=&quot;hljs-variable&quot;&gt;$namespaceName&lt;/span&gt; did not reach &#39;Succeeded&#39; state within the allotted time.&quot;&lt;/span&gt;&lt;br /&gt;    }&lt;br /&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;h2 class=&quot;oc ms fp be mt od oe of mx og oh oi nb lq oj ok ol lu om on oo ly op oq or os bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;145d&quot;&gt;Step 3: Combined Provisioning Function&lt;/h2&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li np lk ll lm nq lo lp lq nr ls lt lu ns lw lx ly nt ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;0a1a&quot;&gt;This function ensures that both the primary and secondary namespaces are provisioned.&lt;/p&gt;&lt;pre class=&quot;mg mh mi mj mk ot ou ov bo ow ba bj&quot;&gt;&lt;span class=&quot;ox ms fp ou b bf oy oz l pa pb&quot; data-selectable-paragraph=&quot;&quot; id=&quot;e394&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;function&lt;/span&gt; Wait-ForNamespaceAndGeoProvisining {&lt;br /&gt;    param (&lt;br /&gt;        [string]&lt;span class=&quot;hljs-variable&quot;&gt;$resourceGroupName&lt;/span&gt;,&lt;br /&gt;        [string]&lt;span class=&quot;hljs-variable&quot;&gt;$PrimaryNamespace&lt;/span&gt;,&lt;br /&gt;        [string]&lt;span class=&quot;hljs-variable&quot;&gt;$SecondaryNamespace&lt;/span&gt;&lt;br /&gt;    )&lt;br /&gt;&lt;br /&gt;    Wait-ForNamespaceProvisioning -resourceGroupName &lt;span class=&quot;hljs-variable&quot;&gt;$resourceGroupName&lt;/span&gt; -namespaceName &lt;span class=&quot;hljs-variable&quot;&gt;$PrimaryNamespace&lt;/span&gt;&lt;br /&gt;    Wait-ForNamespaceProvisioning -resourceGroupName &lt;span class=&quot;hljs-variable&quot;&gt;$resourceGroupName&lt;/span&gt; -namespaceName &lt;span class=&quot;hljs-variable&quot;&gt;$SecondaryNamespace&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    Wait-ForNamespaceGeoProvisioning -resourceGroupName &lt;span class=&quot;hljs-variable&quot;&gt;$resourceGroupName&lt;/span&gt; -namespaceName &lt;span class=&quot;hljs-variable&quot;&gt;$PrimaryNamespace&lt;/span&gt;&lt;br /&gt;    Wait-ForNamespaceGeoProvisioning -resourceGroupName &lt;span class=&quot;hljs-variable&quot;&gt;$resourceGroupName&lt;/span&gt; -namespaceName &lt;span class=&quot;hljs-variable&quot;&gt;$SecondaryNamespace&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;hljs-built_in&quot;&gt;return&lt;/span&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;h2 class=&quot;oc ms fp be mt od oe of mx og oh oi nb lq oj ok ol lu om on oo ly op oq or os bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;90dd&quot;&gt;Step 4: Initiate Failover&lt;/h2&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li np lk ll lm nq lo lp lq nr ls lt lu ns lw lx ly nt ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;26e8&quot;&gt;This
 section of the script handles the failover process itself, ensuring 
both namespaces are ready, initiating the failover, and then performing 
post-failover cleanup and reconfiguration.&lt;/p&gt;&lt;pre class=&quot;mg mh mi mj mk ot ou ov bo ow ba bj&quot;&gt;&lt;span class=&quot;ox ms fp ou b bf oy oz l pa pb&quot; data-selectable-paragraph=&quot;&quot; id=&quot;fb0b&quot;&gt;&lt;span class=&quot;hljs-comment&quot;&gt;#************** Initiate failover **************************************&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Wait-ForNamespaceAndGeoProvisining -resourceGroupName $resourceGroupName -PrimaryNamespace $sbusPrimaryNamespace `
                                   -SecondaryNamespace $sbusSecondaryNamespace&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot;mg mh mi mj mk ot ou ov bo ow ba bj&quot;&gt;&lt;span class=&quot;ox ms fp ou b bf oy oz l pa pb&quot; data-selectable-paragraph=&quot;&quot;&gt;Write-Output &lt;span class=&quot;hljs-string&quot;&gt;&quot;`nFailing Over : Azure Service Bus &lt;span class=&quot;hljs-variable&quot;&gt;$sbusPrimaryNamespace&lt;/span&gt; ...`n&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Set-AzServiceBusGeoDRConfigurationFailOver `&lt;br /&gt;    -Name &lt;span class=&quot;hljs-variable&quot;&gt;$sbusAliasName&lt;/span&gt; `&lt;br /&gt;    -ResourceGroupName &lt;span class=&quot;hljs-variable&quot;&gt;$resourceGroupName&lt;/span&gt; `&lt;br /&gt;    -NamespaceName &lt;span class=&quot;hljs-variable&quot;&gt;$sbusSecondaryNamespace&lt;/span&gt; `&lt;br /&gt;&lt;br /&gt;Wait-ForNamespaceAndGeoProvisining -resourceGroupName $resourceGroupName -PrimaryNamespace $sbusPrimaryNamespace `
                                   -SecondaryNamespace $sbusSecondaryNamespace
&lt;/span&gt;&lt;/pre&gt;&lt;div&gt;&lt;span class=&quot;ox ms fp ou b bf oy oz l pa pb&quot; data-selectable-paragraph=&quot;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;h2 class=&quot;oc ms fp be mt od oe of mx og oh oi nb lq oj ok ol lu om on oo ly op oq or os bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;0d3d&quot;&gt;Step 5: Cleanup After Failover&lt;/h2&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li np lk ll lm nq lo lp lq nr ls lt lu ns lw lx ly nt ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;dc8d&quot;&gt;Post-failover,
 we delete all queues in the primary namespace to clean up resources. 
This is crucial since the primary namespace will be “burned down” after 
the failover.&lt;/p&gt;&lt;pre class=&quot;mg mh mi mj mk ot ou ov bo ow ba bj&quot;&gt;&lt;span class=&quot;ox ms fp ou b bf oy oz l pa pb&quot; data-selectable-paragraph=&quot;&quot; id=&quot;9af5&quot;&gt;Write-Output &lt;span class=&quot;hljs-string&quot;&gt;&quot;`nDeleting all queues in the primary &lt;span class=&quot;hljs-variable&quot;&gt;$sbusPrimaryNamespace&lt;/span&gt; ...&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-variable&quot;&gt;$queues&lt;/span&gt; = Get-AzServiceBusQueue -ResourceGroupName &lt;span class=&quot;hljs-variable&quot;&gt;$resourceGroupName&lt;/span&gt; -NamespaceName &lt;span class=&quot;hljs-variable&quot;&gt;$sbusPrimaryNamespace&lt;/span&gt;&lt;br /&gt;foreach (&lt;span class=&quot;hljs-variable&quot;&gt;$queue&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;hljs-variable&quot;&gt;$queues&lt;/span&gt;) {&lt;br /&gt;    Remove-AzServiceBusQueue `&lt;br /&gt;        -ResourceGroupName &lt;span class=&quot;hljs-variable&quot;&gt;$resourceGroupName&lt;/span&gt; `&lt;br /&gt;        -NamespaceName &lt;span class=&quot;hljs-variable&quot;&gt;$sbusPrimaryNamespace&lt;/span&gt; `&lt;br /&gt;        -QueueName &lt;span class=&quot;hljs-variable&quot;&gt;$queue&lt;/span&gt;.Name&lt;br /&gt;&lt;br /&gt;    Write-Host &lt;span class=&quot;hljs-string&quot;&gt;&quot;Deleted queue: &lt;span class=&quot;hljs-subst&quot;&gt;$($queue.Name)&lt;/span&gt;&quot;&lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Wait-ForNamespaceAndGeoProvisining -resourceGroupName $resourceGroupName -PrimaryNamespace $sbusPrimaryNamespace `
                                   -SecondaryNamespace $sbusSecondaryNamespace&lt;/span&gt;&lt;/pre&gt;&lt;h2 class=&quot;oc ms fp be mt od oe of mx og oh oi nb lq oj ok ol lu om on oo ly op oq or os bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;05ce&quot;&gt;Step 6: Reconfiguration&lt;/h2&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li np lk ll lm nq lo lp lq nr ls lt lu ns lw lx ly nt ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;a3c6&quot;&gt;After cleaning up the primary namespace, the script sets the alias back to the secondary namespace.&lt;/p&gt;&lt;pre class=&quot;mg mh mi mj mk ot ou ov bo ow ba bj&quot;&gt;&lt;span class=&quot;ox ms fp ou b bf oy oz l pa pb&quot; data-selectable-paragraph=&quot;&quot; id=&quot;1e9b&quot;&gt;Write-Output &lt;span class=&quot;hljs-string&quot;&gt;&quot;`nSetting the alias back after failover ...&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;New-AzServiceBusGeoDRConfiguration `&lt;br /&gt;    -Name &lt;span class=&quot;hljs-variable&quot;&gt;$sbusAliasName&lt;/span&gt; `&lt;br /&gt;    -NamespaceName &lt;span class=&quot;hljs-variable&quot;&gt;$sbusSecondaryNamespace&lt;/span&gt; `&lt;br /&gt;    -ResourceGroupName &lt;span class=&quot;hljs-variable&quot;&gt;$resourceGroupName&lt;/span&gt; `&lt;br /&gt;    -PartnerNamespace &lt;span class=&quot;hljs-variable&quot;&gt;$partnerId&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Wait-ForNamespaceAndGeoProvisining -resourceGroupName $resourceGroupName -PrimaryNamespace $sbusPrimaryNamespace `
                                   -SecondaryNamespace $sbusSecondaryNamespace
&lt;br /&gt;Write-Output &lt;span class=&quot;hljs-string&quot;&gt;&quot;`nService Bus failover process completed successfully !!&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-comment&quot;&gt;#************** DONE ************************************************************&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Disconnect-AzAccount&lt;/span&gt;&lt;/pre&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;9488&quot;&gt;&lt;b&gt;Full codebase:&lt;/b&gt;&lt;/p&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;9488&quot;&gt;&lt;a href=&quot;https://github.com/AtanuGpt/AzureServiceBusDR/blob/main/failover.ps1&quot; target=&quot;_blank&quot;&gt;https://github.com/AtanuGpt/AzureServiceBusDR/blob/main/failover.ps1&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;h1 class=&quot;mr ms fp be mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl nm nn no bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;42d7&quot;&gt;Explanation of the Failover Process&lt;/h1&gt;&lt;ol&gt;&lt;li class=&quot;lf lg fp lh b li np lk ll lm nq lo lp lq nr ls lt lu ns lw lx ly nt ma mb mc nu nv nw bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;2e9d&quot;&gt;&lt;strong class=&quot;lh fq&quot;&gt;Initial Provisioning Check&lt;/strong&gt;: The script first ensures that both the primary and secondary namespaces are fully provisioned before initiating the failover.&lt;/li&gt;&lt;li class=&quot;lf lg fp lh b li nx lk ll lm ny lo lp lq nz ls lt lu oa lw lx ly ob ma mb mc nu nv nw bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;1efe&quot;&gt;&lt;strong class=&quot;lh fq&quot;&gt;Initiate Failover&lt;/strong&gt;: The failover process is initiated using &lt;code class=&quot;cw qb qc qd ou b&quot;&gt;Set-AzServiceBusGeoDRConfigurationFailOver&lt;/code&gt;, which switches the alias to the secondary namespace.&lt;/li&gt;&lt;li class=&quot;lf lg fp lh b li nx lk ll lm ny lo lp lq nz ls lt lu oa lw lx ly ob ma mb mc nu nv nw bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;7ca0&quot;&gt;&lt;strong class=&quot;lh fq&quot;&gt;Cleanup Primary Namespace&lt;/strong&gt;:
 After the failover, the script deletes all queues in the primary 
namespace. This step is critical because the primary namespace is 
effectively “burned down” or rendered inactive and cleaned up. This 
involves removing all entities (queues, topics, etc.) in the primary 
namespace.&lt;/li&gt;&lt;li class=&quot;lf lg fp lh b li nx lk ll lm ny lo lp lq nz ls lt lu oa lw lx ly ob ma mb mc nu nv nw bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;aded&quot;&gt;&lt;strong class=&quot;lh fq&quot;&gt;Reconfiguration&lt;/strong&gt;: The alias is reconfigured to point to the secondary namespace, ensuring continued operation.&lt;/li&gt;&lt;li class=&quot;lf lg fp lh b li nx lk ll lm ny lo lp lq nz ls lt lu oa lw lx ly ob ma mb mc nu nv nw bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;53f1&quot;&gt;&lt;strong class=&quot;lh fq&quot;&gt;Final Check&lt;/strong&gt;: The script performs a final check to ensure both namespaces are in the correct state post-failover.&lt;/li&gt;&lt;/ol&gt;&lt;h1 class=&quot;mr ms fp be mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl nm nn no bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;bd9c&quot;&gt;Conclusion&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li np lk ll lm nq lo lp lq nr ls lt lu ns lw lx ly nt ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;dd69&quot;&gt;Automating
 the disaster recovery process for Azure Service Bus is not just a 
convenience — it’s a necessity for maintaining high availability and 
ensuring business continuity. This PowerShell script provides a 
comprehensive solution, making the failover process seamless and 
efficient. By adopting automation, you can ensure that your Azure 
Service Bus environment is always prepared for any eventuality, keeping 
your services running smoothly even in the face of disruptions.&lt;/p&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;9488&quot;&gt;&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://techiemate.blogspot.com/feeds/7188226802234667307/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techiemate.blogspot.com/2024/06/automating-disaster-recovery-for-azure.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/7188226802234667307'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/7188226802234667307'/><link rel='alternate' type='text/html' href='http://techiemate.blogspot.com/2024/06/automating-disaster-recovery-for-azure.html' title='🎉 Automating Disaster Recovery for Azure Service Bus: A Seamless Solution ✨'/><author><name>Atanu Gupta</name><uri>http://www.blogger.com/profile/05529718294081550882</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_LZ_SzyDY_u8HW4LiUYlsEJKSSMR5zYs-ow0dK7kjPtYVYnB_nHhGXM3Ad8Gt9AxMhbi0UO3mSjuYBQq2Sli5kUe05z21o-xTJYAM-Pw6TErhMe4ITlrqdadJSCp_xYQS1rf5k8diG7IlmVmai1fllCvN7o9A8b0JSaV5Gn6SCwv5zw/s220/1714907742840.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhr_8zidJKJhgH2LnEudXkPgadMDYc9js7MXA_NsO7XNDWOLbyQBSyR_9_snmyvMZ1i4kafCpkqligHqSa3FkPYpslDN3827CULuqANlA8qN-nsBXOOit8XS9Mb4PzBrU3xTK1EHCFUTE-HE91Ujyasej5FXT8TaeDRoPo0qaepLsXETYwzFED7vlBlTXY/s72-w640-h362-c/img-cWihibf5BgxicXzwBCd5nKhm.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6011381329995167460.post-407384676586543540</id><published>2024-06-18T16:12:00.001+05:30</published><updated>2024-06-18T16:20:08.978+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Azure Speech"/><category scheme="http://www.blogger.com/atom/ns#" term="Google Speech"/><category scheme="http://www.blogger.com/atom/ns#" term="Langchain"/><category scheme="http://www.blogger.com/atom/ns#" term="LlamaIndex"/><category scheme="http://www.blogger.com/atom/ns#" term="Python&#xa;Gen AI&#xa;Data Science"/><category scheme="http://www.blogger.com/atom/ns#" term="RAG"/><title type='text'>🚀 Revolutionizing Document Interaction: An AI-Powered PDF Voice-2-Voice Chatbot Using LlamaIndex 🐑, Langchain 🔗 Azure AI Speech 🎤and Google Audio 🔊</title><content type='html'>&lt;p&gt;Welcome to the third and last installment of this series on innovative 
AI-driven chatbots. In our journey from basic text-based interactions to
 text-2-voice-enabled capabilities, we now introduce a 
voice-2-voice-enabled PDF chatbot. This advanced system allows users to 
interact verbally with their PDF documents, significantly enhancing 
accessibility and usability. Let’s explore how this chatbot works and 
its implications for users.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvt2q2CWn5pWOAyXzBCQjU7KjcM_21nvEG6oOpA0gM3OQAAcIxzrOTXFtlrv5LtSq8Xe_lI5mVwF5tBTuk9o4pAANklWItYtfzk_yjCBcZBuRj1D66fqbTwSO88OjRKYiDFCA-shS8nldH4l_0ODqaZIGozZs36Tbr_xyMbHR1z8eQSe0e5bsqg2rslFk/s1024/LlamaIndex-LangChain-B-1024x535.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;535&quot; data-original-width=&quot;1024&quot; height=&quot;334&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvt2q2CWn5pWOAyXzBCQjU7KjcM_21nvEG6oOpA0gM3OQAAcIxzrOTXFtlrv5LtSq8Xe_lI5mVwF5tBTuk9o4pAANklWItYtfzk_yjCBcZBuRj1D66fqbTwSO88OjRKYiDFCA-shS8nldH4l_0ODqaZIGozZs36Tbr_xyMbHR1z8eQSe0e5bsqg2rslFk/w640-h334/LlamaIndex-LangChain-B-1024x535.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;h2 class=&quot;mr ms fp be mt mu mv mw mx my mz na nb lq nc nd ne lu nf ng nh ly ni nj nk nl bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;175a&quot;&gt;Evolution of Chatbots: From Text to Voice&lt;/h2&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li nm lk ll lm nn lo lp lq no ls lt lu np lw lx ly nq ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;d98e&quot;&gt;In
 our initial blog post, we introduced a text-based chatbot capable of 
processing queries from uploaded documents. This laid the groundwork for
 seamless interaction with textual information.&lt;/p&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li nm lk ll lm nn lo lp lq no ls lt lu np lw lx ly nq ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;d98e&quot;&gt;&lt;a href=&quot;http://techiemate.blogspot.com/2024/06/revolutionizing-document-interaction-ai.html&quot; target=&quot;_blank&quot;&gt;http://techiemate.blogspot.com/2024/06/revolutionizing-document-interaction-ai.html&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li nm lk ll lm nn lo lp lq no ls lt lu np lw lx ly nq ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;d98e&quot;&gt;Building on this, our second post showcased text to voice recognition 
integration, an interactive voice assistant capable of understanding and
 reading out the answer from the content in your PDFs. This enhancement 
marked a significant leap towards intuitive user engagement, catering to
 diverse user preferences and accessibility needs.&lt;/p&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li nm lk ll lm nn lo lp lq no ls lt lu np lw lx ly nq ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;d98e&quot;&gt;&lt;a href=&quot;http://techiemate.blogspot.com/2024/06/revolutionizing-document-interaction-ai_13.html&quot; target=&quot;_blank&quot;&gt;http://techiemate.blogspot.com/2024/06/revolutionizing-document-interaction-ai_13.html&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;h2 class=&quot;mr ms fp be mt mu mv mw mx my mz na nb lq nc nd ne lu nf ng nh ly ni nj nk nl bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;302b&quot;&gt;Introducing Voice-to-Voice Interaction with PDFs&lt;/h2&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li nm lk ll lm nn lo lp lq no ls lt lu np lw lx ly nq ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;da8c&quot;&gt;Today,
 we introduce our latest innovation: a voice-enabled PDF chatbot capable
 of both transcribing spoken queries and delivering spoken responses 
directly from PDF documents. This breakthrough technology bridges 
traditional document interaction with modern voice-driven interfaces, 
offering a transformative user experience.&lt;/p&gt;&lt;h2 class=&quot;mr ms fp be mt mu mv mw mx my mz na nb lq nc nd ne lu nf ng nh ly ni nj nk nl bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;8bb9&quot;&gt;The Technical Backbone: Exploring the Codebase&lt;/h2&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li nm lk ll lm nn lo lp lq no ls lt lu np lw lx ly nq ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;86c8&quot;&gt;Let’s delve into the technical components that power our voice-enabled PDF chatbot:&lt;/p&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;85df&quot;&gt;Setting Up Dependencies and Environment&lt;/p&gt;&lt;pre class=&quot;mg mh mi mj mk or os ot bo ou ba bj&quot;&gt;&lt;span class=&quot;ov ms fp os b bf ow ox l oy oz&quot; data-selectable-paragraph=&quot;&quot; id=&quot;17cf&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; os&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; faiss&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; streamlit &lt;span class=&quot;hljs-keyword&quot;&gt;as&lt;/span&gt; st&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;from&lt;/span&gt; dotenv &lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; load_dotenv&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;from&lt;/span&gt; langchain_core.messages &lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; AIMessage, HumanMessage&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;from&lt;/span&gt; llama_index.core &lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; VectorStoreIndex, SimpleDirectoryReader, StorageContext, load_index_from_storage&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;from&lt;/span&gt; llama_index.vector_stores.faiss &lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; FaissVectorStore&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; azure.cognitiveservices.speech &lt;span class=&quot;hljs-keyword&quot;&gt;as&lt;/span&gt; speechsdk&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; speech_recognition &lt;span class=&quot;hljs-keyword&quot;&gt;as&lt;/span&gt; sr&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-comment&quot;&gt;# Initialize Faiss index for vectorization&lt;/span&gt;&lt;br /&gt;d = &lt;span class=&quot;hljs-number&quot;&gt;1536&lt;/span&gt;&lt;br /&gt;faiss_index = faiss.IndexFlatL2(d)&lt;br /&gt;PERSIST_DIR = &lt;span class=&quot;hljs-string&quot;&gt;&quot;./storage&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-comment&quot;&gt;# Load environment variables&lt;/span&gt;&lt;br /&gt;load_dotenv()&lt;/span&gt;&lt;/pre&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;cf81&quot;&gt;The code snippet above sets up necessary dependencies:&lt;/p&gt;&lt;ul class=&quot;&quot;&gt;&lt;li class=&quot;lf lg fp lh b li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc pa pb pc bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;9dd0&quot;&gt;&lt;strong class=&quot;lh fq&quot;&gt;Faiss&lt;/strong&gt;: Utilized for efficient document vectorization, enabling similarity search based on content.&lt;/li&gt;&lt;li class=&quot;lf lg fp lh b li pd lk ll lm pe lo lp lq pf ls lt lu pg lw lx ly ph ma mb mc pa pb pc bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;590a&quot;&gt;&lt;strong class=&quot;lh fq&quot;&gt;Streamlit&lt;/strong&gt;: Facilitates the user interface for seamless interaction with the chatbot and document upload functionality.&lt;/li&gt;&lt;li class=&quot;lf lg fp lh b li pd lk ll lm pe lo lp lq pf ls lt lu pg lw lx ly ph ma mb mc pa pb pc bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;7c3d&quot;&gt;&lt;strong class=&quot;lh fq&quot;&gt;LangChain&lt;/strong&gt;: Powers the message handling and communication within the chatbot interface.&lt;/li&gt;&lt;li class=&quot;lf lg fp lh b li pd lk ll lm pe lo lp lq pf ls lt lu pg lw lx ly ph ma mb mc pa pb pc bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;4d55&quot;&gt;&lt;strong class=&quot;lh fq&quot;&gt;LlamaIndex&lt;/strong&gt;: Manages the storage and retrieval of vectorized document data, optimizing query performance.&lt;/li&gt;&lt;li class=&quot;lf lg fp lh b li pd lk ll lm pe lo lp lq pf ls lt lu pg lw lx ly ph ma mb mc pa pb pc bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;fdf1&quot;&gt;&lt;strong class=&quot;lh fq&quot;&gt;Azure Cognitive Services (Speech SDK)&lt;/strong&gt;: Provides capabilities for speech recognition and synthesis, enabling the chatbot to transcribe and respond to spoken queries.&lt;/li&gt;&lt;li class=&quot;lf lg fp lh b li pd lk ll lm pe lo lp lq pf ls lt lu pg lw lx ly ph ma mb mc pa pb pc bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;7620&quot;&gt;&lt;strong class=&quot;lh fq&quot;&gt;Google Audio&lt;/strong&gt; : Provides speech into text using Google’s speech recognition API.&lt;/li&gt;&lt;/ul&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;0350&quot;&gt;Document Handling and Vectorization&lt;/p&gt;&lt;pre class=&quot;mg mh mi mj mk or os ot bo ou ba bj&quot;&gt;&lt;span class=&quot;ov ms fp os b bf ow ox l oy oz&quot; data-selectable-paragraph=&quot;&quot; id=&quot;9b11&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;hljs-title.function&quot;&gt;saveUploadedFiles&lt;/span&gt;(&lt;span class=&quot;hljs-params&quot;&gt;pdf_docs&lt;/span&gt;):&lt;br /&gt;    UPLOAD_DIR = &lt;span class=&quot;hljs-string&quot;&gt;&#39;uploaded_files&#39;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;try&lt;/span&gt;:&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;for&lt;/span&gt; pdf &lt;span class=&quot;hljs-keyword&quot;&gt;in&lt;/span&gt; pdf_docs:&lt;br /&gt;            file_path = os.path.join(UPLOAD_DIR, pdf.name)&lt;br /&gt;            &lt;span class=&quot;hljs-keyword&quot;&gt;with&lt;/span&gt; &lt;span class=&quot;hljs-built_in&quot;&gt;open&lt;/span&gt;(file_path, &lt;span class=&quot;hljs-string&quot;&gt;&quot;wb&quot;&lt;/span&gt;) &lt;span class=&quot;hljs-keyword&quot;&gt;as&lt;/span&gt; f:&lt;br /&gt;                f.write(pdf.getbuffer())&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&quot;Done&quot;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;except&lt;/span&gt;:&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&quot;Error&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;hljs-title.function&quot;&gt;doVectorization&lt;/span&gt;():&lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;try&lt;/span&gt;:&lt;br /&gt;        vector_store = FaissVectorStore(faiss_index=faiss_index)&lt;br /&gt;        storage_context = StorageContext.from_defaults(vector_store=vector_store)&lt;br /&gt;        documents = SimpleDirectoryReader(&lt;span class=&quot;hljs-string&quot;&gt;&quot;./uploaded_files&quot;&lt;/span&gt;).load_data()&lt;br /&gt;        index = VectorStoreIndex.from_documents(&lt;br /&gt;            documents,&lt;br /&gt;            storage_context=storage_context&lt;br /&gt;        )&lt;br /&gt;        index.storage_context.persist()&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&quot;Done&quot;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;except&lt;/span&gt;:&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&quot;Error&quot;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;490a&quot;&gt;The &lt;code class=&quot;cw pi pj pk os b&quot;&gt;saveUploadedFiles&lt;/code&gt; function saves PDF documents uploaded by users to a designated directory (&lt;code class=&quot;cw pi pj pk os b&quot;&gt;uploaded_files&lt;/code&gt;). The &lt;code class=&quot;cw pi pj pk os b&quot;&gt;doVectorization&lt;/code&gt; function utilizes Faiss to vectorize these documents, making them searchable based on content similarities.&lt;/p&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;bbe3&quot;&gt;Speech Recognition and Transcription&lt;/p&gt;&lt;pre class=&quot;mg mh mi mj mk or os ot bo ou ba bj&quot;&gt;&lt;span class=&quot;ov ms fp os b bf ow ox l oy oz&quot; data-selectable-paragraph=&quot;&quot; id=&quot;ba81&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;hljs-title.function&quot;&gt;transcribe_audio&lt;/span&gt;():&lt;br /&gt;    recognizer = sr.Recognizer()&lt;br /&gt;    microphone = sr.Microphone()&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;with&lt;/span&gt; microphone &lt;span class=&quot;hljs-keyword&quot;&gt;as&lt;/span&gt; source:&lt;br /&gt;        recognizer.adjust_for_ambient_noise(source)&lt;br /&gt;        audio = recognizer.listen(source, timeout=&lt;span class=&quot;hljs-number&quot;&gt;20&lt;/span&gt;)&lt;br /&gt;    &lt;br /&gt;    st.write(&lt;span class=&quot;hljs-string&quot;&gt;&quot;🔄 Transcribing...&quot;&lt;/span&gt;)&lt;br /&gt;    &lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;try&lt;/span&gt;:&lt;br /&gt;        text = recognizer.recognize_google(audio)&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;return&lt;/span&gt; text&lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;except&lt;/span&gt; sr.RequestError:&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&quot;API unavailable or unresponsive&quot;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;except&lt;/span&gt; sr.UnknownValueError:&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&quot;Unable to recognize speech&quot;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;d681&quot;&gt;The &lt;code class=&quot;cw pi pj pk os b&quot;&gt;transcribe_audio&lt;/code&gt; function uses the &lt;code class=&quot;cw pi pj pk os b&quot;&gt;speech_recognition&lt;/code&gt;
 library to capture spoken queries from users via their microphone. It 
adjusts for ambient noise and listens for up to 20 seconds before 
transcribing the speech into text using Google&#39;s speech recognition API.&lt;/p&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;ae1f&quot;&gt;Querying and Fetching Data&lt;/p&gt;&lt;pre class=&quot;mg mh mi mj mk or os ot bo ou ba bj&quot;&gt;&lt;span class=&quot;ov ms fp os b bf ow ox l oy oz&quot; data-selectable-paragraph=&quot;&quot; id=&quot;1154&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;hljs-title.function&quot;&gt;fetchData&lt;/span&gt;(&lt;span class=&quot;hljs-params&quot;&gt;user_question&lt;/span&gt;):&lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;try&lt;/span&gt;:&lt;br /&gt;        vector_store = FaissVectorStore.from_persist_dir(&lt;span class=&quot;hljs-string&quot;&gt;&quot;./storage&quot;&lt;/span&gt;)&lt;br /&gt;        storage_context = StorageContext.from_defaults(&lt;br /&gt;            vector_store=vector_store, persist_dir=PERSIST_DIR&lt;br /&gt;        )&lt;br /&gt;        index = load_index_from_storage(storage_context=storage_context)&lt;br /&gt;        query_engine = index.as_query_engine()&lt;br /&gt;        response = query_engine.query(user_question)&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;hljs-built_in&quot;&gt;str&lt;/span&gt;(response)&lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;except&lt;/span&gt;:&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&quot;Error&quot;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;6a48&quot;&gt;The &lt;code class=&quot;cw pi pj pk os b&quot;&gt;fetchData&lt;/code&gt;
 function retrieves relevant information from vectorized documents based
 on user queries. It loads the persisted Faiss index from storage and 
queries it to find and return the most relevant information matching the
 user&#39;s question.&lt;/p&gt;&lt;h1 class=&quot;pl ms fp be mt pm pn po mx pp pq pr nb ps pt pu pv pw px py pz qa qb qc qd qe bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;b4ed&quot;&gt;Defining the Welcome Message&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li nm lk ll lm nn lo lp lq no ls lt lu np lw lx ly nq ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;d6e6&quot;&gt;The &lt;code class=&quot;cw pi pj pk os b&quot;&gt;WelcomeMessage&lt;/code&gt;
 variable contains a multi-line string that introduces users to the 
voice-enabled PDF chatbot. It encourages them to upload PDF documents 
and start asking questions:&lt;/p&gt;&lt;pre class=&quot;mg mh mi mj mk or os ot bo ou ba bj&quot;&gt;&lt;span class=&quot;ov ms fp os b bf ow ox l oy oz&quot; data-selectable-paragraph=&quot;&quot; id=&quot;8326&quot;&gt;WelcomeMessage = &lt;span class=&quot;hljs-string&quot;&gt;&quot;&quot;&quot;&lt;br /&gt;Hello, I am your PDF voice chatbot. Please upload your PDF documents and start asking questions to me. &lt;br /&gt;I would try my best to answer your questions from the documents.&lt;br /&gt;&quot;&quot;&quot;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;cbc3&quot;&gt;This
 message serves as the initial greeting when users interact with the 
chatbot, providing clear instructions on how to proceed.&lt;/p&gt;&lt;h1 class=&quot;pl ms fp be mt pm pn po mx pp pq pr nb ps pt pu pv pw px py pz qa qb qc qd qe bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;96e9&quot;&gt;Initializing Chat History and Azure Speech SDK Configuration&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li nm lk ll lm nn lo lp lq no ls lt lu np lw lx ly nq ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;8f0d&quot;&gt;The code block initializes the chat history and sets up configurations for Azure Speech SDK:&lt;/p&gt;&lt;pre class=&quot;mg mh mi mj mk or os ot bo ou ba bj&quot;&gt;&lt;span class=&quot;ov ms fp os b bf ow ox l oy oz&quot; data-selectable-paragraph=&quot;&quot; id=&quot;aa0f&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&quot;chat_history&quot;&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;in&lt;/span&gt; st.session_state:&lt;br /&gt;    st.session_state.chat_history = [&lt;br /&gt;        AIMessage(content=WelcomeMessage)&lt;br /&gt;    ]&lt;br /&gt;&lt;br /&gt;AZURE_SPEECH_KEY = os.getenv(&lt;span class=&quot;hljs-string&quot;&gt;&quot;AZURE_SPEECH_KEY&quot;&lt;/span&gt;)&lt;br /&gt;AZURE_SPEECH_REGION = os.getenv(&lt;span class=&quot;hljs-string&quot;&gt;&quot;AZURE_SPEECH_REGION&quot;&lt;/span&gt;)&lt;br /&gt;os.environ[&lt;span class=&quot;hljs-string&quot;&gt;&quot;OPENAI_API_KEY&quot;&lt;/span&gt;] = os.getenv(&lt;span class=&quot;hljs-string&quot;&gt;&quot;OPENAI_API_KEY&quot;&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;speech_config = speechsdk.SpeechConfig(subscription=AZURE_SPEECH_KEY, region=AZURE_SPEECH_REGION)&lt;br /&gt;speech_config.speech_synthesis_voice_name = &lt;span class=&quot;hljs-string&quot;&gt;&quot;en-US-AriaNeural&quot;&lt;/span&gt;&lt;br /&gt;speech_config.speech_synthesis_language = &lt;span class=&quot;hljs-string&quot;&gt;&quot;en-US&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;speech_synthesizer = speechsdk.SpeechSynthesizer(speech_config=speech_config)&lt;/span&gt;&lt;/pre&gt;&lt;ul class=&quot;&quot;&gt;&lt;li class=&quot;lf lg fp lh b li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc pa pb pc bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;b948&quot;&gt;&lt;strong class=&quot;lh fq&quot;&gt;Chat History Initialization&lt;/strong&gt;: Checks if &lt;code class=&quot;cw pi pj pk os b&quot;&gt;chat_history&lt;/code&gt; exists in the Streamlit session state. If not, it initializes it with the &lt;code class=&quot;cw pi pj pk os b&quot;&gt;WelcomeMessage&lt;/code&gt; wrapped in an &lt;code class=&quot;cw pi pj pk os b&quot;&gt;AIMessage&lt;/code&gt; object. This ensures that the chat starts with the welcome message displayed to the user.&lt;/li&gt;&lt;li class=&quot;lf lg fp lh b li pd lk ll lm pe lo lp lq pf ls lt lu pg lw lx ly ph ma mb mc pa pb pc bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;eb86&quot;&gt;&lt;strong class=&quot;lh fq&quot;&gt;Azure Speech SDK Configuration&lt;/strong&gt;: Retrieves Azure Speech API key and region from environment variables (&lt;code class=&quot;cw pi pj pk os b&quot;&gt;AZURE_SPEECH_KEY&lt;/code&gt; and &lt;code class=&quot;cw pi pj pk os b&quot;&gt;AZURE_SPEECH_REGION&lt;/code&gt;). It sets up a &lt;code class=&quot;cw pi pj pk os b&quot;&gt;SpeechConfig&lt;/code&gt; object for speech synthesis (&lt;code class=&quot;cw pi pj pk os b&quot;&gt;speech_synthesizer&lt;/code&gt;). The voice name and language are configured to use the &quot;en-US-AriaNeural&quot; voice for English (US).&lt;/li&gt;&lt;/ul&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;0b7d&quot;&gt;Streamlit Integration: User Interface Design&lt;/p&gt;&lt;pre class=&quot;mg mh mi mj mk or os ot bo ou ba bj&quot;&gt;&lt;span class=&quot;ov ms fp os b bf ow ox l oy oz&quot; data-selectable-paragraph=&quot;&quot; id=&quot;34a5&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;hljs-title.function&quot;&gt;main&lt;/span&gt;():&lt;br /&gt;    load_dotenv()  &lt;br /&gt;&lt;br /&gt;    st.set_page_config(&lt;br /&gt;        page_title=&lt;span class=&quot;hljs-string&quot;&gt;&quot;Chat with multiple PDFs&quot;&lt;/span&gt;,&lt;br /&gt;        page_icon=&lt;span class=&quot;hljs-string&quot;&gt;&quot;:sparkles:&quot;&lt;/span&gt;&lt;br /&gt;    )&lt;br /&gt;&lt;br /&gt;    st.header(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Chat with single or multiple PDFs :sparkles:&quot;&lt;/span&gt;)   &lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;for&lt;/span&gt; message &lt;span class=&quot;hljs-keyword&quot;&gt;in&lt;/span&gt; st.session_state.chat_history:&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;hljs-built_in&quot;&gt;isinstance&lt;/span&gt;(message, AIMessage):&lt;br /&gt;            &lt;span class=&quot;hljs-keyword&quot;&gt;with&lt;/span&gt; st.chat_message(&lt;span class=&quot;hljs-string&quot;&gt;&quot;AI&quot;&lt;/span&gt;):&lt;br /&gt;                st.markdown(message.content)&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;elif&lt;/span&gt; &lt;span class=&quot;hljs-built_in&quot;&gt;isinstance&lt;/span&gt;(message, HumanMessage):&lt;br /&gt;            &lt;span class=&quot;hljs-keyword&quot;&gt;with&lt;/span&gt; st.chat_message(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Human&quot;&lt;/span&gt;):&lt;br /&gt;                st.markdown(message.content)     &lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;with&lt;/span&gt; st.sidebar:&lt;br /&gt;        st.subheader(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Your documents&quot;&lt;/span&gt;)&lt;br /&gt;        pdf_docs = st.file_uploader(&lt;br /&gt;            &lt;span class=&quot;hljs-string&quot;&gt;&quot;Upload your PDFs here and click on &#39;Process&#39;&quot;&lt;/span&gt;, &lt;br /&gt;            accept_multiple_files=&lt;span class=&quot;hljs-literal&quot;&gt;True&lt;/span&gt;&lt;br /&gt;        )&lt;br /&gt;&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; st.button(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Process&quot;&lt;/span&gt;):&lt;br /&gt;            &lt;span class=&quot;hljs-keyword&quot;&gt;with&lt;/span&gt; st.spinner(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Processing&quot;&lt;/span&gt;):&lt;br /&gt;                IsFilesSaved = saveUploadedFiles(pdf_docs)&lt;br /&gt;                &lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; IsFilesSaved == &lt;span class=&quot;hljs-string&quot;&gt;&quot;Done&quot;&lt;/span&gt;:&lt;br /&gt;                    IsVectorized = doVectorization()&lt;br /&gt;                    &lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; IsVectorized == &lt;span class=&quot;hljs-string&quot;&gt;&quot;Done&quot;&lt;/span&gt;:&lt;br /&gt;                        st.session_state.isPdfProcessed = &lt;span class=&quot;hljs-string&quot;&gt;&quot;done&quot;&lt;/span&gt;&lt;br /&gt;                        st.success(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Done!&quot;&lt;/span&gt;)&lt;br /&gt;                    &lt;span class=&quot;hljs-keyword&quot;&gt;else&lt;/span&gt;:&lt;br /&gt;                        st.error(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Error! in vectorization&quot;&lt;/span&gt;)&lt;br /&gt;                &lt;span class=&quot;hljs-keyword&quot;&gt;else&lt;/span&gt;:&lt;br /&gt;                    st.error(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Error! in saving the files&quot;&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; st.button(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Start Asking Question&quot;&lt;/span&gt;):&lt;br /&gt;        st.write(&lt;span class=&quot;hljs-string&quot;&gt;&quot;🎤 Recording started...Ask your  question&quot;&lt;/span&gt;)&lt;br /&gt;        transcription = transcribe_audio()&lt;br /&gt;        st.write(&lt;span class=&quot;hljs-string&quot;&gt;&quot;✅ Recording ended&quot;&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;        st.session_state.chat_history.append(HumanMessage(content=transcription))&lt;br /&gt;&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;with&lt;/span&gt; st.chat_message(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Human&quot;&lt;/span&gt;):&lt;br /&gt;            st.markdown(transcription)&lt;br /&gt;        &lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;with&lt;/span&gt; st.chat_message(&lt;span class=&quot;hljs-string&quot;&gt;&quot;AI&quot;&lt;/span&gt;):&lt;br /&gt;            &lt;span class=&quot;hljs-keyword&quot;&gt;with&lt;/span&gt; st.spinner(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Fetching data ...&quot;&lt;/span&gt;):&lt;br /&gt;                response = fetchData(transcription)&lt;br /&gt;                st.markdown(response)    &lt;br /&gt;                &lt;br /&gt;        result = speech_synthesizer.speak_text_async(response).get()&lt;br /&gt;        st.session_state.chat_history.append(AIMessage(content=response))&lt;br /&gt;        &lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&quot;WelcomeMessage&quot;&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;in&lt;/span&gt; st.session_state:&lt;br /&gt;        st.session_state.WelcomeMessage = WelcomeMessage&lt;br /&gt;        result = speech_synthesizer.speak_text_async(WelcomeMessage).get()&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-comment&quot;&gt;#============================================================================================================&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; __name__ == &lt;span class=&quot;hljs-string&quot;&gt;&#39;__main__&#39;&lt;/span&gt;:&lt;br /&gt;    main()&lt;/span&gt;&lt;/pre&gt;&lt;h2 class=&quot;mr ms fp be mt mu mv mw mx my mz na nb lq nc nd ne lu nf ng nh ly ni nj nk nl bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;6001&quot;&gt;User Experience: Seamless Interaction&lt;/h2&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li nm lk ll lm nn lo lp lq no ls lt lu np lw lx ly nq ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;56e5&quot;&gt;Imagine
 uploading a collection of PDF documents — research papers, technical 
manuals, or reports — and simply speaking your questions aloud. The 
chatbot not only transcribes your speech but also responds audibly, 
providing immediate access to relevant information. This seamless 
interaction is particularly beneficial for users with visual impairments
 or those multitasking who prefer auditory information consumption.&lt;/p&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;d6cd&quot;&gt;Demo 💬🎤🤖&lt;/p&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;d6cd&quot;&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;iframe allowfullscreen=&quot;&quot; class=&quot;BLOG_video_class&quot; height=&quot;460&quot; src=&quot;https://www.youtube.com/embed/9xXJL4DfAN4&quot; width=&quot;553&quot; youtube-src-id=&quot;9xXJL4DfAN4&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;br /&gt;&amp;nbsp;&lt;p&gt;&lt;/p&gt;&lt;h2 class=&quot;mr ms fp be mt mu mv mw mx my mz na nb lq nc nd ne lu nf ng nh ly ni nj nk nl bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;5926&quot;&gt;Enhancing Accessibility and Efficiency&lt;/h2&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li nm lk ll lm nn lo lp lq no ls lt lu np lw lx ly nq ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;472c&quot;&gt;Our
 voice-enabled PDF chatbot represents a significant advancement in 
accessibility technology. By integrating speech recognition, document 
vectorization, and AI-driven query processing, we empower users to 
effortlessly interact with complex information. This technology not only
 enhances accessibility but also boosts efficiency by streamlining the 
process of retrieving information from documents.&lt;/p&gt;&lt;h2 class=&quot;mr ms fp be mt mu mv mw mx my mz na nb lq nc nd ne lu nf ng nh ly ni nj nk nl bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;0034&quot;&gt;Conclusion: Paving the Way Forward&lt;/h2&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li nm lk ll lm nn lo lp lq no ls lt lu np lw lx ly nq ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;ff1f&quot;&gt;As
 we continue to explore the capabilities of AI in enhancing user 
experiences, the voice-enabled PDF chatbot stands as a testament to 
innovation in accessibility and usability. Whether you’re a researcher 
seeking insights from academic papers or a professional referencing 
technical documents, this technology promises to revolutionize how we 
interact with information.&lt;/p&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;44e4&quot;&gt;Stay
 tuned as we push the boundaries further, exploring new applications and
 advancements in AI-driven technology. Stay connected and yes Happy 
Coding ! 😊&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://techiemate.blogspot.com/feeds/407384676586543540/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techiemate.blogspot.com/2024/06/revolutionizing-document-interaction-ai_18.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/407384676586543540'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/407384676586543540'/><link rel='alternate' type='text/html' href='http://techiemate.blogspot.com/2024/06/revolutionizing-document-interaction-ai_18.html' title='🚀 Revolutionizing Document Interaction: An AI-Powered PDF Voice-2-Voice Chatbot Using LlamaIndex 🐑, Langchain 🔗 Azure AI Speech 🎤and Google Audio 🔊'/><author><name>Atanu Gupta</name><uri>http://www.blogger.com/profile/05529718294081550882</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_LZ_SzyDY_u8HW4LiUYlsEJKSSMR5zYs-ow0dK7kjPtYVYnB_nHhGXM3Ad8Gt9AxMhbi0UO3mSjuYBQq2Sli5kUe05z21o-xTJYAM-Pw6TErhMe4ITlrqdadJSCp_xYQS1rf5k8diG7IlmVmai1fllCvN7o9A8b0JSaV5Gn6SCwv5zw/s220/1714907742840.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvt2q2CWn5pWOAyXzBCQjU7KjcM_21nvEG6oOpA0gM3OQAAcIxzrOTXFtlrv5LtSq8Xe_lI5mVwF5tBTuk9o4pAANklWItYtfzk_yjCBcZBuRj1D66fqbTwSO88OjRKYiDFCA-shS8nldH4l_0ODqaZIGozZs36Tbr_xyMbHR1z8eQSe0e5bsqg2rslFk/s72-w640-h334-c/LlamaIndex-LangChain-B-1024x535.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6011381329995167460.post-3727001314552186809</id><published>2024-06-13T16:01:00.004+05:30</published><updated>2024-06-13T16:11:23.044+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Artificial Intelligence"/><category scheme="http://www.blogger.com/atom/ns#" term="Azure Speech"/><category scheme="http://www.blogger.com/atom/ns#" term="Data Science"/><category scheme="http://www.blogger.com/atom/ns#" term="Gen AI"/><category scheme="http://www.blogger.com/atom/ns#" term="Langchain"/><category scheme="http://www.blogger.com/atom/ns#" term="LlamaIndex"/><category scheme="http://www.blogger.com/atom/ns#" term="Python"/><category scheme="http://www.blogger.com/atom/ns#" term="Streamlit"/><title type='text'>🚀 Revolutionizing Document Interaction: An AI-Powered PDF Text-2-Voice Chatbot Using LlamaIndex 🐑, Langchain 🔗 and Azure AI Speech 🔊</title><content type='html'>&lt;p&gt;&amp;nbsp;In this blog post, we’re diving into the creation of an intelligent PDF voice chatbot using cutting-edge technologies like &lt;a class=&quot;af md&quot; href=&quot;https://www.langchain.com/&quot; rel=&quot;noopener ugc nofollow&quot; target=&quot;_blank&quot;&gt;&lt;b class=&quot;lh fq&quot;&gt;LangChain&lt;/b&gt;&lt;/a&gt;, &lt;a class=&quot;af md&quot; href=&quot;https://www.llamaindex.ai/&quot; rel=&quot;noopener ugc nofollow&quot; target=&quot;_blank&quot;&gt;&lt;b class=&quot;lh fq&quot;&gt;LlamaIndex&lt;/b&gt;&lt;/a&gt;, and &lt;a class=&quot;af md&quot; href=&quot;https://azure.microsoft.com/en-in/products/ai-services/ai-speech&quot; rel=&quot;noopener ugc nofollow&quot; target=&quot;_blank&quot;&gt;&lt;b class=&quot;lh fq&quot;&gt;Azure AI Speech&lt;/b&gt;&lt;/a&gt;.
 This isn’t just another chatbot; it’s an interactive voice assistant 
capable of understanding and reading out the answer from the content in 
your PDFs. This project is a step up from my previous blog post where we
 explored building a text-based PDF chatbot without the voice 
functionality. If you missed that, be sure to check it out &lt;a href=&quot;http://techiemate.blogspot.com/2024/06/revolutionizing-document-interaction-ai.html&quot;&gt;&lt;span&gt;here&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiH0SgffQr2vdvtgavl54n5YkRMOErJEfjKKByBaJVIn7z069RhtTK2znWFug5bWy0jYIcXlbSDFMzEMF7q0qf6CSQNz4CZqruE__qLqePGR0Bm7iYzPFwH68DRYXWCq7M99iQinT-kKJ8wqIaOQzo5JQB9IqOopnfpPwa4JiqTfrJQCMz_MPueK_8REgs/s1024/LlamaIndex-LangChain-B-1024x535.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;535&quot; data-original-width=&quot;1024&quot; height=&quot;334&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiH0SgffQr2vdvtgavl54n5YkRMOErJEfjKKByBaJVIn7z069RhtTK2znWFug5bWy0jYIcXlbSDFMzEMF7q0qf6CSQNz4CZqruE__qLqePGR0Bm7iYzPFwH68DRYXWCq7M99iQinT-kKJ8wqIaOQzo5JQB9IqOopnfpPwa4JiqTfrJQCMz_MPueK_8REgs/w640-h334/LlamaIndex-LangChain-B-1024x535.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;h1 class=&quot;ms mt fp be mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl nm nn no np bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;27c3&quot;&gt;Technologies Used&lt;/h1&gt;&lt;ol class=&quot;&quot;&gt;&lt;li class=&quot;lf lg fp lh b li nq lk ll lm nr lo lp lq ns ls lt lu nt lw lx ly nu ma mb mc nv nw nx bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;e48a&quot;&gt;&lt;strong class=&quot;lh fq&quot;&gt;LangChain&lt;/strong&gt;: For chaining language models and building complex applications.&lt;/li&gt;&lt;li class=&quot;lf lg fp lh b li ny lk ll lm nz lo lp lq oa ls lt lu ob lw lx ly oc ma mb mc nv nw nx bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;dff6&quot;&gt;&lt;strong class=&quot;lh fq&quot;&gt;LlamaIndex&lt;/strong&gt;: To index and query documents efficiently.&lt;/li&gt;&lt;li class=&quot;lf lg fp lh b li ny lk ll lm nz lo lp lq oa ls lt lu ob lw lx ly oc ma mb mc nv nw nx bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;3741&quot;&gt;&lt;strong class=&quot;lh fq&quot;&gt;Azure AI Speech&lt;/strong&gt;: For speech synthesis, giving our bot a human-like voice.&lt;/li&gt;&lt;li class=&quot;lf lg fp lh b li ny lk ll lm nz lo lp lq oa ls lt lu ob lw lx ly oc ma mb mc nv nw nx bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;0033&quot;&gt;&lt;strong class=&quot;lh fq&quot;&gt;Streamlit&lt;/strong&gt;: To create a user-friendly web interface.&lt;/li&gt;&lt;/ol&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;56ab&quot;&gt;Let’s jump into the code and see how these technologies come together to create our voice assistant chatbot.&lt;/p&gt;&lt;h1 class=&quot;ms mt fp be mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl nm nn no np bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;d2e2&quot;&gt;Setting Up the Environment&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li nq lk ll lm nr lo lp lq ns ls lt lu nt lw lx ly nu ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;c671&quot;&gt;First, ensure you have all the necessary libraries installed. You can do this by running:&lt;/p&gt;&lt;pre class=&quot;mh mi mj mk ml od oe of bo og ba bj&quot;&gt;&lt;span class=&quot;oh mt fp oe b bf oi oj l ok ol&quot; data-selectable-paragraph=&quot;&quot; id=&quot;dd37&quot;&gt;pip install os faiss-cpu streamlit python-dotenv azure-cognitiveservices-speech langchain llama_index&lt;/span&gt;&lt;/pre&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;db1e&quot;&gt;Also, make sure you have your Azure Cognitive Services API keys ready.&lt;/p&gt;&lt;h1 class=&quot;ms mt fp be mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl nm nn no np bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;253f&quot;&gt;The Code&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li nq lk ll lm nr lo lp lq ns ls lt lu nt lw lx ly nu ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;0d05&quot;&gt;Here’s the complete code for our voice chatbot:&lt;/p&gt;&lt;pre class=&quot;mh mi mj mk ml od oe of bo og ba bj&quot;&gt;&lt;span class=&quot;oh mt fp oe b bf oi oj l ok ol&quot; data-selectable-paragraph=&quot;&quot; id=&quot;da7d&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; os&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; faiss&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; streamlit &lt;span class=&quot;hljs-keyword&quot;&gt;as&lt;/span&gt; st&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;from&lt;/span&gt; dotenv &lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; load_dotenv&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;from&lt;/span&gt; langchain_core.messages &lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; AIMessage, HumanMessage&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;from&lt;/span&gt; llama_index.core &lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; VectorStoreIndex, SimpleDirectoryReader, StorageContext, load_index_from_storage&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;from&lt;/span&gt; llama_index.vector_stores.faiss &lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; FaissVectorStore&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; azure.cognitiveservices.speech &lt;span class=&quot;hljs-keyword&quot;&gt;as&lt;/span&gt; speechsdk&lt;br /&gt;&lt;br /&gt;d = &lt;span class=&quot;hljs-number&quot;&gt;1536&lt;/span&gt;&lt;br /&gt;faiss_index = faiss.IndexFlatL2(d)&lt;br /&gt;PERSIST_DIR = &lt;span class=&quot;hljs-string&quot;&gt;&quot;./storage&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;AZURE_SPEECH_KEY = os.getenv(&lt;span class=&quot;hljs-string&quot;&gt;&quot;AZURE_SPEECH_KEY&quot;&lt;/span&gt;)&lt;br /&gt;AZURE_SPEECH_REGION = os.getenv(&lt;span class=&quot;hljs-string&quot;&gt;&quot;AZURE_SPEECH_REGION&quot;&lt;/span&gt;)&lt;br /&gt;OPENAI_API_KEY=os.getenv(&lt;span class=&quot;hljs-string&quot;&gt;&quot;OPENAI_API_KEY&quot;&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;hljs-title.function&quot;&gt;saveUploadedFiles&lt;/span&gt;(&lt;span class=&quot;hljs-params&quot;&gt;pdf_docs&lt;/span&gt;):&lt;br /&gt;    UPLOAD_DIR = &lt;span class=&quot;hljs-string&quot;&gt;&#39;uploaded_files&#39;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;try&lt;/span&gt;:&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;for&lt;/span&gt; pdf &lt;span class=&quot;hljs-keyword&quot;&gt;in&lt;/span&gt; pdf_docs:&lt;br /&gt;            file_path = os.path.join(UPLOAD_DIR, pdf.name)&lt;br /&gt;            &lt;span class=&quot;hljs-keyword&quot;&gt;with&lt;/span&gt; &lt;span class=&quot;hljs-built_in&quot;&gt;open&lt;/span&gt;(file_path, &lt;span class=&quot;hljs-string&quot;&gt;&quot;wb&quot;&lt;/span&gt;) &lt;span class=&quot;hljs-keyword&quot;&gt;as&lt;/span&gt; f:&lt;br /&gt;                f.write(pdf.getbuffer())&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&quot;Done&quot;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;except&lt;/span&gt;:&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&quot;Error&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;hljs-title.function&quot;&gt;doVectorization&lt;/span&gt;():    &lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;try&lt;/span&gt;:&lt;br /&gt;        vector_store = FaissVectorStore(faiss_index=faiss_index)&lt;br /&gt;        storage_context = StorageContext.from_defaults(vector_store=vector_store) &lt;br /&gt;        documents = SimpleDirectoryReader(&lt;span class=&quot;hljs-string&quot;&gt;&quot;./uploaded_files&quot;&lt;/span&gt;).load_data()&lt;br /&gt;        index = VectorStoreIndex.from_documents(&lt;br /&gt;            documents, &lt;br /&gt;            storage_context=storage_context&lt;br /&gt;        )&lt;br /&gt;        index.storage_context.persist()&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&quot;Done&quot;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;except&lt;/span&gt;:&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&quot;Error&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;hljs-title.function&quot;&gt;fetchData&lt;/span&gt;(&lt;span class=&quot;hljs-params&quot;&gt;user_question&lt;/span&gt;):&lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;try&lt;/span&gt;:&lt;br /&gt;        vector_store = FaissVectorStore.from_persist_dir(&lt;span class=&quot;hljs-string&quot;&gt;&quot;./storage&quot;&lt;/span&gt;)&lt;br /&gt;        storage_context = StorageContext.from_defaults(&lt;br /&gt;            vector_store=vector_store, persist_dir=PERSIST_DIR&lt;br /&gt;        )&lt;br /&gt;        index = load_index_from_storage(storage_context=storage_context)&lt;br /&gt;        query_engine = index.as_query_engine()&lt;br /&gt;        response = query_engine.query(user_question)&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;hljs-built_in&quot;&gt;str&lt;/span&gt;(response)&lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;except&lt;/span&gt;:&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&quot;Error&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;WelcomeMessage = &lt;span class=&quot;hljs-string&quot;&gt;&quot;&quot;&quot;&lt;br /&gt;Hello, I am your PDF voice chatbot. Please upload your PDF documents and start asking questions. &lt;br /&gt;I will try my best to answer your questions based on the documents.&lt;br /&gt;&quot;&quot;&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&quot;chat_history&quot;&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;in&lt;/span&gt; st.session_state:&lt;br /&gt;    st.session_state.chat_history = [&lt;br /&gt;        AIMessage(content=WelcomeMessage)&lt;br /&gt;    ]&lt;br /&gt;&lt;br /&gt;AZURE_SPEECH_KEY = os.getenv(&lt;span class=&quot;hljs-string&quot;&gt;&quot;AZURE_SPEECH_KEY&quot;&lt;/span&gt;)&lt;br /&gt;AZURE_SPEECH_REGION = os.getenv(&lt;span class=&quot;hljs-string&quot;&gt;&quot;AZURE_SPEECH_REGION&quot;&lt;/span&gt;)&lt;br /&gt;os.environ[&lt;span class=&quot;hljs-string&quot;&gt;&quot;OPENAI_API_KEY&quot;&lt;/span&gt;] = os.getenv(&lt;span class=&quot;hljs-string&quot;&gt;&quot;OPENAI_API_KEY&quot;&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;speech_config = speechsdk.SpeechConfig(subscription=AZURE_SPEECH_KEY, region=AZURE_SPEECH_REGION)&lt;br /&gt;speech_config.speech_synthesis_voice_name = &lt;span class=&quot;hljs-string&quot;&gt;&quot;en-US-AriaNeural&quot;&lt;/span&gt;   &lt;br /&gt;speech_config.speech_synthesis_language = &lt;span class=&quot;hljs-string&quot;&gt;&quot;en-US&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;speech_synthesizer = speechsdk.SpeechSynthesizer(speech_config=speech_config)&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;hljs-title.function&quot;&gt;main&lt;/span&gt;():&lt;br /&gt;    load_dotenv()  &lt;br /&gt;&lt;br /&gt;    st.set_page_config(&lt;br /&gt;        page_title=&lt;span class=&quot;hljs-string&quot;&gt;&quot;Chat with multiple PDFs&quot;&lt;/span&gt;,&lt;br /&gt;        page_icon=&lt;span class=&quot;hljs-string&quot;&gt;&quot;:sparkles:&quot;&lt;/span&gt;&lt;br /&gt;    )&lt;br /&gt;&lt;br /&gt;    st.header(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Chat with single or multiple PDFs :sparkles:&quot;&lt;/span&gt;)   &lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;for&lt;/span&gt; message &lt;span class=&quot;hljs-keyword&quot;&gt;in&lt;/span&gt; st.session_state.chat_history:&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;hljs-built_in&quot;&gt;isinstance&lt;/span&gt;(message, AIMessage):&lt;br /&gt;            &lt;span class=&quot;hljs-keyword&quot;&gt;with&lt;/span&gt; st.chat_message(&lt;span class=&quot;hljs-string&quot;&gt;&quot;AI&quot;&lt;/span&gt;):&lt;br /&gt;                st.markdown(message.content)&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;elif&lt;/span&gt; &lt;span class=&quot;hljs-built_in&quot;&gt;isinstance&lt;/span&gt;(message, HumanMessage):&lt;br /&gt;            &lt;span class=&quot;hljs-keyword&quot;&gt;with&lt;/span&gt; st.chat_message(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Human&quot;&lt;/span&gt;):&lt;br /&gt;                st.markdown(message.content)     &lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;with&lt;/span&gt; st.sidebar:&lt;br /&gt;        st.subheader(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Your documents&quot;&lt;/span&gt;)&lt;br /&gt;        pdf_docs = st.file_uploader(&lt;br /&gt;            &lt;span class=&quot;hljs-string&quot;&gt;&quot;Upload your PDFs here and click on &#39;Process&#39;&quot;&lt;/span&gt;, &lt;br /&gt;            accept_multiple_files=&lt;span class=&quot;hljs-literal&quot;&gt;True&lt;/span&gt;&lt;br /&gt;        )&lt;br /&gt;&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; st.button(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Process&quot;&lt;/span&gt;):&lt;br /&gt;            &lt;span class=&quot;hljs-keyword&quot;&gt;with&lt;/span&gt; st.spinner(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Processing&quot;&lt;/span&gt;):&lt;br /&gt;                IsFilesSaved = saveUploadedFiles(pdf_docs)&lt;br /&gt;                &lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; IsFilesSaved == &lt;span class=&quot;hljs-string&quot;&gt;&quot;Done&quot;&lt;/span&gt;:&lt;br /&gt;                    IsVectorized = doVectorization()&lt;br /&gt;                    &lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; IsVectorized == &lt;span class=&quot;hljs-string&quot;&gt;&quot;Done&quot;&lt;/span&gt;:&lt;br /&gt;                        st.session_state.isPdfProcessed = &lt;span class=&quot;hljs-string&quot;&gt;&quot;done&quot;&lt;/span&gt;&lt;br /&gt;                        st.success(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Done!&quot;&lt;/span&gt;)&lt;br /&gt;                    &lt;span class=&quot;hljs-keyword&quot;&gt;else&lt;/span&gt;:&lt;br /&gt;                        st.error(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Error! in vectorization&quot;&lt;/span&gt;)&lt;br /&gt;                &lt;span class=&quot;hljs-keyword&quot;&gt;else&lt;/span&gt;:&lt;br /&gt;                    st.error(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Error! in saving the files&quot;&lt;/span&gt;)&lt;br /&gt;        &lt;br /&gt;    user_question = st.chat_input(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Ask a question about your document(s):&quot;&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; user_question &lt;span class=&quot;hljs-keyword&quot;&gt;is&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;hljs-literal&quot;&gt;None&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;and&lt;/span&gt; user_question != &lt;span class=&quot;hljs-string&quot;&gt;&quot;&quot;&lt;/span&gt;:&lt;br /&gt;        st.session_state.chat_history.append(HumanMessage(content=user_question))&lt;br /&gt;&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;with&lt;/span&gt; st.chat_message(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Human&quot;&lt;/span&gt;):&lt;br /&gt;            st.markdown(user_question)&lt;br /&gt;        &lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;with&lt;/span&gt; st.chat_message(&lt;span class=&quot;hljs-string&quot;&gt;&quot;AI&quot;&lt;/span&gt;):&lt;br /&gt;            &lt;span class=&quot;hljs-keyword&quot;&gt;with&lt;/span&gt; st.spinner(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Fetching data ...&quot;&lt;/span&gt;):&lt;br /&gt;                response = fetchData(user_question)&lt;br /&gt;                st.markdown(response)    &lt;br /&gt;                &lt;br /&gt;        result = speech_synthesizer.speak_text_async(response).get()&lt;br /&gt;        st.session_state.chat_history.append(AIMessage(content=response))&lt;br /&gt;    &lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&quot;WelcomeMessage&quot;&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;in&lt;/span&gt; st.session_state:&lt;br /&gt;        st.session_state.WelcomeMessage = WelcomeMessage&lt;br /&gt;        result = speech_synthesizer.speak_text_async(WelcomeMessage).get()&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; __name__ == &lt;span class=&quot;hljs-string&quot;&gt;&#39;__main__&#39;&lt;/span&gt;:&lt;br /&gt;    main()&lt;/span&gt;&lt;/pre&gt;&lt;h1 class=&quot;ms mt fp be mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl nm nn no np bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;4c78&quot;&gt;Breaking Down the Code&lt;/h1&gt;&lt;h1 class=&quot;ms mt fp be mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl nm nn no np bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;dc42&quot;&gt;Environment Setup&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li nq lk ll lm nr lo lp lq ns ls lt lu nt lw lx ly nu ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;ab7d&quot;&gt;We start by importing necessary libraries and loading environment variables using &lt;code class=&quot;cw om on oo oe b&quot;&gt;dotenv&lt;/code&gt;. The .env file :&lt;/p&gt;&lt;pre class=&quot;mh mi mj mk ml od oe of bo og ba bj&quot;&gt;&lt;span class=&quot;oh mt fp oe b bf oi oj l ok ol&quot; data-selectable-paragraph=&quot;&quot; id=&quot;01fa&quot;&gt;&lt;span class=&quot;hljs-attr&quot;&gt;OPENAI_API_KEY&lt;/span&gt; = &lt;span class=&quot;hljs-string&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;hljs-attr&quot;&gt;AZURE_OPENAI_API_KEY&lt;/span&gt; = &lt;span class=&quot;hljs-string&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;hljs-attr&quot;&gt;AZURE_SPEECH_KEY&lt;/span&gt; = &lt;span class=&quot;hljs-string&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;hljs-attr&quot;&gt;AZURE_SPEECH_REGION&lt;/span&gt; = &lt;span class=&quot;hljs-string&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;h1 class=&quot;ms mt fp be mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl nm nn no np bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;0388&quot;&gt;File Upload and Vectorization&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li nq lk ll lm nr lo lp lq ns ls lt lu nt lw lx ly nu ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;0a3e&quot;&gt;The &lt;code class=&quot;cw om on oo oe b&quot;&gt;saveUploadedFiles&lt;/code&gt; function handles file uploads, saving PDFs to a directory. The &lt;code class=&quot;cw om on oo oe b&quot;&gt;doVectorization&lt;/code&gt; function uses Llama_Index and FAISS to create a searchable index from the uploaded documents.&lt;/p&gt;&lt;h1 class=&quot;ms mt fp be mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl nm nn no np bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;aca7&quot;&gt;Fetching Data&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li nq lk ll lm nr lo lp lq ns ls lt lu nt lw lx ly nu ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;d7e5&quot;&gt;The &lt;code class=&quot;cw om on oo oe b&quot;&gt;fetchData&lt;/code&gt; function retrieves answers to user questions by querying the vector index.&lt;/p&gt;&lt;h1 class=&quot;ms mt fp be mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl nm nn no np bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;479a&quot;&gt;Voice Synthesis&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li nq lk ll lm nr lo lp lq ns ls lt lu nt lw lx ly nu ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;da8a&quot;&gt;We use Azure AI Speech service to convert text responses into speech. This involves configuring the &lt;code class=&quot;cw om on oo oe b&quot;&gt;speechsdk.SpeechConfig&lt;/code&gt; and synthesizing speech with &lt;code class=&quot;cw om on oo oe b&quot;&gt;speechsdk.SpeechSynthesizer&lt;/code&gt;.&lt;/p&gt;&lt;h1 class=&quot;ms mt fp be mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl nm nn no np bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;57b1&quot;&gt;Streamlit Interface&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li nq lk ll lm nr lo lp lq ns ls lt lu nt lw lx ly nu ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;6db4&quot;&gt;Streamlit
 makes it easy to build a web interface. The sidebar allows users to 
upload and process PDFs. The main chat interface displays the 
conversation and handles user inputs.&lt;/p&gt;&lt;h1 class=&quot;ms mt fp be mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl nm nn no np bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;1be5&quot;&gt;Running the App&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li nq lk ll lm nr lo lp lq ns ls lt lu nt lw lx ly nu ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;091a&quot;&gt;Run the Streamlit app using:&lt;/p&gt;&lt;pre class=&quot;mh mi mj mk ml od oe of bo og ba bj&quot;&gt;&lt;span class=&quot;oh mt fp oe b bf oi oj l ok ol&quot; data-selectable-paragraph=&quot;&quot; id=&quot;e8ab&quot;&gt;streamlit run your_script_name.py&lt;/span&gt;&lt;/pre&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;dc38&quot;&gt;Upload your PDF documents, ask questions, and listen as the bot responds with both text and voice.&lt;/p&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;dc38&quot;&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;iframe allowfullscreen=&quot;&quot; class=&quot;BLOG_video_class&quot; height=&quot;391&quot; src=&quot;https://www.youtube.com/embed/dI4_DpMUwTU&quot; width=&quot;470&quot; youtube-src-id=&quot;dI4_DpMUwTU&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;br /&gt;&amp;nbsp;&lt;p&gt;&lt;/p&gt;&lt;h1 class=&quot;ms mt fp be mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl nm nn no np bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;7b68&quot;&gt;Conclusion&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li nq lk ll lm nr lo lp lq ns ls lt lu nt lw lx ly nu ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;ca44&quot;&gt;By
 combining LangChain, LlamaIndex, and Azure AI, we’ve created an 
intelligent PDF voice chatbot that can make interacting with documents 
more engaging and accessible. Whether you’re using it for research, 
studying, or just exploring, this project showcases the potential of 
modern AI and NLP technologies.&lt;/p&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;9d14&quot;&gt;Don’t forget to check out the previous blog post for a text-only version of this chatbot. Happy coding!&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://techiemate.blogspot.com/feeds/3727001314552186809/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techiemate.blogspot.com/2024/06/revolutionizing-document-interaction-ai_13.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/3727001314552186809'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/3727001314552186809'/><link rel='alternate' type='text/html' href='http://techiemate.blogspot.com/2024/06/revolutionizing-document-interaction-ai_13.html' title='🚀 Revolutionizing Document Interaction: An AI-Powered PDF Text-2-Voice Chatbot Using LlamaIndex 🐑, Langchain 🔗 and Azure AI Speech 🔊'/><author><name>Atanu Gupta</name><uri>http://www.blogger.com/profile/05529718294081550882</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_LZ_SzyDY_u8HW4LiUYlsEJKSSMR5zYs-ow0dK7kjPtYVYnB_nHhGXM3Ad8Gt9AxMhbi0UO3mSjuYBQq2Sli5kUe05z21o-xTJYAM-Pw6TErhMe4ITlrqdadJSCp_xYQS1rf5k8diG7IlmVmai1fllCvN7o9A8b0JSaV5Gn6SCwv5zw/s220/1714907742840.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiH0SgffQr2vdvtgavl54n5YkRMOErJEfjKKByBaJVIn7z069RhtTK2znWFug5bWy0jYIcXlbSDFMzEMF7q0qf6CSQNz4CZqruE__qLqePGR0Bm7iYzPFwH68DRYXWCq7M99iQinT-kKJ8wqIaOQzo5JQB9IqOopnfpPwa4JiqTfrJQCMz_MPueK_8REgs/s72-w640-h334-c/LlamaIndex-LangChain-B-1024x535.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6011381329995167460.post-3317731851467967206</id><published>2024-06-11T11:47:00.001+05:30</published><updated>2024-06-13T16:00:57.289+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Artificial Intelligence"/><category scheme="http://www.blogger.com/atom/ns#" term="Bot"/><category scheme="http://www.blogger.com/atom/ns#" term="Langchain"/><category scheme="http://www.blogger.com/atom/ns#" term="LlamaIndex"/><category scheme="http://www.blogger.com/atom/ns#" term="Python&#xa;Gen AI&#xa;Data Science"/><category scheme="http://www.blogger.com/atom/ns#" term="Streamlit"/><title type='text'>🚀 Revolutionizing Document Interaction: An AI-Powered PDF Chatbot Using LlamaIndex 🐑 and Langchain 🔗</title><content type='html'>&lt;p&gt;&amp;nbsp;In today’s fast-paced digital world, efficiently accessing and 
extracting information from documents is more crucial than ever. What if
 you could chat with your PDFs, asking questions and getting precise 
answers instantly? Enter our innovative AI-powered PDF chatbot, 
combining the capabilities of &lt;strong class=&quot;lh fq&quot;&gt;LlamaIndex &lt;/strong&gt;and &lt;strong class=&quot;lh fq&quot;&gt;Langchain&lt;/strong&gt;.
 In this blog post, I’ll take you through the journey of building this 
exciting project and how it can transform your document interaction 
experience.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTuFHcx_gwC2BQvL4JmYaean2j_ndNtf6Y9sZIe5d7ksgM7xJyB2W4zqwvn-x0fKg8gtJXE7UfthU-D5MrX5OXF_RCOAge6S0gQcHY1lpsagjWu7bGdyK9FSsA76ABemtqpFDaGULMkzHRJsN7okl3QebJiSym5OvqSRG504gG3CSxWwUBKosM5fEIegw/s1200/LlamaIndex-LangChain-B.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;627&quot; data-original-width=&quot;1200&quot; height=&quot;334&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTuFHcx_gwC2BQvL4JmYaean2j_ndNtf6Y9sZIe5d7ksgM7xJyB2W4zqwvn-x0fKg8gtJXE7UfthU-D5MrX5OXF_RCOAge6S0gQcHY1lpsagjWu7bGdyK9FSsA76ABemtqpFDaGULMkzHRJsN7okl3QebJiSym5OvqSRG504gG3CSxWwUBKosM5fEIegw/w640-h334/LlamaIndex-LangChain-B.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&amp;nbsp;&lt;p&gt;&lt;/p&gt;&lt;h1 class=&quot;mr ms fp be mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl nm nn no bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;756b&quot;&gt;The Vision: Intelligent Document Interaction&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li np lk ll lm nq lo lp lq nr ls lt lu ns lw lx ly nt ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;264c&quot;&gt;Imagine
 you’re dealing with multiple PDF documents, trying to extract specific 
information quickly. Traditional methods can be time-consuming and 
tedious. Our AI chatbot changes the game by allowing you to interact 
with your documents through natural language queries, providing accurate
 answers instantly. This project leverages advanced AI technologies, 
including LlamaIndex for vector storage and Langchain for conversational
 AI, to make document interaction smarter and more intuitive.&lt;/p&gt;&lt;h1 class=&quot;mr ms fp be mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl nm nn no bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;4973&quot;&gt;The Technology Stack&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li np lk ll lm nq lo lp lq nr ls lt lu ns lw lx ly nt ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;e6c8&quot;&gt;To bring this vision to life, we used a robust technology stack:&lt;/p&gt;&lt;ul class=&quot;&quot;&gt;&lt;li class=&quot;lf lg fp lh b li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc nu nv nw bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;50ac&quot;&gt;&lt;strong class=&quot;lh fq&quot;&gt;LlamaIndex&lt;/strong&gt;: For creating and managing a vector store to efficiently handle document data.&lt;/li&gt;&lt;li class=&quot;lf lg fp lh b li nx lk ll lm ny lo lp lq nz ls lt lu oa lw lx ly ob ma mb mc nu nv nw bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;c54d&quot;&gt;&lt;strong class=&quot;lh fq&quot;&gt;Langchain&lt;/strong&gt;: For building the conversational AI interface.&lt;/li&gt;&lt;li class=&quot;lf lg fp lh b li nx lk ll lm ny lo lp lq nz ls lt lu oa lw lx ly ob ma mb mc nu nv nw bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;e3bb&quot;&gt;&lt;strong class=&quot;lh fq&quot;&gt;FAISS (Facebook AI Similarity Search)&lt;/strong&gt;: For fast and scalable similarity search.&lt;/li&gt;&lt;li class=&quot;lf lg fp lh b li nx lk ll lm ny lo lp lq nz ls lt lu oa lw lx ly ob ma mb mc nu nv nw bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;d021&quot;&gt;&lt;strong class=&quot;lh fq&quot;&gt;Streamlit&lt;/strong&gt;: For creating an interactive and user-friendly web interface.&lt;/li&gt;&lt;li class=&quot;lf lg fp lh b li nx lk ll lm ny lo lp lq nz ls lt lu oa lw lx ly ob ma mb mc nu nv nw bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;3d62&quot;&gt;&lt;strong class=&quot;lh fq&quot;&gt;Python&lt;/strong&gt;: The backbone of our project, tying everything together.&lt;/li&gt;&lt;/ul&gt;&lt;h1 class=&quot;mr ms fp be mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl nm nn no bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;7c78&quot;&gt;Let’s Dive into the Code&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li np lk ll lm nq lo lp lq nr ls lt lu ns lw lx ly nt ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;1d28&quot;&gt;Here’s a detailed walkthrough of the code that powers our AI PDF chatbot.&lt;/p&gt;&lt;h1 class=&quot;mr ms fp be mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl nm nn no bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;028b&quot;&gt;Setting Up the Environment&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li np lk ll lm nq lo lp lq nr ls lt lu ns lw lx ly nt ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;2e57&quot;&gt;First, we need to import the necessary libraries and set up the FAISS index and environment variables.&lt;/p&gt;&lt;pre class=&quot;mg mh mi mj mk oc od oe bo of ba bj&quot;&gt;&lt;span class=&quot;og ms fp od b bf oh oi l oj ok&quot; data-selectable-paragraph=&quot;&quot; id=&quot;4bbc&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; os&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; faiss&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; streamlit &lt;span class=&quot;hljs-keyword&quot;&gt;as&lt;/span&gt; st&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;from&lt;/span&gt; dotenv &lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; load_dotenv&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;from&lt;/span&gt; langchain_core.messages &lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; AIMessage, HumanMessage&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;from&lt;/span&gt; llama_index.core &lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; VectorStoreIndex, SimpleDirectoryReader, StorageContext, load_index_from_storage&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;from&lt;/span&gt; llama_index.vector_stores.faiss &lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; FaissVectorStore&lt;br /&gt;&lt;br /&gt;d = &lt;span class=&quot;hljs-number&quot;&gt;1536&lt;/span&gt;&lt;br /&gt;faiss_index = faiss.IndexFlatL2(d)&lt;br /&gt;PERSIST_DIR = &lt;span class=&quot;hljs-string&quot;&gt;&quot;./storage&quot;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;h1 class=&quot;mr ms fp be mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl nm nn no bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;31e1&quot;&gt;Handling File Uploads&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li np lk ll lm nq lo lp lq nr ls lt lu ns lw lx ly nt ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;b2f9&quot;&gt;We need a function to save uploaded PDF files. This function saves the files to a specified directory.&lt;/p&gt;&lt;pre class=&quot;mg mh mi mj mk oc od oe bo of ba bj&quot;&gt;&lt;span class=&quot;og ms fp od b bf oh oi l oj ok&quot; data-selectable-paragraph=&quot;&quot; id=&quot;5e2e&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;hljs-title.function&quot;&gt;saveUploadedFiles&lt;/span&gt;(&lt;span class=&quot;hljs-params&quot;&gt;pdf_docs&lt;/span&gt;):&lt;br /&gt;    UPLOAD_DIR = &lt;span class=&quot;hljs-string&quot;&gt;&#39;uploaded_files&#39;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;try&lt;/span&gt;:&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;for&lt;/span&gt; pdf &lt;span class=&quot;hljs-keyword&quot;&gt;in&lt;/span&gt; pdf_docs:&lt;br /&gt;            file_path = os.path.join(UPLOAD_DIR, pdf.name)&lt;br /&gt;            &lt;span class=&quot;hljs-keyword&quot;&gt;with&lt;/span&gt; &lt;span class=&quot;hljs-built_in&quot;&gt;open&lt;/span&gt;(file_path, &lt;span class=&quot;hljs-string&quot;&gt;&quot;wb&quot;&lt;/span&gt;) &lt;span class=&quot;hljs-keyword&quot;&gt;as&lt;/span&gt; f:&lt;br /&gt;                f.write(pdf.getbuffer())&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&quot;Done&quot;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;except&lt;/span&gt;:&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&quot;Error&quot;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;h1 class=&quot;mr ms fp be mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl nm nn no bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;78e0&quot;&gt;Vectorizing Documents&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li np lk ll lm nq lo lp lq nr ls lt lu ns lw lx ly nt ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;4c43&quot;&gt;The &lt;code class=&quot;cw ol om on od b&quot;&gt;doVectorization&lt;/code&gt; function reads the uploaded PDFs, converts them into vectors, and stores them in the FAISS index.&lt;/p&gt;&lt;pre class=&quot;mg mh mi mj mk oc od oe bo of ba bj&quot;&gt;&lt;span class=&quot;og ms fp od b bf oh oi l oj ok&quot; data-selectable-paragraph=&quot;&quot; id=&quot;39a9&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;hljs-title.function&quot;&gt;doVectorization&lt;/span&gt;():    &lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;try&lt;/span&gt;:&lt;br /&gt;        vector_store = FaissVectorStore(faiss_index=faiss_index)&lt;br /&gt;        storage_context = StorageContext.from_defaults(vector_store=vector_store) &lt;br /&gt;        documents = SimpleDirectoryReader(&lt;span class=&quot;hljs-string&quot;&gt;&quot;./uploaded_files&quot;&lt;/span&gt;).load_data()&lt;br /&gt;        index = VectorStoreIndex.from_documents(&lt;br /&gt;            documents, &lt;br /&gt;            storage_context=storage_context&lt;br /&gt;        )&lt;br /&gt;        index.storage_context.persist()&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&quot;Done&quot;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;except&lt;/span&gt;:&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&quot;Error&quot;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;h1 class=&quot;mr ms fp be mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl nm nn no bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;ed8a&quot;&gt;Fetching Data Based on User Queries&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li np lk ll lm nq lo lp lq nr ls lt lu ns lw lx ly nt ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;71cd&quot;&gt;The &lt;code class=&quot;cw ol om on od b&quot;&gt;fetchData&lt;/code&gt; function processes user queries and retrieves relevant information from the vectorized documents.&lt;/p&gt;&lt;pre class=&quot;mg mh mi mj mk oc od oe bo of ba bj&quot;&gt;&lt;span class=&quot;og ms fp od b bf oh oi l oj ok&quot; data-selectable-paragraph=&quot;&quot; id=&quot;6511&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;hljs-title.function&quot;&gt;fetchData&lt;/span&gt;(&lt;span class=&quot;hljs-params&quot;&gt;user_question&lt;/span&gt;):&lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;try&lt;/span&gt;:&lt;br /&gt;        vector_store = FaissVectorStore.from_persist_dir(&lt;span class=&quot;hljs-string&quot;&gt;&quot;./storage&quot;&lt;/span&gt;)&lt;br /&gt;        storage_context = StorageContext.from_defaults(&lt;br /&gt;            vector_store=vector_store, persist_dir=PERSIST_DIR&lt;br /&gt;        )&lt;br /&gt;        index = load_index_from_storage(storage_context=storage_context)&lt;br /&gt;        query_engine = index.as_query_engine()&lt;br /&gt;        response = query_engine.query(user_question)&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;hljs-built_in&quot;&gt;str&lt;/span&gt;(response)&lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;except&lt;/span&gt;:&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&quot;Error&quot;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;h1 class=&quot;mr ms fp be mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl nm nn no bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;3048&quot;&gt;Building the Streamlit Interface&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li np lk ll lm nq lo lp lq nr ls lt lu ns lw lx ly nt ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;a447&quot;&gt;The main function sets up the Streamlit interface, handles file uploads, processes documents, and manages user interactions.&lt;/p&gt;&lt;pre class=&quot;mg mh mi mj mk oc od oe bo of ba bj&quot;&gt;&lt;span class=&quot;og ms fp od b bf oh oi l oj ok&quot; data-selectable-paragraph=&quot;&quot; id=&quot;9030&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&quot;chat_history&quot;&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;in&lt;/span&gt; st.session_state:&lt;br /&gt;    st.session_state.chat_history = [&lt;br /&gt;        AIMessage(content=&lt;span class=&quot;hljs-string&quot;&gt;&quot;Hello, I am a bot. How can I help you?&quot;&lt;/span&gt;)&lt;br /&gt;    ]&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;hljs-title.function&quot;&gt;main&lt;/span&gt;():&lt;br /&gt;    load_dotenv()&lt;br /&gt;    os.environ[&lt;span class=&quot;hljs-string&quot;&gt;&quot;OPENAI_API_KEY&quot;&lt;/span&gt;] = os.getenv(&lt;span class=&quot;hljs-string&quot;&gt;&quot;OPENAI_API_KEY&quot;&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;    st.set_page_config(&lt;br /&gt;        page_title=&lt;span class=&quot;hljs-string&quot;&gt;&quot;Chat with multiple PDFs&quot;&lt;/span&gt;,&lt;br /&gt;        page_icon=&lt;span class=&quot;hljs-string&quot;&gt;&quot;:sparkles:&quot;&lt;/span&gt;&lt;br /&gt;    )&lt;br /&gt;&lt;br /&gt;    st.header(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Chat with single or multiple PDFs :sparkles:&quot;&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;for&lt;/span&gt; message &lt;span class=&quot;hljs-keyword&quot;&gt;in&lt;/span&gt; st.session_state.chat_history:&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;hljs-built_in&quot;&gt;isinstance&lt;/span&gt;(message, AIMessage):&lt;br /&gt;            &lt;span class=&quot;hljs-keyword&quot;&gt;with&lt;/span&gt; st.chat_message(&lt;span class=&quot;hljs-string&quot;&gt;&quot;AI&quot;&lt;/span&gt;):&lt;br /&gt;                st.markdown(message.content)&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;elif&lt;/span&gt; &lt;span class=&quot;hljs-built_in&quot;&gt;isinstance&lt;/span&gt;(message, HumanMessage):&lt;br /&gt;            &lt;span class=&quot;hljs-keyword&quot;&gt;with&lt;/span&gt; st.chat_message(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Human&quot;&lt;/span&gt;):&lt;br /&gt;                st.markdown(message.content)&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;with&lt;/span&gt; st.sidebar:&lt;br /&gt;        st.subheader(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Your documents&quot;&lt;/span&gt;)&lt;br /&gt;        pdf_docs = st.file_uploader(&lt;br /&gt;            &lt;span class=&quot;hljs-string&quot;&gt;&quot;Upload your PDFs here and click on &#39;Process&#39;&quot;&lt;/span&gt;, &lt;br /&gt;            accept_multiple_files=&lt;span class=&quot;hljs-literal&quot;&gt;True&lt;/span&gt;&lt;br /&gt;        )&lt;br /&gt;&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; st.button(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Process&quot;&lt;/span&gt;):&lt;br /&gt;            &lt;span class=&quot;hljs-keyword&quot;&gt;with&lt;/span&gt; st.spinner(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Processing&quot;&lt;/span&gt;):&lt;br /&gt;                IsFilesSaved = saveUploadedFiles(pdf_docs)&lt;br /&gt;                &lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; IsFilesSaved == &lt;span class=&quot;hljs-string&quot;&gt;&quot;Done&quot;&lt;/span&gt;:&lt;br /&gt;                    IsVectorized = doVectorization()&lt;br /&gt;                    &lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; IsVectorized == &lt;span class=&quot;hljs-string&quot;&gt;&quot;Done&quot;&lt;/span&gt;:&lt;br /&gt;                        st.session_state.isPdfProcessed = &lt;span class=&quot;hljs-string&quot;&gt;&quot;done&quot;&lt;/span&gt;&lt;br /&gt;                        st.success(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Done!&quot;&lt;/span&gt;)&lt;br /&gt;                    &lt;span class=&quot;hljs-keyword&quot;&gt;else&lt;/span&gt;:&lt;br /&gt;                        st.error(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Error! in vectorization&quot;&lt;/span&gt;)&lt;br /&gt;                &lt;span class=&quot;hljs-keyword&quot;&gt;else&lt;/span&gt;:&lt;br /&gt;                    st.error(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Error! in saving the files&quot;&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&quot;isPdfProcessed&quot;&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;in&lt;/span&gt; st.session_state:&lt;br /&gt;        user_question = st.chat_input(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Ask a question about your document(s):&quot;&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; user_question &lt;span class=&quot;hljs-keyword&quot;&gt;is&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;hljs-literal&quot;&gt;None&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;and&lt;/span&gt; user_question != &lt;span class=&quot;hljs-string&quot;&gt;&quot;&quot;&lt;/span&gt;:&lt;br /&gt;            st.session_state.chat_history.append(HumanMessage(content=user_question))&lt;br /&gt;&lt;br /&gt;            &lt;span class=&quot;hljs-keyword&quot;&gt;with&lt;/span&gt; st.chat_message(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Human&quot;&lt;/span&gt;):&lt;br /&gt;                st.markdown(user_question)&lt;br /&gt;            &lt;br /&gt;            &lt;span class=&quot;hljs-keyword&quot;&gt;with&lt;/span&gt; st.chat_message(&lt;span class=&quot;hljs-string&quot;&gt;&quot;AI&quot;&lt;/span&gt;):&lt;br /&gt;                &lt;span class=&quot;hljs-keyword&quot;&gt;with&lt;/span&gt; st.spinner(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Fetching data ...&quot;&lt;/span&gt;):&lt;br /&gt;                    response = fetchData(user_question)&lt;br /&gt;                    st.markdown(response)    &lt;br /&gt;            &lt;br /&gt;            st.session_state.chat_history.append(AIMessage(content=response))&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; __name__ == &lt;span class=&quot;hljs-string&quot;&gt;&#39;__main__&#39;&lt;/span&gt;:&lt;br /&gt;    main()&lt;/span&gt;&lt;/pre&gt;&lt;h1 class=&quot;mr ms fp be mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl nm nn no bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;d915&quot;&gt;Bringing It All Together&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li np lk ll lm nq lo lp lq nr ls lt lu ns lw lx ly nt ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;ce4c&quot;&gt;With
 our AI PDF chatbot, you can upload multiple PDFs, process them, and 
interact with the content effortlessly. The chatbot provides precise 
answers to your queries, making document interaction more efficient and 
enjoyable. This project showcases the power of combining &lt;b&gt;LlamaIndex &lt;/b&gt;and 
&lt;b&gt;Langchain &lt;/b&gt;to create intelligent, user-friendly AI applications. &lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;pw-post-body-paragraph lf lg fp lh b li np lk ll lm nq lo lp lq nr ls lt lu ns lw lx ly nt ma mb mc fi bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;ce4c&quot;&gt;Join the AI revolution and transform how you interact with your documents. Happy coding! 🚀 &lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://techiemate.blogspot.com/feeds/3317731851467967206/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techiemate.blogspot.com/2024/06/revolutionizing-document-interaction-ai.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/3317731851467967206'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/3317731851467967206'/><link rel='alternate' type='text/html' href='http://techiemate.blogspot.com/2024/06/revolutionizing-document-interaction-ai.html' title='🚀 Revolutionizing Document Interaction: An AI-Powered PDF Chatbot Using LlamaIndex 🐑 and Langchain 🔗'/><author><name>Atanu Gupta</name><uri>http://www.blogger.com/profile/05529718294081550882</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_LZ_SzyDY_u8HW4LiUYlsEJKSSMR5zYs-ow0dK7kjPtYVYnB_nHhGXM3Ad8Gt9AxMhbi0UO3mSjuYBQq2Sli5kUe05z21o-xTJYAM-Pw6TErhMe4ITlrqdadJSCp_xYQS1rf5k8diG7IlmVmai1fllCvN7o9A8b0JSaV5Gn6SCwv5zw/s220/1714907742840.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTuFHcx_gwC2BQvL4JmYaean2j_ndNtf6Y9sZIe5d7ksgM7xJyB2W4zqwvn-x0fKg8gtJXE7UfthU-D5MrX5OXF_RCOAge6S0gQcHY1lpsagjWu7bGdyK9FSsA76ABemtqpFDaGULMkzHRJsN7okl3QebJiSym5OvqSRG504gG3CSxWwUBKosM5fEIegw/s72-w640-h334-c/LlamaIndex-LangChain-B.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6011381329995167460.post-661366177490913553</id><published>2024-06-06T10:25:00.002+05:30</published><updated>2024-06-06T10:41:48.745+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="AI"/><category scheme="http://www.blogger.com/atom/ns#" term="Artificial Intelligence"/><category scheme="http://www.blogger.com/atom/ns#" term="Bot"/><category scheme="http://www.blogger.com/atom/ns#" term="Python&#xa;Gen AI&#xa;Data Science"/><category scheme="http://www.blogger.com/atom/ns#" term="Streamlit"/><title type='text'>Bringing AI to Your Fashion Shop: Meet ShopBot, Your Friendly Shopping Assistant! 🛒</title><content type='html'>&lt;p&gt;Welcome
 to the future of online shopping! Imagine having a friendly assistant 
right at your fingertips, ready to help you navigate through a variety 
of stylish clothing, accessories, and more. Say hello to &lt;b class=&quot;lj fs&quot;&gt;ShopBot&lt;/b&gt;,
 an AI-powered assistant for your Fashion Shop, designed to enhance your
 shopping experience and make it more enjoyable than ever.&lt;/p&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;bdcc&quot;&gt;In
 this blog post, we’ll try to simulate a shopping store and dive into 
the exciting world of AI in e-commerce, showcase how ShopBot works, and 
provide you with all the code snippet to get started with your very own 
AI shopping assistant.&lt;/p&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;bdcc&quot;&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_9KrxWEw_7gvmdG_9FM7C6b4uKyjuc-Ok2NQi8f06dF0Py_bgJtnHdGN3eSjiCkykPAF4OpksBIG1UQbLiAXltTS0HJ7_CFdXKoaIY5qJi96s6xBMqqypni9z7CYduraV6r9fdwKrXIGRG1ptA3XDFyx2eHZofu3BN9cgXP-cGulbx8aupehHKdOO7S4/s580/ecom.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;496&quot; data-original-width=&quot;580&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_9KrxWEw_7gvmdG_9FM7C6b4uKyjuc-Ok2NQi8f06dF0Py_bgJtnHdGN3eSjiCkykPAF4OpksBIG1UQbLiAXltTS0HJ7_CFdXKoaIY5qJi96s6xBMqqypni9z7CYduraV6r9fdwKrXIGRG1ptA3XDFyx2eHZofu3BN9cgXP-cGulbx8aupehHKdOO7S4/s16000/ecom.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;bdcc&quot;&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;h1 class=&quot;mp mq fr be mr ms mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl nm bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;8d8a&quot;&gt;Why AI in E-Commerce?&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk nn lm ln lo no lq lr ls np lu lv lw nq ly lz ma nr mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;8786&quot;&gt;Artificial
 Intelligence has revolutionized many industries, and e-commerce is no 
exception. Here are a few reasons why integrating AI into your online 
store can be a game-changer:&lt;/p&gt;&lt;ul&gt;&lt;li class=&quot;lh li fr lj b lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc md me ns nt nu bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;8783&quot;&gt;&lt;b class=&quot;lj fs&quot;&gt;Personalized Shopping Experience:&lt;/b&gt; AI can tailor recommendations based on customer preferences and browsing history.&lt;/li&gt;&lt;li class=&quot;lh li fr lj b lk nv lm ln lo nw lq lr ls nx lu lv lw ny ly lz ma nz mc md me ns nt nu bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;2ad7&quot;&gt;&lt;b class=&quot;lj fs&quot;&gt;24/7 Customer Support:&lt;/b&gt; AI chatbots can assist customers at any time, providing instant responses and support.&lt;/li&gt;&lt;li class=&quot;lh li fr lj b lk nv lm ln lo nw lq lr ls nx lu lv lw ny ly lz ma nz mc md me ns nt nu bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;66f7&quot;&gt;&lt;b class=&quot;lj fs&quot;&gt;Efficient Navigation:&lt;/b&gt; AI can help customers find products quickly and easily, enhancing their overall shopping experience.&lt;/li&gt;&lt;/ul&gt;&lt;h1 class=&quot;mp mq fr be mr ms mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl nm bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;f3af&quot;&gt;Introducing ShopBot&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk nn lm ln lo no lq lr ls np lu lv lw nq ly lz ma nr mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;f874&quot;&gt;ShopBot
 is an AI assistant designed specifically for aFashion Shop. It assists 
customers in browsing products, providing information, and guiding them 
through the checkout process. Let’s see how you can create your very own
 ShopBot using Python, Streamlit and Azure Open AI&lt;/p&gt;&lt;h1 class=&quot;mp mq fr be mr ms mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl nm bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;aa26&quot;&gt;Setting Up ShopBot&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk nn lm ln lo no lq lr ls np lu lv lw nq ly lz ma nr mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;f20d&quot;&gt;Here’s
 a step-by-step guide to creating ShopBot. The code below demonstrates 
how to use Azure OpenAI, Streamlit, and a predefined product list to 
build an engaging shopping assistant.&lt;/p&gt;&lt;h2 class=&quot;oa mq fr be mr ob oc od mv oe of og mz ls oh oi oj lw ok ol om ma on oo op oq bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;af23&quot;&gt;Step 1: Import Required Libraries&lt;/h2&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk nn lm ln lo no lq lr ls np lu lv lw nq ly lz ma nr mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;686d&quot;&gt;First, import the necessary libraries:&lt;/p&gt;&lt;pre class=&quot;mi mj mk ml mm or os ot bo ou ba bj&quot;&gt;&lt;span class=&quot;ov mq fr os b bf ow ox l oy oz&quot; data-selectable-paragraph=&quot;&quot; id=&quot;6176&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; os&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;from&lt;/span&gt; openai &lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; AzureOpenAI&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;from&lt;/span&gt; dotenv &lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; load_dotenv&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;from&lt;/span&gt; langchain_core.messages &lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; AIMessage, HumanMessage&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; streamlit &lt;span class=&quot;hljs-keyword&quot;&gt;as&lt;/span&gt; st&lt;/span&gt;&lt;/pre&gt;&lt;h2 class=&quot;oa mq fr be mr ob oc od mv oe of og mz ls oh oi oj lw ok ol om ma on oo op oq bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;af25&quot;&gt;Step 2: Load Environment Variables&lt;/h2&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk nn lm ln lo no lq lr ls np lu lv lw nq ly lz ma nr mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;3425&quot;&gt;Load your environment variables to access your Azure OpenAI API keys:&lt;/p&gt;&lt;pre class=&quot;mi mj mk ml mm or os ot bo ou ba bj&quot;&gt;&lt;span class=&quot;ov mq fr os b bf ow ox l oy oz&quot; data-selectable-paragraph=&quot;&quot; id=&quot;106f&quot;&gt;load_dotenv()&lt;/span&gt;&lt;/pre&gt;&lt;h2 class=&quot;oa mq fr be mr ob oc od mv oe of og mz ls oh oi oj lw ok ol om ma on oo op oq bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;6dd0&quot;&gt;Step 3: Define the Product List&lt;/h2&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk nn lm ln lo no lq lr ls np lu lv lw nq ly lz ma nr mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;c83c&quot;&gt;Here’s a sample product list. Credit goes to Yennhi95zz’s medium blog post for this comprehensive list:&lt;/p&gt;&lt;pre class=&quot;mi mj mk ml mm or os ot bo ou ba bj&quot;&gt;&lt;span class=&quot;ov mq fr os b bf ow ox l oy oz&quot; data-selectable-paragraph=&quot;&quot; id=&quot;8ff5&quot;&gt;product_list = &lt;span class=&quot;hljs-string&quot;&gt;&#39;&#39;&#39;&lt;br /&gt;# Fashion Shop Product List&lt;br /&gt;&lt;br /&gt;## Women&#39;s Clothing:&lt;br /&gt;- T-shirt  &lt;br /&gt;- Price: $20  &lt;br /&gt;- Available Sizes: Small, Medium, Large, XL  &lt;br /&gt;- Available Colors: Red, White, Black, Gray, Navy&lt;br /&gt;&lt;br /&gt;- Elegant Evening Gown  &lt;br /&gt;- Price: $150  &lt;br /&gt;- Available Sizes: Small, Medium, Large, XL  &lt;br /&gt;- Available Colors: Black, Navy Blue, Burgundy&lt;br /&gt;&lt;br /&gt;- Floral Summer Dress  &lt;br /&gt;- Price: $45  &lt;br /&gt;- Available Sizes: Small, Medium, Large  &lt;br /&gt;- Available Colors: Floral Print, Blue, Pink&lt;br /&gt;&lt;br /&gt;- Professional Blazer  &lt;br /&gt;- Price: $80  &lt;br /&gt;- Available Sizes: Small, Medium, Large, XL  &lt;br /&gt;- Available Colors: Black, Gray, Navy&lt;br /&gt;&lt;br /&gt;## Men&#39;s Clothing:&lt;br /&gt;- Classic Suit Set  &lt;br /&gt;- Price: $200  &lt;br /&gt;- Available Sizes: Small, Medium, Large, XL  &lt;br /&gt;- Available Colors: Charcoal Gray, Navy Blue, Black&lt;br /&gt;&lt;br /&gt;- Casual Denim Jeans  &lt;br /&gt;- Price: $35  &lt;br /&gt;- Available Sizes: 28, 30, 32, 34  &lt;br /&gt;- Available Colors: Blue Denim, Black&lt;br /&gt;&lt;br /&gt;- Polo Shirt Collection  &lt;br /&gt;- Price: $25 each  &lt;br /&gt;- Available Sizes: Small, Medium, Large, XL  &lt;br /&gt;- Available Colors: White, Blue, Red, Green&lt;br /&gt;&lt;br /&gt;## Accessories:&lt;br /&gt;- Stylish Sunglasses  &lt;br /&gt;- Price: $20  &lt;br /&gt;- Available Colors: Black, Brown, Tortoise Shell&lt;br /&gt;&lt;br /&gt;- Leather Handbag  &lt;br /&gt;- Price: $60  &lt;br /&gt;- Available Colors: Brown, Black, Red&lt;br /&gt;&lt;br /&gt;- Classic Wristwatch  &lt;br /&gt;- Price: $50  &lt;br /&gt;- Available Colors: Silver, Gold, Rose Gold&lt;br /&gt;&lt;br /&gt;## Footwear:&lt;br /&gt;- High-Heel Ankle Boots  &lt;br /&gt;- Price: $70  &lt;br /&gt;- Available Sizes: 5-10  &lt;br /&gt;- Available Colors: Black, Tan, Burgundy&lt;br /&gt;&lt;br /&gt;- Comfortable Sneakers  &lt;br /&gt;- Price: $55  &lt;br /&gt;- Available Sizes: 6-12  &lt;br /&gt;- Available Colors: White, Black, Gray&lt;br /&gt;&lt;br /&gt;- Formal Leather Shoes  &lt;br /&gt;- Price: $90  &lt;br /&gt;- Available Sizes: 7-11  &lt;br /&gt;- Available Colors: Brown, Black&lt;br /&gt;&lt;br /&gt;## Kids&#39; Collection:&lt;br /&gt;- Cute Cartoon T-shirts  &lt;br /&gt;- Price: $15 each  &lt;br /&gt;- Available Sizes: 2T, 3T, 4T  &lt;br /&gt;- Available Colors: Blue, Pink, Yellow&lt;br /&gt;&lt;br /&gt;- Adorable Onesies  &lt;br /&gt;- Price: $25  &lt;br /&gt;- Available Sizes: Newborn, 3M, 6M, 12M  &lt;br /&gt;- Available Colors: Pastel Blue, Pink, Mint Green&lt;br /&gt;&lt;br /&gt;- Trendy Kids&#39; Backpacks  &lt;br /&gt;- Price: $30  &lt;br /&gt;- Available Colors: Blue, Red, Purple&lt;br /&gt;&lt;br /&gt;## Activewear:&lt;br /&gt;- Yoga Leggings  &lt;br /&gt;- Price: $30  &lt;br /&gt;- Available Sizes: Small, Medium, Large  &lt;br /&gt;- Available Colors: Black, Gray, Teal&lt;br /&gt;&lt;br /&gt;- Running Shoes  &lt;br /&gt;- Price: $40  &lt;br /&gt;- Available Sizes: 6-12  &lt;br /&gt;- Available Colors: White, Black, Neon Green&lt;br /&gt;&lt;br /&gt;- Quick-Dry Sports T-shirt  &lt;br /&gt;- Price: $20  &lt;br /&gt;- Available Sizes: Small, Medium, Large  &lt;br /&gt;- Available Colors: Red, Blue, Gray&lt;br /&gt;&lt;br /&gt;&#39;&#39;&#39;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;h2 class=&quot;oa mq fr be mr ob oc od mv oe of og mz ls oh oi oj lw ok ol om ma on oo op oq bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;a23a&quot;&gt;Step 4: Create the Context for ShopBot&lt;/h2&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk nn lm ln lo no lq lr ls np lu lv lw nq ly lz ma nr mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;b838&quot;&gt;Define the context for your AI assistant:&lt;/p&gt;&lt;pre class=&quot;mi mj mk ml mm or os ot bo ou ba bj&quot;&gt;&lt;span class=&quot;ov mq fr os b bf ow ox l oy oz&quot; data-selectable-paragraph=&quot;&quot; id=&quot;bf5f&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;hljs-title.function&quot;&gt;get_context&lt;/span&gt;():&lt;br /&gt;    context = [{&lt;span class=&quot;hljs-string&quot;&gt;&#39;role&#39;&lt;/span&gt;: &lt;span class=&quot;hljs-string&quot;&gt;&#39;system&#39;&lt;/span&gt;,&lt;br /&gt;                &lt;span class=&quot;hljs-string&quot;&gt;&#39;content&#39;&lt;/span&gt;: &lt;span class=&quot;hljs-string&quot;&gt;f&quot;&quot;&quot;&lt;br /&gt;    You are ShopBot, an AI assistant for my online fashion shop - My Fashion Shop. &lt;br /&gt;    Your role is to assist customers in browsing products, providing information, and guiding them through the checkout process. &lt;br /&gt;    Be friendly and helpful in your interactions. We offer a variety of products across categories such as Women&#39;s Clothing, &lt;br /&gt;    Men&#39;s clothing, Accessories, Kids&#39; Collection, Footwears and Activewear products. &lt;br /&gt;    Feel free to ask customers about their preferences, recommend products, and inform them about any ongoing promotions.&lt;br /&gt;    The Current Product List is limited as below:&lt;br /&gt;&lt;br /&gt;    ```&lt;span class=&quot;hljs-subst&quot;&gt;{product_list}&lt;/span&gt;```&lt;br /&gt;&lt;br /&gt;    Make the shopping experience enjoyable and encourage customers to reach out if they have any questions or need assistance.&lt;br /&gt;    &quot;&quot;&quot;&lt;/span&gt;}]&lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;return&lt;/span&gt; context&lt;/span&gt;&lt;/pre&gt;&lt;h2 class=&quot;oa mq fr be mr ob oc od mv oe of og mz ls oh oi oj lw ok ol om ma on oo op oq bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;dc39&quot;&gt;Step 5: Define the Function to Get AI Responses&lt;/h2&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk nn lm ln lo no lq lr ls np lu lv lw nq ly lz ma nr mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;3452&quot;&gt;Create a function to get responses from the AI:&lt;/p&gt;&lt;pre class=&quot;mi mj mk ml mm or os ot bo ou ba bj&quot;&gt;&lt;span class=&quot;ov mq fr os b bf ow ox l oy oz&quot; data-selectable-paragraph=&quot;&quot; id=&quot;3f8e&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;hljs-title.function&quot;&gt;get_completion_from_messages&lt;/span&gt;(&lt;span class=&quot;hljs-params&quot;&gt;messages&lt;/span&gt;):&lt;br /&gt;    client = AzureOpenAI(&lt;br /&gt;        api_key = os.environ[&lt;span class=&quot;hljs-string&quot;&gt;&quot;AZURE_OPENAI_API_KEY&quot;&lt;/span&gt;],&lt;br /&gt;        api_version = os.environ[&lt;span class=&quot;hljs-string&quot;&gt;&quot;API_VERSION&quot;&lt;/span&gt;],&lt;br /&gt;        azure_endpoint = os.environ[&lt;span class=&quot;hljs-string&quot;&gt;&quot;AZURE_OPENAI_ENDPOINT&quot;&lt;/span&gt;]&lt;br /&gt;    )&lt;br /&gt;&lt;br /&gt;    chat_completion = client.chat.completions.create(&lt;br /&gt;        model = os.environ[&lt;span class=&quot;hljs-string&quot;&gt;&quot;DEPLOYMENT_MODEL&quot;&lt;/span&gt;],&lt;br /&gt;        messages = messages&lt;br /&gt;    )&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;return&lt;/span&gt; chat_completion.choices[&lt;span class=&quot;hljs-number&quot;&gt;0&lt;/span&gt;].message.content&lt;/span&gt;&lt;/pre&gt;&lt;h2 class=&quot;oa mq fr be mr ob oc od mv oe of og mz ls oh oi oj lw ok ol om ma on oo op oq bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;10ae&quot;&gt;Step 6: Initialize Streamlit Session State&lt;/h2&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk nn lm ln lo no lq lr ls np lu lv lw nq ly lz ma nr mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;7a57&quot;&gt;Initialize the chat history and context:&lt;/p&gt;&lt;pre class=&quot;mi mj mk ml mm or os ot bo ou ba bj&quot;&gt;&lt;span class=&quot;ov mq fr os b bf ow ox l oy oz&quot; data-selectable-paragraph=&quot;&quot; id=&quot;6efe&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&quot;chat_history&quot;&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;in&lt;/span&gt; st.session_state:&lt;br /&gt;    st.session_state.chat_history = [&lt;br /&gt;      AIMessage(content=&lt;span class=&quot;hljs-string&quot;&gt;&quot;Hello! I&#39;m your Ecom Assistant. How can I help you today&quot;&lt;/span&gt;),&lt;br /&gt;    ]&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&quot;chat_msg&quot;&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;in&lt;/span&gt; st.session_state:&lt;br /&gt;    st.session_state.chat_msg = get_context()&lt;/span&gt;&lt;/pre&gt;&lt;h2 class=&quot;oa mq fr be mr ob oc od mv oe of og mz ls oh oi oj lw ok ol om ma on oo op oq bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;4bf7&quot;&gt;Step 7: Set Up Streamlit UI&lt;/h2&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk nn lm ln lo no lq lr ls np lu lv lw nq ly lz ma nr mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;2035&quot;&gt;Configure Streamlit page and display the chat interface:&lt;/p&gt;&lt;pre class=&quot;mi mj mk ml mm or os ot bo ou ba bj&quot;&gt;&lt;span class=&quot;ov mq fr os b bf ow ox l oy oz&quot; data-selectable-paragraph=&quot;&quot; id=&quot;95fd&quot;&gt;st.set_page_config(page_title=&lt;span class=&quot;hljs-string&quot;&gt;&quot;Chat with My Shop&quot;&lt;/span&gt;, page_icon=&lt;span class=&quot;hljs-string&quot;&gt;&quot;:speech_balloon:&quot;&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;st.title(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Ecommerce Chatbot :speech_balloon:&quot;&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;for&lt;/span&gt; message &lt;span class=&quot;hljs-keyword&quot;&gt;in&lt;/span&gt; st.session_state.chat_history:&lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;hljs-built_in&quot;&gt;isinstance&lt;/span&gt;(message, AIMessage):&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;with&lt;/span&gt; st.chat_message(&lt;span class=&quot;hljs-string&quot;&gt;&quot;AI&quot;&lt;/span&gt;):&lt;br /&gt;            st.markdown(message.content)&lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;elif&lt;/span&gt; &lt;span class=&quot;hljs-built_in&quot;&gt;isinstance&lt;/span&gt;(message, HumanMessage):&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;with&lt;/span&gt; st.chat_message(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Human&quot;&lt;/span&gt;):&lt;br /&gt;            st.markdown(message.content)&lt;/span&gt;&lt;/pre&gt;&lt;h2 class=&quot;oa mq fr be mr ob oc od mv oe of og mz ls oh oi oj lw ok ol om ma on oo op oq bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;0121&quot;&gt;Step 8: Handle User Input&lt;/h2&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk nn lm ln lo no lq lr ls np lu lv lw nq ly lz ma nr mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;2803&quot;&gt;Capture and respond to user queries:&lt;/p&gt;&lt;pre class=&quot;mi mj mk ml mm or os ot bo ou ba bj&quot;&gt;&lt;span class=&quot;ov mq fr os b bf ow ox l oy oz&quot; data-selectable-paragraph=&quot;&quot; id=&quot;6be7&quot;&gt;user_query = st.chat_input(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Type a message...&quot;&lt;/span&gt;)&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; user_query &lt;span class=&quot;hljs-keyword&quot;&gt;is&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;hljs-literal&quot;&gt;None&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;and&lt;/span&gt; user_query.strip() != &lt;span class=&quot;hljs-string&quot;&gt;&quot;&quot;&lt;/span&gt;:&lt;br /&gt;    st.session_state.chat_msg.append({&lt;span class=&quot;hljs-string&quot;&gt;&quot;role&quot;&lt;/span&gt; : &lt;span class=&quot;hljs-string&quot;&gt;&quot;user&quot;&lt;/span&gt;, &lt;span class=&quot;hljs-string&quot;&gt;&quot;content&quot;&lt;/span&gt; : &lt;span class=&quot;hljs-string&quot;&gt;f&quot;&lt;span class=&quot;hljs-subst&quot;&gt;{user_query}&lt;/span&gt;&quot;&lt;/span&gt;})&lt;br /&gt;    st.session_state.chat_history.append(HumanMessage(content=user_query))&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;with&lt;/span&gt; st.chat_message(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Human&quot;&lt;/span&gt;):&lt;br /&gt;        st.markdown(user_query)    &lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;with&lt;/span&gt; st.chat_message(&lt;span class=&quot;hljs-string&quot;&gt;&quot;AI&quot;&lt;/span&gt;):&lt;br /&gt;        &lt;span class=&quot;hljs-keyword&quot;&gt;with&lt;/span&gt; st.spinner(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Please wait ...&quot;&lt;/span&gt;): &lt;br /&gt;            response = get_completion_from_messages(st.session_state.chat_msg)&lt;br /&gt;            st.markdown(response)&lt;br /&gt;&lt;br /&gt;    st.session_state.chat_msg.append({&lt;span class=&quot;hljs-string&quot;&gt;&quot;role&quot;&lt;/span&gt; : &lt;span class=&quot;hljs-string&quot;&gt;&quot;user&quot;&lt;/span&gt;, &lt;span class=&quot;hljs-string&quot;&gt;&quot;content&quot;&lt;/span&gt; : &lt;span class=&quot;hljs-string&quot;&gt;f&quot;&lt;span class=&quot;hljs-subst&quot;&gt;{response}&lt;/span&gt;&quot;&lt;/span&gt;})&lt;br /&gt;    st.session_state.chat_history.append(AIMessage(content=response))&lt;/span&gt;&lt;/pre&gt;&lt;h2 class=&quot;oa mq fr be mr ob oc od mv oe of og mz ls oh oi oj lw ok ol om ma on oo op oq bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;7804&quot;&gt;Step 8: Run the application&lt;/h2&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk nn lm ln lo no lq lr ls np lu lv lw nq ly lz ma nr mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;9b8a&quot;&gt;Run the app:&lt;/p&gt;&lt;pre class=&quot;mi mj mk ml mm or os ot bo ou ba bj&quot;&gt;&lt;span class=&quot;ov mq fr os b bf ow ox l oy oz&quot; data-selectable-paragraph=&quot;&quot; id=&quot;d60f&quot;&gt;streamlit run &amp;lt;&amp;lt;yourapp&amp;gt;&amp;gt;.py&lt;/span&gt;&lt;/pre&gt;&lt;h1 class=&quot;mp mq fr be mr ms mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl nm bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;2008&quot;&gt;Try It Yourself!&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk nn lm ln lo no lq lr ls np lu lv lw nq ly lz ma nr mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;f9a6&quot;&gt;That’s
 it! You’ve now created your very own AI shopping assistant. With 
ShopBot, your customers can enjoy a personalized and efficient shopping 
experience, making them feel valued and well-assisted. Whether they need
 recommendations, product details, or help with the checkout process, 
ShopBot is here to help.&lt;/p&gt;Feel
 free to customize the product list and enhance the functionality to 
suit your store’s unique needs. Happy coding and happy shopping!&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;bdcc&quot;&gt;&amp;nbsp;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://techiemate.blogspot.com/feeds/661366177490913553/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techiemate.blogspot.com/2024/06/bringing-ai-to-your-fashion-shop-meet.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/661366177490913553'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/661366177490913553'/><link rel='alternate' type='text/html' href='http://techiemate.blogspot.com/2024/06/bringing-ai-to-your-fashion-shop-meet.html' title='Bringing AI to Your Fashion Shop: Meet ShopBot, Your Friendly Shopping Assistant! 🛒'/><author><name>Atanu Gupta</name><uri>http://www.blogger.com/profile/05529718294081550882</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_LZ_SzyDY_u8HW4LiUYlsEJKSSMR5zYs-ow0dK7kjPtYVYnB_nHhGXM3Ad8Gt9AxMhbi0UO3mSjuYBQq2Sli5kUe05z21o-xTJYAM-Pw6TErhMe4ITlrqdadJSCp_xYQS1rf5k8diG7IlmVmai1fllCvN7o9A8b0JSaV5Gn6SCwv5zw/s220/1714907742840.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_9KrxWEw_7gvmdG_9FM7C6b4uKyjuc-Ok2NQi8f06dF0Py_bgJtnHdGN3eSjiCkykPAF4OpksBIG1UQbLiAXltTS0HJ7_CFdXKoaIY5qJi96s6xBMqqypni9z7CYduraV6r9fdwKrXIGRG1ptA3XDFyx2eHZofu3BN9cgXP-cGulbx8aupehHKdOO7S4/s72-c/ecom.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6011381329995167460.post-4117631590945550563</id><published>2024-05-30T12:52:00.009+05:30</published><updated>2024-05-30T14:48:05.251+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="AI"/><category scheme="http://www.blogger.com/atom/ns#" term="Azure"/><category scheme="http://www.blogger.com/atom/ns#" term="Azure Speech"/><category scheme="http://www.blogger.com/atom/ns#" term="Cognitive"/><category scheme="http://www.blogger.com/atom/ns#" term="Python&#xa;Gen AI&#xa;Data Science"/><title type='text'>Integrating Azure Cognitive Services with OpenAI for interactive Voice-based AI Responses 🤖🎤</title><content type='html'>&lt;p&gt;&lt;span class=&quot;break-words
      tvm-parent-container&quot;&gt;&lt;span dir=&quot;ltr&quot;&gt;In today&#39;s fast-moving 
digital world, mixing top-notch AI tech is opening up endless chances 
for cool experiences. When we combine Azure Cognitive Services, which 
are really good at understanding speech, with OpenAI, which is great at 
understanding natural language, magic happens. It lets us make AI 
systems that talk back to us in real time, understanding what we say 
like it&#39;s second nature. Jump into the world where Azure meets OpenAI, 
and see how it&#39;s changing the way we interact with computers.&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;5737&quot;&gt;In
 this blog post, we’ll explore a Python script that achieves this 
integration, enabling a fully interactive voice-based AI system. &lt;br /&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiAn0i_inywSTb3g1etixO1JedP-_4biPmRSqFq1puuUUi_1VqwBE8plLdRb7bX9EbWR4gDS3UkzZhhIGvprERR59I4Sv0xFPqS3F1vrfK_pZH-E2aLLRKiX22Z2Sj0k-L8_wPL0lRNxNkNxgJxpkl-et6QWCsnR0oVzFZsZ5P0dgXTbocExc3ItfSazg/s740/robot-chat-3d-robot-voice-chat-online-help-help-talk-help-business_808398-1.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;493&quot; data-original-width=&quot;740&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiAn0i_inywSTb3g1etixO1JedP-_4biPmRSqFq1puuUUi_1VqwBE8plLdRb7bX9EbWR4gDS3UkzZhhIGvprERR59I4Sv0xFPqS3F1vrfK_pZH-E2aLLRKiX22Z2Sj0k-L8_wPL0lRNxNkNxgJxpkl-et6QWCsnR0oVzFZsZ5P0dgXTbocExc3ItfSazg/s16000/robot-chat-3d-robot-voice-chat-online-help-help-talk-help-business_808398-1.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt; &lt;p&gt;&lt;/p&gt;&lt;h1 class=&quot;mf mg fr be mh mi mj mk ml mm mn mo mp mq mr ms mt mu mv mw mx my mz na nb nc bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;3b81&quot;&gt;Overview&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk nd lm ln lo ne lq lr ls nf lu lv lw ng ly lz ma nh mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;7a79&quot;&gt;The
 script leverages Azure’s Speech SDK to recognize spoken language and 
OpenAI’s language model to generate responses. The process involves 
several key steps:&lt;/p&gt;&lt;ol&gt;&lt;li class=&quot;lh li fr lj b lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc md me ni nj nk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;17d5&quot;&gt;&lt;b class=&quot;lj fs&quot;&gt;Loading Environment Variables&lt;/b&gt;: Using &lt;code class=&quot;cw nl nm nn no b&quot;&gt;dotenv&lt;/code&gt; to manage API keys securely.&lt;/li&gt;&lt;li class=&quot;lh li fr lj b lk np lm ln lo nq lq lr ls nr lu lv lw ns ly lz ma nt mc md me ni nj nk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;6aae&quot;&gt;&lt;b class=&quot;lj fs&quot;&gt;Configuring Azure Speech SDK&lt;/b&gt;: Setting up speech recognition and synthesis.&lt;/li&gt;&lt;li class=&quot;lh li fr lj b lk np lm ln lo nq lq lr ls nr lu lv lw ns ly lz ma nt mc md me ni nj nk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;86f3&quot;&gt;&lt;b class=&quot;lj fs&quot;&gt;Invoking OpenAI API&lt;/b&gt;: Using the recognized speech to generate a response.&lt;/li&gt;&lt;li class=&quot;lh li fr lj b lk np lm ln lo nq lq lr ls nr lu lv lw ns ly lz ma nt mc md me ni nj nk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;4bd1&quot;&gt;&lt;b class=&quot;lj fs&quot;&gt;Synthesizing AI Response&lt;/b&gt;: Converting the AI-generated text back to speech.&lt;/li&gt;&lt;/ol&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;ee6e&quot;&gt;Let’s delve into the details.&lt;/p&gt;&lt;h1 class=&quot;mf mg fr be mh mi mj mk ml mm mn mo mp mq mr ms mt mu mv mw mx my mz na nb nc bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;70a1&quot;&gt;Prerequisites&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk nd lm ln lo ne lq lr ls nf lu lv lw ng ly lz ma nh mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;41c4&quot;&gt;Before you start, ensure you have the following:&lt;/p&gt;&lt;ul&gt;&lt;li class=&quot;lh li fr lj b lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc md me nu nj nk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;3b92&quot;&gt;Azure Cognitive Services subscription with Speech API.&lt;/li&gt;&lt;li class=&quot;lh li fr lj b lk np lm ln lo nq lq lr ls nr lu lv lw ns ly lz ma nt mc md me nu nj nk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;fc62&quot;&gt;OpenAI API key.&lt;/li&gt;&lt;li class=&quot;lh li fr lj b lk np lm ln lo nq lq lr ls nr lu lv lw ns ly lz ma nt mc md me nu nj nk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;f28b&quot;&gt;Python environment with necessary libraries installed (&lt;code class=&quot;cw nl nm nn no b&quot;&gt;azure-cognitiveservices-speech&lt;/code&gt;, &lt;code class=&quot;cw nl nm nn no b&quot;&gt;python-dotenv&lt;/code&gt;, &lt;code class=&quot;cw nl nm nn no b&quot;&gt;langchain_openai&lt;/code&gt;).&lt;/li&gt;&lt;/ul&gt;&lt;h1 class=&quot;mf mg fr be mh mi mj mk ml mm mn mo mp mq mr ms mt mu mv mw mx my mz na nb nc bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;7327&quot;&gt;Code Walkthrough&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk nd lm ln lo ne lq lr ls nf lu lv lw ng ly lz ma nh mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;d2f2&quot;&gt;Below is the complete script with comments to guide you through each section:&lt;/p&gt;&lt;pre class=&quot;nv nw nx ny nz oa no ob bo oc ba bj&quot;&gt;&lt;span class=&quot;od mg fr no b bf oe of l og oh&quot; data-selectable-paragraph=&quot;&quot; id=&quot;1839&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; os&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;from&lt;/span&gt; dotenv &lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; load_dotenv&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; azure.cognitiveservices.speech &lt;span class=&quot;hljs-keyword&quot;&gt;as&lt;/span&gt; speechsdk&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;from&lt;/span&gt; langchain_openai &lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; OpenAI&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-comment&quot;&gt;# Load environment variables from a .env file&lt;/span&gt;&lt;br /&gt;load_dotenv()&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-comment&quot;&gt;# Retrieve API keys from environment variables&lt;/span&gt;&lt;br /&gt;AZURE_SPEECH_KEY = os.getenv(&lt;span class=&quot;hljs-string&quot;&gt;&quot;AZURE_SPEECH_KEY&quot;&lt;/span&gt;)&lt;br /&gt;AZURE_SPEECH_REGION = os.getenv(&lt;span class=&quot;hljs-string&quot;&gt;&quot;AZURE_SPEECH_REGION&quot;&lt;/span&gt;)&lt;br /&gt;OPENAI_API_KEY = os.getenv(&lt;span class=&quot;hljs-string&quot;&gt;&quot;OPENAI_API_KEY&quot;&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-comment&quot;&gt;# Initialize the OpenAI language model with the API key&lt;/span&gt;&lt;br /&gt;llm = OpenAI(api_key=OPENAI_API_KEY)&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-comment&quot;&gt;# Configure Azure Speech SDK for speech recognition&lt;/span&gt;&lt;br /&gt;speech_config = speechsdk.SpeechConfig(subscription=AZURE_SPEECH_KEY, region=AZURE_SPEECH_REGION)&lt;br /&gt;speech_config.speech_recognition_language = &lt;span class=&quot;hljs-string&quot;&gt;&quot;en-US&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-comment&quot;&gt;# Set up the audio input from the default microphone&lt;/span&gt;&lt;br /&gt;audio_config = speechsdk.audio.AudioConfig(use_default_microphone=&lt;span class=&quot;hljs-literal&quot;&gt;True&lt;/span&gt;)&lt;br /&gt;speech_recognizer = speechsdk.SpeechRecognizer(speech_config=speech_config, audio_config=audio_config)&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-built_in&quot;&gt;print&lt;/span&gt;(&lt;span class=&quot;hljs-string&quot;&gt;&quot;You can speak now. I am listening ...&quot;&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-comment&quot;&gt;# Start speech recognition&lt;/span&gt;&lt;br /&gt;speech_recognition_result = speech_recognizer.recognize_once_async().get()&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-comment&quot;&gt;# Check the result of the speech recognition&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; speech_recognition_result.reason == speechsdk.ResultReason.RecognizedSpeech:&lt;br /&gt;    output = speech_recognition_result.text&lt;br /&gt;    &lt;span class=&quot;hljs-built_in&quot;&gt;print&lt;/span&gt;(output)  &lt;span class=&quot;hljs-comment&quot;&gt;# User question&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;hljs-comment&quot;&gt;# Invoke the OpenAI API with the recognized speech text&lt;/span&gt;&lt;br /&gt;    result = llm.invoke(output)&lt;br /&gt;    &lt;span class=&quot;hljs-built_in&quot;&gt;print&lt;/span&gt;(result)  &lt;span class=&quot;hljs-comment&quot;&gt;# AI Answer&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;hljs-comment&quot;&gt;# Configure audio output for speech synthesis&lt;/span&gt;&lt;br /&gt;    audio_config = speechsdk.audio.AudioOutputConfig(use_default_speaker=&lt;span class=&quot;hljs-literal&quot;&gt;True&lt;/span&gt;)&lt;br /&gt;    speech_synthesizer = speechsdk.SpeechSynthesizer(speech_config=speech_config, audio_config=audio_config)&lt;br /&gt;    &lt;br /&gt;    &lt;span class=&quot;hljs-comment&quot;&gt;# Synthesize the AI response into speech&lt;/span&gt;&lt;br /&gt;    speech_synthesizer_result = speech_synthesizer.speak_text_async(result).get()&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;elif&lt;/span&gt; speech_recognition_result.reason == speechsdk.ResultReason.NoMatch:&lt;br /&gt;    &lt;span class=&quot;hljs-built_in&quot;&gt;print&lt;/span&gt;(&lt;span class=&quot;hljs-string&quot;&gt;&quot;No speech could be recognized: {}&quot;&lt;/span&gt;.&lt;span class=&quot;hljs-built_in&quot;&gt;format&lt;/span&gt;(speech_recognition_result.no_match_details))&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;elif&lt;/span&gt; speech_recognition_result.reason == speechsdk.ResultReason.Canceled:&lt;br /&gt;    cancellation_details = speech_recognition_result.cancellation_details&lt;br /&gt;    &lt;span class=&quot;hljs-built_in&quot;&gt;print&lt;/span&gt;(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Speech Recognition canceled: {}&quot;&lt;/span&gt;.&lt;span class=&quot;hljs-built_in&quot;&gt;format&lt;/span&gt;(cancellation_details.reason))&lt;br /&gt;    &lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; cancellation_details.reason == speechsdk.CancellationReason.Error:&lt;br /&gt;        &lt;span class=&quot;hljs-built_in&quot;&gt;print&lt;/span&gt;(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Error details: {}&quot;&lt;/span&gt;.&lt;span class=&quot;hljs-built_in&quot;&gt;format&lt;/span&gt;(cancellation_details.error_details))&lt;/span&gt;&lt;/pre&gt;&lt;h1 class=&quot;mf mg fr be mh mi mj mk ml mm mn mo mp mq mr ms mt mu mv mw mx my mz na nb nc bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;8441&quot;&gt;Step-by-Step Breakdown&lt;/h1&gt;&lt;h2 class=&quot;oi mg fr be mh oj ok ol ml om on oo mp ls op oq or lw os ot ou ma ov ow ox oy bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;64f0&quot;&gt;1. Loading Environment Variables&lt;/h2&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk nd lm ln lo ne lq lr ls nf lu lv lw ng ly lz ma nh mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;2599&quot;&gt;Using the &lt;code class=&quot;cw nl nm nn no b&quot;&gt;dotenv&lt;/code&gt; package, we load sensitive API keys from a &lt;code class=&quot;cw nl nm nn no b&quot;&gt;.env&lt;/code&gt; file, ensuring they are not hard-coded in the script.&lt;/p&gt;&lt;h2 class=&quot;oi mg fr be mh oj ok ol ml om on oo mp ls op oq or lw os ot ou ma ov ow ox oy bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;3a70&quot;&gt;2. Configuring Azure Speech SDK&lt;/h2&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk nd lm ln lo ne lq lr ls nf lu lv lw ng ly lz ma nh mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;0ed0&quot;&gt;We
 set up the Azure Speech SDK with the necessary subscription key and 
region. This configuration allows the SDK to access Azure’s speech 
recognition services.&lt;/p&gt;&lt;h2 class=&quot;oi mg fr be mh oj ok ol ml om on oo mp ls op oq or lw os ot ou ma ov ow ox oy bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;545d&quot;&gt;3. Speech Recognition&lt;/h2&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk nd lm ln lo ne lq lr ls nf lu lv lw ng ly lz ma nh mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;cfb8&quot;&gt;The &lt;code class=&quot;cw nl nm nn no b&quot;&gt;SpeechRecognizer&lt;/code&gt;
 object listens for speech input via the default microphone and 
processes the speech to text asynchronously. Upon recognition, it checks
 the result and extracts the recognized text.&lt;/p&gt;&lt;h2 class=&quot;oi mg fr be mh oj ok ol ml om on oo mp ls op oq or lw os ot ou ma ov ow ox oy bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;575d&quot;&gt;4. Invoking OpenAI API&lt;/h2&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk nd lm ln lo ne lq lr ls nf lu lv lw ng ly lz ma nh mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;10c4&quot;&gt;The
 recognized text is then passed to OpenAI’s language model, which 
generates a relevant response. This integration allows for dynamic 
interaction, where the AI can understand and respond contextually.&lt;/p&gt;&lt;h2 class=&quot;oi mg fr be mh oj ok ol ml om on oo mp ls op oq or lw os ot ou ma ov ow ox oy bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;2c7c&quot;&gt;5. Speech Synthesis&lt;/h2&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk nd lm ln lo ne lq lr ls nf lu lv lw ng ly lz ma nh mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;10b1&quot;&gt;Finally, the AI-generated text response is synthesized back into speech using Azure’s &lt;code class=&quot;cw nl nm nn no b&quot;&gt;SpeechSynthesizer&lt;/code&gt;, providing a spoken response through the default speaker.&lt;/p&gt;&lt;h1 class=&quot;mf mg fr be mh mi mj mk ml mm mn mo mp mq mr ms mt mu mv mw mx my mz na nb nc bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;3f7f&quot;&gt;Error Handling&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk nd lm ln lo ne lq lr ls nf lu lv lw ng ly lz ma nh mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;3e44&quot;&gt;The script includes basic error handling for different outcomes of the speech recognition process:&lt;/p&gt;&lt;ul&gt;&lt;li class=&quot;lh li fr lj b lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc md me nu nj nk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;b095&quot;&gt;&lt;b class=&quot;lj fs&quot;&gt;RecognizedSpeech&lt;/b&gt;: When speech is successfully recognized.&lt;/li&gt;&lt;li class=&quot;lh li fr lj b lk np lm ln lo nq lq lr ls nr lu lv lw ns ly lz ma nt mc md me nu nj nk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;6bc5&quot;&gt;&lt;b class=&quot;lj fs&quot;&gt;NoMatch&lt;/b&gt;: When no speech is recognized.&lt;/li&gt;&lt;li class=&quot;lh li fr lj b lk np lm ln lo nq lq lr ls nr lu lv lw ns ly lz ma nt mc md me nu nj nk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;9516&quot;&gt;&lt;b class=&quot;lj fs&quot;&gt;Canceled&lt;/b&gt;: When the recognition process is canceled, potentially due to errors.&lt;/li&gt;&lt;/ul&gt;&lt;h1 class=&quot;mf mg fr be mh mi mj mk ml mm mn mo mp mq mr ms mt mu mv mw mx my mz na nb nc bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;a4ce&quot;&gt;Conclusion&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk nd lm ln lo ne lq lr ls nf lu lv lw ng ly lz ma nh mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;0a70&quot;&gt;Integrating
 Azure Cognitive Services with OpenAI creates a powerful platform for 
developing interactive voice applications. This combination leverages 
the robust speech recognition and synthesis capabilities of Azure with 
the advanced natural language understanding of OpenAI. Whether for 
virtual assistants, customer support, or other innovative applications, 
this integration showcases the potential of modern AI technologies.&lt;/p&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;e9e8&quot;&gt;Feel
 free to experiment with the code and adapt it to your specific use 
case. The possibilities are endless when combining these advanced tools 
in creative ways.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://techiemate.blogspot.com/feeds/4117631590945550563/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techiemate.blogspot.com/2024/05/integrating-azure-cognitive-services.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/4117631590945550563'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/4117631590945550563'/><link rel='alternate' type='text/html' href='http://techiemate.blogspot.com/2024/05/integrating-azure-cognitive-services.html' title='Integrating Azure Cognitive Services with OpenAI for interactive Voice-based AI Responses 🤖🎤'/><author><name>Atanu Gupta</name><uri>http://www.blogger.com/profile/05529718294081550882</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_LZ_SzyDY_u8HW4LiUYlsEJKSSMR5zYs-ow0dK7kjPtYVYnB_nHhGXM3Ad8Gt9AxMhbi0UO3mSjuYBQq2Sli5kUe05z21o-xTJYAM-Pw6TErhMe4ITlrqdadJSCp_xYQS1rf5k8diG7IlmVmai1fllCvN7o9A8b0JSaV5Gn6SCwv5zw/s220/1714907742840.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiAn0i_inywSTb3g1etixO1JedP-_4biPmRSqFq1puuUUi_1VqwBE8plLdRb7bX9EbWR4gDS3UkzZhhIGvprERR59I4Sv0xFPqS3F1vrfK_pZH-E2aLLRKiX22Z2Sj0k-L8_wPL0lRNxNkNxgJxpkl-et6QWCsnR0oVzFZsZ5P0dgXTbocExc3ItfSazg/s72-c/robot-chat-3d-robot-voice-chat-online-help-help-talk-help-business_808398-1.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6011381329995167460.post-4130451640739237925</id><published>2024-05-28T10:54:00.004+05:30</published><updated>2024-05-28T11:07:39.172+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Python&#xa;Gen AI&#xa;Data Science"/><title type='text'>Creating a Fake Data Generator with Python 🤖📅</title><content type='html'>&lt;p&gt;In
 the world of data science and machine learning, having access to 
diverse datasets for experimentation is crucial. However, real-world 
data can be scarce, sensitive, or simply not available. This is where 
generating fake data becomes invaluable. In this post, I’ll walk you 
through creating a fake data generator using Python’s &lt;code class=&quot;cw mf mg mh mi b&quot;&gt;Faker&lt;/code&gt; library and displaying this data in a well-styled table using &lt;code class=&quot;cw mf mg mh mi b&quot;&gt;pandas&lt;/code&gt;.&lt;/p&gt;&lt;figure class=&quot;mm mn mo mp mq mr mj mk paragraph-image&quot;&gt;&lt;div class=&quot;ms mt ee mu bg mv&quot; role=&quot;button&quot; tabindex=&quot;0&quot;&gt;&lt;div class=&quot;mj mk ml&quot;&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot;&gt;&lt;/source&gt;&lt;source data-testid=&quot;og&quot;&gt;&lt;/source&gt;&lt;img alt=&quot;&quot; class=&quot;bg kp mw c&quot; height=&quot;177&quot; role=&quot;presentation&quot; src=&quot;https://miro.medium.com/v2/resize:fit:700/1*05V8ID1KTELDP3G-mxtxGA.png&quot; width=&quot;700&quot; /&gt;&lt;/picture&gt;&lt;/div&gt;&lt;/div&gt;&lt;figcaption class=&quot;mx my mz mj mk na nb be b bf z dw&quot; data-selectable-paragraph=&quot;&quot;&gt;Python output&lt;/figcaption&gt;&lt;/figure&gt;&lt;figure class=&quot;mm mn mo mp mq mr mj mk paragraph-image&quot;&gt;&lt;div class=&quot;ms mt ee mu bg mv&quot; role=&quot;button&quot; tabindex=&quot;0&quot;&gt;&lt;div class=&quot;mj mk nc&quot;&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot;&gt;&lt;/source&gt;&lt;source data-testid=&quot;og&quot;&gt;&lt;/source&gt;&lt;img alt=&quot;&quot; class=&quot;bg kp mw c&quot; height=&quot;295&quot; role=&quot;presentation&quot; src=&quot;https://miro.medium.com/v2/resize:fit:700/1*RlVGlwu0S4szZnCZbH34vw.png&quot; width=&quot;700&quot; /&gt;&lt;/picture&gt;&lt;/div&gt;&lt;/div&gt;&lt;figcaption class=&quot;mx my mz mj mk na nb be b bf z dw&quot; data-selectable-paragraph=&quot;&quot;&gt;HTML Output&lt;/figcaption&gt;&lt;/figure&gt;&lt;h2 class=&quot;nd ne fr be nf ng nh ni nj nk nl nm nn ls no np nq lw nr ns nt ma nu nv nw nx bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;77c9&quot;&gt;What You’ll Need&lt;/h2&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk ny lm ln lo nz lq lr ls oa lu lv lw ob ly lz ma oc mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;5bd0&quot;&gt;Before we dive in, ensure you have the following installed:&lt;/p&gt;&lt;ul&gt;&lt;li class=&quot;lh li fr lj b lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc md me od oe of bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;3ce4&quot;&gt;Python 3.x&lt;/li&gt;&lt;li class=&quot;lh li fr lj b lk og lm ln lo oh lq lr ls oi lu lv lw oj ly lz ma ok mc md me od oe of bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;9b00&quot;&gt;&lt;code class=&quot;cw mf mg mh mi b&quot;&gt;pandas&lt;/code&gt; library: &lt;code class=&quot;cw mf mg mh mi b&quot;&gt;pip install pandas&lt;/code&gt;&lt;/li&gt;&lt;li class=&quot;lh li fr lj b lk og lm ln lo oh lq lr ls oi lu lv lw oj ly lz ma ok mc md me od oe of bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;b35a&quot;&gt;&lt;code class=&quot;cw mf mg mh mi b&quot;&gt;Faker&lt;/code&gt; library: &lt;code class=&quot;cw mf mg mh mi b&quot;&gt;pip install faker&lt;/code&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h2 class=&quot;nd ne fr be nf ng nh ni nj nk nl nm nn ls no np nq lw nr ns nt ma nu nv nw nx bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;8ad3&quot;&gt;Step-by-Step Guide&lt;/h2&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk ny lm ln lo nz lq lr ls oa lu lv lw ob ly lz ma oc mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;7959&quot;&gt;Let’s build a script that generates a set of fake personal data and displays it in a structured format.&lt;/p&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk ny lm ln lo nz lq lr ls oa lu lv lw ob ly lz ma oc mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;7959&quot;&gt;&lt;b class=&quot;lj fs&quot;&gt;1. Import Necessary Libraries&lt;/b&gt;&lt;/p&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;37aa&quot;&gt;First, import the &lt;code class=&quot;cw mf mg mh mi b&quot;&gt;Faker&lt;/code&gt; and &lt;code class=&quot;cw mf mg mh mi b&quot;&gt;pandas&lt;/code&gt; libraries:&lt;/p&gt;&lt;pre class=&quot;mm mn mo mp mq om mi on bo oo ba bj&quot;&gt;&lt;span class=&quot;op ne fr mi b bf oq or l os ot&quot; data-selectable-paragraph=&quot;&quot; id=&quot;d4ab&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;from&lt;/span&gt; faker &lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; Faker&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; pandas &lt;span class=&quot;hljs-keyword&quot;&gt;as&lt;/span&gt; pd&lt;/span&gt;&lt;/pre&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;1ee1&quot;&gt;&lt;b class=&quot;lj fs&quot;&gt;2. Initialize Faker&lt;/b&gt;&lt;/p&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;e04f&quot;&gt;Create an instance of the &lt;code class=&quot;cw mf mg mh mi b&quot;&gt;Faker&lt;/code&gt; class:&lt;/p&gt;&lt;pre class=&quot;mm mn mo mp mq om mi on bo oo ba bj&quot;&gt;&lt;span class=&quot;op ne fr mi b bf oq or l os ot&quot; data-selectable-paragraph=&quot;&quot; id=&quot;9a9e&quot;&gt;fake = Faker()&lt;/span&gt;&lt;/pre&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;154f&quot;&gt;3. &lt;b class=&quot;lj fs&quot;&gt;Generate Fake Data&lt;/b&gt;&lt;/p&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;6b5b&quot;&gt;Define a dictionary to store the fake data:&lt;/p&gt;&lt;pre class=&quot;mm mn mo mp mq om mi on bo oo ba bj&quot;&gt;&lt;span class=&quot;op ne fr mi b bf oq or l os ot&quot; data-selectable-paragraph=&quot;&quot; id=&quot;7780&quot;&gt;data = { &lt;br /&gt;    &lt;span class=&quot;hljs-string&quot;&gt;&#39;First Name&#39;&lt;/span&gt;: [],&lt;br /&gt;    &lt;span class=&quot;hljs-string&quot;&gt;&#39;Last Name&#39;&lt;/span&gt;: [],&lt;br /&gt;    &lt;span class=&quot;hljs-string&quot;&gt;&#39;DOB&#39;&lt;/span&gt;: [],&lt;br /&gt;    &lt;span class=&quot;hljs-string&quot;&gt;&#39;Email&#39;&lt;/span&gt;: [],&lt;br /&gt;    &lt;span class=&quot;hljs-string&quot;&gt;&#39;City&#39;&lt;/span&gt;: [],&lt;br /&gt;    &lt;span class=&quot;hljs-string&quot;&gt;&#39;Country&#39;&lt;/span&gt;: [],&lt;br /&gt;    &lt;span class=&quot;hljs-string&quot;&gt;&#39;ZipCode&#39;&lt;/span&gt;: [],&lt;br /&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;2e44&quot;&gt;Use a loop to populate the dictionary with fake data: say 10 records&lt;/p&gt;&lt;pre class=&quot;mm mn mo mp mq om mi on bo oo ba bj&quot;&gt;&lt;span class=&quot;op ne fr mi b bf oq or l os ot&quot; data-selectable-paragraph=&quot;&quot; id=&quot;1160&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;for&lt;/span&gt; i &lt;span class=&quot;hljs-keyword&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;hljs-built_in&quot;&gt;range&lt;/span&gt;(&lt;span class=&quot;hljs-number&quot;&gt;11&lt;/span&gt;):&lt;br /&gt;    data[&lt;span class=&quot;hljs-string&quot;&gt;&#39;First Name&#39;&lt;/span&gt;].append(fake.first_name())&lt;br /&gt;    data[&lt;span class=&quot;hljs-string&quot;&gt;&#39;Last Name&#39;&lt;/span&gt;].append(fake.last_name())&lt;br /&gt;    data[&lt;span class=&quot;hljs-string&quot;&gt;&#39;DOB&#39;&lt;/span&gt;].append(fake.date_of_birth())&lt;br /&gt;    data[&lt;span class=&quot;hljs-string&quot;&gt;&#39;Email&#39;&lt;/span&gt;].append(fake.email())&lt;br /&gt;    data[&lt;span class=&quot;hljs-string&quot;&gt;&#39;City&#39;&lt;/span&gt;].append(fake.city())&lt;br /&gt;    data[&lt;span class=&quot;hljs-string&quot;&gt;&#39;ZipCode&#39;&lt;/span&gt;].append(fake.zipcode())&lt;br /&gt;    data[&lt;span class=&quot;hljs-string&quot;&gt;&#39;Country&#39;&lt;/span&gt;].append(fake.country())&lt;/span&gt;&lt;/pre&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;f845&quot;&gt;4. &lt;b class=&quot;lj fs&quot;&gt;Create a DataFrame&lt;/b&gt;&lt;/p&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;d5dc&quot;&gt;Convert the dictionary to a &lt;code class=&quot;cw mf mg mh mi b&quot;&gt;pandas&lt;/code&gt; DataFrame:&lt;/p&gt;&lt;pre class=&quot;mm mn mo mp mq om mi on bo oo ba bj&quot;&gt;&lt;span class=&quot;op ne fr mi b bf oq or l os ot&quot; data-selectable-paragraph=&quot;&quot; id=&quot;83bd&quot;&gt;df = pd.DataFrame(data)&lt;/span&gt;&lt;/pre&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;ac0c&quot;&gt;Print the DataFrame to see the generated data:&lt;/p&gt;&lt;pre class=&quot;mm mn mo mp mq om mi on bo oo ba bj&quot;&gt;&lt;span class=&quot;op ne fr mi b bf oq or l os ot&quot; data-selectable-paragraph=&quot;&quot; id=&quot;377b&quot;&gt;&lt;span class=&quot;hljs-built_in&quot;&gt;print&lt;/span&gt;(df)&lt;/span&gt;&lt;/pre&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;0427&quot;&gt;5. &lt;b class=&quot;lj fs&quot;&gt;Style the DataFrame (Optional)&lt;/b&gt;&lt;/p&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;3db7&quot;&gt;To display the DataFrame with borders, define a style and save the styled DataFrame to an HTML file:&lt;/p&gt;&lt;pre class=&quot;mm mn mo mp mq om mi on bo oo ba bj&quot;&gt;&lt;span class=&quot;op ne fr mi b bf oq or l os ot&quot; data-selectable-paragraph=&quot;&quot; id=&quot;f025&quot;&gt;styles = [&lt;br /&gt;    {&lt;span class=&quot;hljs-string&quot;&gt;&#39;selector&#39;&lt;/span&gt;: &lt;span class=&quot;hljs-string&quot;&gt;&#39;table&#39;&lt;/span&gt;, &lt;span class=&quot;hljs-string&quot;&gt;&#39;props&#39;&lt;/span&gt;: [(&lt;span class=&quot;hljs-string&quot;&gt;&#39;border-collapse&#39;&lt;/span&gt;, &lt;span class=&quot;hljs-string&quot;&gt;&#39;collapse&#39;&lt;/span&gt;)]},&lt;br /&gt;    {&lt;span class=&quot;hljs-string&quot;&gt;&#39;selector&#39;&lt;/span&gt;: &lt;span class=&quot;hljs-string&quot;&gt;&#39;th, td&#39;&lt;/span&gt;, &lt;span class=&quot;hljs-string&quot;&gt;&#39;props&#39;&lt;/span&gt;: [(&lt;span class=&quot;hljs-string&quot;&gt;&#39;border&#39;&lt;/span&gt;, &lt;span class=&quot;hljs-string&quot;&gt;&#39;1px solid black&#39;&lt;/span&gt;), (&lt;span class=&quot;hljs-string&quot;&gt;&#39;padding&#39;&lt;/span&gt;, &lt;span class=&quot;hljs-string&quot;&gt;&#39;5px&#39;&lt;/span&gt;)]},&lt;br /&gt;]&lt;br /&gt;&lt;br /&gt;styled_df = df.style.set_table_styles(styles)&lt;br /&gt;styled_df.to_html(&lt;span class=&quot;hljs-string&quot;&gt;&#39;styled_table.html&#39;&lt;/span&gt;)&lt;/span&gt;&lt;/pre&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;653a&quot;&gt;6. &lt;b class=&quot;lj fs&quot;&gt;Open the Styled Table (Optional)&lt;/b&gt;&lt;/p&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;589f&quot;&gt;The styled DataFrame is saved as &lt;code class=&quot;cw mf mg mh mi b&quot;&gt;styled_table.html&lt;/code&gt;. You can open this file in a web browser to view the data in a neat, tabular format with borders.&lt;/p&gt;&lt;pre class=&quot;mm mn mo mp mq om mi on bo oo ba bj&quot;&gt;&lt;span class=&quot;op ne fr mi b bf oq or l os ot&quot; data-selectable-paragraph=&quot;&quot; id=&quot;aa04&quot;&gt;&lt;span class=&quot;hljs-built_in&quot;&gt;print&lt;/span&gt;(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Styled table saved as &#39;styled_table.html&#39;. Open this file in a web browser to view the table with borders.&quot;&lt;/span&gt;)&lt;/span&gt;&lt;/pre&gt;&lt;h2 class=&quot;nd ne fr be nf ng nh ni nj nk nl nm nn ls no np nq lw nr ns nt ma nu nv nw nx bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;aeaa&quot;&gt;Full Code&lt;/h2&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk ny lm ln lo nz lq lr ls oa lu lv lw ob ly lz ma oc mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;9f13&quot;&gt;Here’s the full script:&lt;/p&gt;&lt;pre class=&quot;mm mn mo mp mq om mi on bo oo ba bj&quot;&gt;&lt;span class=&quot;op ne fr mi b bf oq or l os ot&quot; data-selectable-paragraph=&quot;&quot; id=&quot;304e&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;from&lt;/span&gt; faker &lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; Faker&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; pandas &lt;span class=&quot;hljs-keyword&quot;&gt;as&lt;/span&gt; pd&lt;br /&gt;&lt;br /&gt;fake = Faker()&lt;br /&gt;&lt;br /&gt;data = { &lt;br /&gt;    &lt;span class=&quot;hljs-string&quot;&gt;&#39;First Name&#39;&lt;/span&gt;: [],&lt;br /&gt;    &lt;span class=&quot;hljs-string&quot;&gt;&#39;Last Name&#39;&lt;/span&gt;: [],&lt;br /&gt;    &lt;span class=&quot;hljs-string&quot;&gt;&#39;DOB&#39;&lt;/span&gt;: [],&lt;br /&gt;    &lt;span class=&quot;hljs-string&quot;&gt;&#39;Email&#39;&lt;/span&gt;: [],&lt;br /&gt;    &lt;span class=&quot;hljs-string&quot;&gt;&#39;City&#39;&lt;/span&gt;: [],&lt;br /&gt;    &lt;span class=&quot;hljs-string&quot;&gt;&#39;Country&#39;&lt;/span&gt;: [],&lt;br /&gt;    &lt;span class=&quot;hljs-string&quot;&gt;&#39;ZipCode&#39;&lt;/span&gt;: [],&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;for&lt;/span&gt; i &lt;span class=&quot;hljs-keyword&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;hljs-built_in&quot;&gt;range&lt;/span&gt;(&lt;span class=&quot;hljs-number&quot;&gt;11&lt;/span&gt;):&lt;br /&gt;    data[&lt;span class=&quot;hljs-string&quot;&gt;&#39;First Name&#39;&lt;/span&gt;].append(fake.first_name())&lt;br /&gt;    data[&lt;span class=&quot;hljs-string&quot;&gt;&#39;Last Name&#39;&lt;/span&gt;].append(fake.last_name())&lt;br /&gt;    data[&lt;span class=&quot;hljs-string&quot;&gt;&#39;DOB&#39;&lt;/span&gt;].append(fake.date_of_birth())&lt;br /&gt;    data[&lt;span class=&quot;hljs-string&quot;&gt;&#39;Email&#39;&lt;/span&gt;].append(fake.email())&lt;br /&gt;    data[&lt;span class=&quot;hljs-string&quot;&gt;&#39;City&#39;&lt;/span&gt;].append(fake.city())&lt;br /&gt;    data[&lt;span class=&quot;hljs-string&quot;&gt;&#39;ZipCode&#39;&lt;/span&gt;].append(fake.zipcode())&lt;br /&gt;    data[&lt;span class=&quot;hljs-string&quot;&gt;&#39;Country&#39;&lt;/span&gt;].append(fake.country())&lt;br /&gt;&lt;br /&gt;df = pd.DataFrame(data)&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-built_in&quot;&gt;print&lt;/span&gt;(df)&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-comment&quot;&gt;# Generate a styled DataFrame and view it by saving the DataFrame to an HTML file and then opening that file in a web browser&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;hljs-comment&quot;&gt;# Define the table style to add borders&lt;/span&gt;&lt;br /&gt;styles = [&lt;br /&gt;    {&lt;span class=&quot;hljs-string&quot;&gt;&#39;selector&#39;&lt;/span&gt;: &lt;span class=&quot;hljs-string&quot;&gt;&#39;table&#39;&lt;/span&gt;, &lt;span class=&quot;hljs-string&quot;&gt;&#39;props&#39;&lt;/span&gt;: [(&lt;span class=&quot;hljs-string&quot;&gt;&#39;border-collapse&#39;&lt;/span&gt;, &lt;span class=&quot;hljs-string&quot;&gt;&#39;collapse&#39;&lt;/span&gt;)]},&lt;br /&gt;    {&lt;span class=&quot;hljs-string&quot;&gt;&#39;selector&#39;&lt;/span&gt;: &lt;span class=&quot;hljs-string&quot;&gt;&#39;th, td&#39;&lt;/span&gt;, &lt;span class=&quot;hljs-string&quot;&gt;&#39;props&#39;&lt;/span&gt;: [(&lt;span class=&quot;hljs-string&quot;&gt;&#39;border&#39;&lt;/span&gt;, &lt;span class=&quot;hljs-string&quot;&gt;&#39;1px solid black&#39;&lt;/span&gt;), (&lt;span class=&quot;hljs-string&quot;&gt;&#39;padding&#39;&lt;/span&gt;, &lt;span class=&quot;hljs-string&quot;&gt;&#39;5px&#39;&lt;/span&gt;)]},&lt;br /&gt;]&lt;br /&gt;&lt;br /&gt;styled_df = df.style.set_table_styles(styles)&lt;br /&gt;styled_df.to_html(&lt;span class=&quot;hljs-string&quot;&gt;&#39;styled_table.html&#39;&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;hljs-built_in&quot;&gt;print&lt;/span&gt;(&lt;span class=&quot;hljs-string&quot;&gt;&quot;Styled table saved as &#39;styled_table.html&#39;. Open this file in a web browser to view the table with borders.&quot;&lt;/span&gt;)&lt;/span&gt;&lt;/pre&gt;&lt;h1 class=&quot;ou ne fr be nf ov ow ox nj oy oz pa nn pb pc pd pe pf pg ph pi pj pk pl pm pn bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;fcdd&quot;&gt;Conclusion&lt;/h1&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk ny lm ln lo nz lq lr ls oa lu lv lw ob ly lz ma oc mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;eca5&quot;&gt;Using Python’s &lt;code class=&quot;cw mf mg mh mi b&quot;&gt;Faker&lt;/code&gt;
 library, you can easily generate realistic fake data for various 
purposes, from testing to developing machine learning models. By 
combining it with &lt;code class=&quot;cw mf mg mh mi b&quot;&gt;pandas&lt;/code&gt;, you can 
structure this data in a DataFrame and apply styles to make it more 
readable and visually appealing. This approach is not only practical but
 also enhances the presentation of your data, making it easier to 
analyze and share.&lt;/p&gt;&lt;p class=&quot;pw-post-body-paragraph lh li fr lj b lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc md me fk bj&quot; data-selectable-paragraph=&quot;&quot; id=&quot;254a&quot;&gt;Open the &lt;code class=&quot;cw mf mg mh mi b&quot;&gt;styled_table.html&lt;/code&gt;
 file in your web browser, and you&#39;ll see a beautifully formatted table 
containing the fake data, ready for use in your projects. Happy coding!&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://techiemate.blogspot.com/feeds/4130451640739237925/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techiemate.blogspot.com/2024/05/creating-fake-data-generator-with-python.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/4130451640739237925'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/4130451640739237925'/><link rel='alternate' type='text/html' href='http://techiemate.blogspot.com/2024/05/creating-fake-data-generator-with-python.html' title='Creating a Fake Data Generator with Python 🤖📅'/><author><name>Atanu Gupta</name><uri>http://www.blogger.com/profile/05529718294081550882</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_LZ_SzyDY_u8HW4LiUYlsEJKSSMR5zYs-ow0dK7kjPtYVYnB_nHhGXM3Ad8Gt9AxMhbi0UO3mSjuYBQq2Sli5kUe05z21o-xTJYAM-Pw6TErhMe4ITlrqdadJSCp_xYQS1rf5k8diG7IlmVmai1fllCvN7o9A8b0JSaV5Gn6SCwv5zw/s220/1714907742840.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6011381329995167460.post-536952075547714021</id><published>2024-02-02T14:23:00.002+05:30</published><updated>2024-02-05T14:01:43.452+05:30</updated><title type='text'>Virtual Network IP Addresses planning</title><content type='html'>&lt;p&gt;During Virtual network setup, the IP Address planning is very important else may run into over-provisioning or under-provisioning of resources. Be it in cloud or on-premise the concepts remain the same.&amp;nbsp;&lt;/p&gt;&lt;p&gt;Below is the list which will help as a reference while you plan for your Virtual Network and Subnet configuration. 👍&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKcsjkxBYrxe0wZdV6TDQVlknG2fwpS12MbFYuBVQZX389SQA2QT8d2uYKKH5iWSi3qow8MsU-LT83iFlcSKBDg7ZecZfz4FiVy4LdkX2LwtUBNEOXN64_2DLl4r5nNqLeAr01t9qFMDN5zecGkmtc0ziRDBZHlrxvDAGX04rPWVcRgOjKmCZOraQQvjI/s676/Vnet.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;676&quot; data-original-width=&quot;491&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKcsjkxBYrxe0wZdV6TDQVlknG2fwpS12MbFYuBVQZX389SQA2QT8d2uYKKH5iWSi3qow8MsU-LT83iFlcSKBDg7ZecZfz4FiVy4LdkX2LwtUBNEOXN64_2DLl4r5nNqLeAr01t9qFMDN5zecGkmtc0ziRDBZHlrxvDAGX04rPWVcRgOjKmCZOraQQvjI/s16000/Vnet.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&amp;nbsp;&lt;p&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://techiemate.blogspot.com/feeds/536952075547714021/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techiemate.blogspot.com/2024/02/virtual-network-ip-addresses-planning.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/536952075547714021'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/536952075547714021'/><link rel='alternate' type='text/html' href='http://techiemate.blogspot.com/2024/02/virtual-network-ip-addresses-planning.html' title='Virtual Network IP Addresses planning'/><author><name>Atanu Gupta</name><uri>http://www.blogger.com/profile/05529718294081550882</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_LZ_SzyDY_u8HW4LiUYlsEJKSSMR5zYs-ow0dK7kjPtYVYnB_nHhGXM3Ad8Gt9AxMhbi0UO3mSjuYBQq2Sli5kUe05z21o-xTJYAM-Pw6TErhMe4ITlrqdadJSCp_xYQS1rf5k8diG7IlmVmai1fllCvN7o9A8b0JSaV5Gn6SCwv5zw/s220/1714907742840.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKcsjkxBYrxe0wZdV6TDQVlknG2fwpS12MbFYuBVQZX389SQA2QT8d2uYKKH5iWSi3qow8MsU-LT83iFlcSKBDg7ZecZfz4FiVy4LdkX2LwtUBNEOXN64_2DLl4r5nNqLeAr01t9qFMDN5zecGkmtc0ziRDBZHlrxvDAGX04rPWVcRgOjKmCZOraQQvjI/s72-c/Vnet.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6011381329995167460.post-4494899114964662473</id><published>2022-10-19T16:51:00.006+05:30</published><updated>2022-10-28T10:43:52.749+05:30</updated><title type='text'>Azure Automation : Periodically delete log files in Virtual Machines</title><content type='html'>&lt;p&gt;It&#39;s vary common that you are running multiple agents in your virtual machines. Microsoft also deploys several agents behind the scene in your VMs to satisfy various configurations requirements. Now the problem starts when these agents start generating logs files locally and eventually starts eating up the disk space.&amp;nbsp;&lt;/p&gt;&lt;p&gt;You naturally by instinct jumps in to scale up your VMs or starts adding more disks to it inorder to maintain the performance. But this approach would cost your dearly as your Azure bill would shoot up substantially. Why not clean up those logs periodically with a scheduler and make your boss happy 😀 &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;Azure Automation&lt;/b&gt; with runbook type PowerShell is there to make you achieve this very comfortably. Create an automation account with a PowerShell runbook. The script is given below. Copy-Paste it &amp;gt;&amp;gt; Test it &amp;gt;&amp;gt; Schedule it. Done! Smart work isn&#39;t it 👍&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiC_BFJOw88TFZy4c6i5w6rCrEcFmQbwH4wDcXYBaFkF0F5tnFQ5Jp4cV2dJIaFEFcT8PESawHeU8HPIGmL5aN0vBZ1Q4Jl74SkciySbT4qAyUbkSmph7Xf_UCk0dwP00X6ukgTEJ_yaIKfeZKqiVAwtak0W0iog3lPD6l7n1yF0F9Q0SiVyIgUXG5/s624/2016_10_24_Automation-What%25u2019sNew-00.webp&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;316&quot; data-original-width=&quot;624&quot; height=&quot;203&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiC_BFJOw88TFZy4c6i5w6rCrEcFmQbwH4wDcXYBaFkF0F5tnFQ5Jp4cV2dJIaFEFcT8PESawHeU8HPIGmL5aN0vBZ1Q4Jl74SkciySbT4qAyUbkSmph7Xf_UCk0dwP00X6ukgTEJ_yaIKfeZKqiVAwtak0W0iog3lPD6l7n1yF0F9Q0SiVyIgUXG5/w400-h203/2016_10_24_Automation-What%25u2019sNew-00.webp&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;pre style=&quot;white-space: pre-wrap;&quot;&gt;$ResourceGroup = &#39;&amp;lt;&amp;lt;resource group name&amp;gt;&amp;gt;&#39;
$FolderPath = &#39;rm /&amp;lt;&amp;lt;log folder path&amp;gt;&amp;gt;/*&#39; #E.g. rm /home/user/temp/*

try
{
	Write-Output &quot;Connecting ...&quot;
	$message = Connect-AzAccount -Identity 
	Write-Output &quot;Connection successful&quot;

	#Get all Azure VMs which are in running state and are running Linux
	$myAzureVMs = Get-AzVM -status | Where-Object {$_.PowerState -eq &quot;VM running&quot; -and $_.StorageProfile.OSDisk.OSType -eq &quot;Linux&quot;}
	Write-Output &quot;Total Linux VMs detected : $($myAzureVMs.Name.Count)&quot;
	Write-Output &quot;VM Names : $($myAzureVMs.Name)&quot; 

	# Run the script against all the listed VMs
	if($myAzureVMs.Name.Count -gt 1)
	{
		For($val = 0; $val -le $myAzureVMs.Name.Count-1; $val++)
		{
			Write-Output &quot;Target VM : $($myAzureVMs.Name[$val]), File deletion in progress ...&quot;
			$message = Invoke-AzVMRunCommand -ResourceGroupName $ResourceGroup -Name $myAzureVMs.Name[$val] -CommandId &#39;RunShellScript&#39; -ScriptString $FolderPath
			Write-Output &quot;Operation completed successfully&quot; 
		}	
	}
	else {
		Write-Output &quot;Target VM : $($myAzureVMs.Name), File deletion in progress ...&quot;
		$message = Invoke-AzVMRunCommand -ResourceGroupName $ResourceGroup -Name $myAzureVMs.Name -CommandId &#39;RunShellScript&#39; -ScriptString $FolderPath
		Write-Output &quot;Operation completed successfully&quot; 
	}
}
catch
{
	Write-Error -Message $_.Exception
    throw $_.Exception
}
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://techiemate.blogspot.com/feeds/4494899114964662473/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techiemate.blogspot.com/2022/10/azure-automation-powershell-script-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/4494899114964662473'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/4494899114964662473'/><link rel='alternate' type='text/html' href='http://techiemate.blogspot.com/2022/10/azure-automation-powershell-script-to.html' title='Azure Automation : Periodically delete log files in Virtual Machines'/><author><name>Atanu Gupta</name><uri>http://www.blogger.com/profile/05529718294081550882</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_LZ_SzyDY_u8HW4LiUYlsEJKSSMR5zYs-ow0dK7kjPtYVYnB_nHhGXM3Ad8Gt9AxMhbi0UO3mSjuYBQq2Sli5kUe05z21o-xTJYAM-Pw6TErhMe4ITlrqdadJSCp_xYQS1rf5k8diG7IlmVmai1fllCvN7o9A8b0JSaV5Gn6SCwv5zw/s220/1714907742840.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiC_BFJOw88TFZy4c6i5w6rCrEcFmQbwH4wDcXYBaFkF0F5tnFQ5Jp4cV2dJIaFEFcT8PESawHeU8HPIGmL5aN0vBZ1Q4Jl74SkciySbT4qAyUbkSmph7Xf_UCk0dwP00X6ukgTEJ_yaIKfeZKqiVAwtak0W0iog3lPD6l7n1yF0F9Q0SiVyIgUXG5/s72-w400-h203-c/2016_10_24_Automation-What%25u2019sNew-00.webp" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6011381329995167460.post-8349035789796483157</id><published>2022-09-14T17:07:00.015+05:30</published><updated>2022-09-14T18:14:37.282+05:30</updated><title type='text'>Azure Active Directory Login for Linux Virtual Machines</title><content type='html'>&lt;p style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;color: #171717;&quot;&gt;To improve the security of Linux virtual machines (VMs) in Azure, now we can integrate the VM&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #171717;&quot;&gt;with Azure Active Directory (Azure AD) authentication.&amp;nbsp;Azure AD can be used as a core authentication platform to SSH into a Linux VM.&amp;nbsp;This functionality allows organizations to manage security access to VMs with Azure role-based access control (RBAC) and Conditional Access policies.&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 10px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;color: #171717;&quot;&gt;This article shows how to create and configure a Linux VM and log in with Azure AD by using OpenSSH certificate-based authentication.&lt;/span&gt;&lt;/p&gt;&lt;h2 id=&quot;AzureActiveDirectoryLoginforLinuxVirtualMachine-Benefits&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; border-bottom-color: rgb(255, 255, 255); color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 20px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: -0.008em; line-height: 1.5; margin: 30px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span class=&quot;handy-header aui-icon aui-icon-small aui-iconfont-link&quot; style=&quot;background-position: 0px 0px; background-repeat: no-repeat; border: medium none; cursor: copy; display: inline-block; height: 16px; line-height: 0; margin: 6px 0px 0px -20px; padding: 0px 4px 0px 0px; position: absolute; text-align: left; text-indent: -999em; vertical-align: text-bottom; visibility: hidden; width: 16px;&quot; title=&quot;Copy link&quot;&gt;&lt;/span&gt;&lt;span class=&quot;nh-number&quot;&gt;1.1.&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;Benefits&amp;nbsp;&lt;/span&gt;&lt;/h2&gt;&lt;ul style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; list-style-type: disc; margin: 10px 0px 0px; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;li&gt;Use your Azure AD credentials to log in to Azure Linux Virtual machines. No need to remember any separate login credentials.&lt;/li&gt;&lt;li&gt;No separate Bastion Virtual machine is required.&amp;nbsp;&lt;/li&gt;&lt;li&gt;No public IP/Port exposure for any Virtual machines to the outside world.&amp;nbsp;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;color: #171717;&quot;&gt;Get Open SSH key-based authentication without needing to distribute SSH keys to users or provision SSH public keys on any Azure Linux VMs that you deploy.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Reduce reliance on local administrator accounts, credential theft, and weak credentials.&lt;/li&gt;&lt;li&gt;With RBAC, specify who can log in to a virtual machine as a regular user or with administrator privileges. When users join your team, you can update the Azure RBAC policy for the VM to grant access as appropriate. When employees leave your organization and their user accounts are disabled or removed from Azure AD, they no longer have access to your resources.&lt;/li&gt;&lt;li&gt;&lt;p style=&quot;margin: 0px; padding: 0px;&quot;&gt;With Conditional Access, configure policies to require multifactor authentication or to require that your client device is managed (for example, compliant or hybrid Azure AD joined) before you can use it SSH into Linux VMs.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 10px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;/p&gt;&lt;div class=&quot;confluence-information-macro confluence-information-macro-information&quot; style=&quot;-webkit-text-stroke-width: 0px; background: rgb(252, 252, 252) none repeat scroll 0% 0%; border-radius: 5px; border: 1px solid rgb(170, 184, 198); color: #333333; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 10px 0px 1em; min-height: 20px; orphans: 2; padding: 10px 10px 10px 36px; position: relative; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;p class=&quot;title&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;Note&lt;/p&gt;&lt;span class=&quot;aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon&quot; style=&quot;background-position: 0px 0px; background-repeat: no-repeat; border: medium none; color: #4a6785; display: block; height: 16px; left: 10px; line-height: 20px; margin: 0px; padding: 0px; position: absolute; text-align: left; text-indent: -999em; top: 12px; vertical-align: text-bottom; width: 16px;&quot;&gt;&lt;/span&gt;&lt;div class=&quot;confluence-information-macro-body&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;p style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;Azure Active Directory native client for Azure Bastion is officially supported by Microsoft and is now GA. In this article we will use this feature to solve our objective of login to virtual machines with active directory login credentials.&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;h2 id=&quot;AzureActiveDirectoryLoginforLinuxVirtualMachine-InstallingAzureCLIonLocalLaptop/Desktop&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; border-bottom-color: rgb(255, 255, 255); color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 20px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: -0.008em; line-height: 1.5; margin: 30px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span class=&quot;handy-header aui-icon aui-icon-small aui-iconfont-link&quot; style=&quot;background-position: 0px 0px; background-repeat: no-repeat; border: medium none; cursor: copy; display: inline-block; height: 16px; line-height: 0; margin: 6px 0px 0px -20px; padding: 0px 4px 0px 0px; position: absolute; text-align: left; text-indent: -999em; vertical-align: text-bottom; visibility: hidden; width: 16px;&quot; title=&quot;Copy link&quot;&gt;&lt;/span&gt;&lt;span class=&quot;nh-number&quot;&gt;1.2.&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;Installing Azure CLI on Local Laptop/Desktop&lt;/span&gt;&lt;/h2&gt;&lt;ul style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; list-style-type: disc; margin: 10px 0px 0px; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;li&gt;Open command prompt. Type&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;az&lt;/b&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;at the root. This will check if azure cli is already installed in your VM and if found you would see something similar below and you can skip this section and move to next section.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6PZG_uAVEe6xsgH0Mv6svXwUbVCWsS0rmRmX7Hff8je6tO5TSFkTXksxooYY8Rnm-aNvwZSncPjQmq2o0lzyEHLC6o7HYXPe_gRyplt1bEPEsP5C37a9FjaUPz4hk77WcMcf6czB7FaAQ16rVZDBrIrVWK0lbWwC8aeH5Co_qnmrw9KFLVkfNsD2_/s867/cmdAZ.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;270&quot; data-original-width=&quot;867&quot; height=&quot;199&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6PZG_uAVEe6xsgH0Mv6svXwUbVCWsS0rmRmX7Hff8je6tO5TSFkTXksxooYY8Rnm-aNvwZSncPjQmq2o0lzyEHLC6o7HYXPe_gRyplt1bEPEsP5C37a9FjaUPz4hk77WcMcf6czB7FaAQ16rVZDBrIrVWK0lbWwC8aeH5Co_qnmrw9KFLVkfNsD2_/w640-h199/cmdAZ.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; list-style-type: disc; margin: 10px 0px 0px; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;li&gt;If not found then go ahead and install Azure CLI from the below link.&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 10px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;Windows&lt;/b&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;:&amp;nbsp;&lt;a class=&quot;external-link&quot; href=&quot;https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-windows?tabs=azure-cli&quot; rel=&quot;nofollow&quot; style=&quot;color: #0052cc; text-decoration: none;&quot;&gt;https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-windows?tabs=azure-cli&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 10px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;Linux&lt;/b&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;:&amp;nbsp;&lt;span style=&quot;letter-spacing: 0px;&quot;&gt;&amp;nbsp;curl -sL&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;a class=&quot;external-link&quot; href=&quot;https://aka.ms/InstallAzureCLIDeb&quot; rel=&quot;nofollow&quot; style=&quot;color: #0052cc; letter-spacing: 0px; text-decoration: none;&quot;&gt;https://aka.ms/InstallAzureCLIDeb&lt;/a&gt;&lt;span style=&quot;letter-spacing: 0px;&quot;&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;| sudo bash&lt;/span&gt;&lt;/p&gt;&lt;h2 id=&quot;AzureActiveDirectoryLoginforLinuxVirtualMachine-ConfiguringAADloginfeatureonNewApplicationVMs&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; border-bottom-color: rgb(255, 255, 255); color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 20px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: -0.008em; line-height: 1.5; margin: 30px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span class=&quot;nh-number&quot;&gt;1.3.&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;Configuring AAD login feature on New VMs&lt;/span&gt;&lt;/h2&gt;&lt;ul style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; list-style-type: disc; margin: 10px 0px 0px; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;li&gt;Create a new Linux Virtual Machine. Keeping all other configurations of your choice, make sure to check the &quot;Login with Azure AD&quot; feature on under the Management tab.&lt;span&gt; &lt;/span&gt;&lt;span style=&quot;color: #993300;&quot;&gt;💡 &lt;/span&gt;&lt;span style=&quot;color: #993300;&quot;&gt;This is very&amp;nbsp; important!&amp;nbsp;&lt;/span&gt;The identity will be automatically get selected to system assigned managed identity.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjr41et8v7uhK3YgeWHgBfbs_NMtQQCiR2ivMEdPuC6xK1tbYOUzH0ZHpPTKO9Rzk9rJ9QsOb3etqwAmMd0EypWF54a8ktYdzVu5fRXIThDUAhtc7SVJm6xjkv5k9sa0Y9XX1Nmk1wMU9yQ3WodM8f5ZQdHlwMSkjR3LcJbUIRwy2Ne3dV0PLPaL9i6/s1098/Pic4.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;841&quot; data-original-width=&quot;1098&quot; height=&quot;490&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjr41et8v7uhK3YgeWHgBfbs_NMtQQCiR2ivMEdPuC6xK1tbYOUzH0ZHpPTKO9Rzk9rJ9QsOb3etqwAmMd0EypWF54a8ktYdzVu5fRXIThDUAhtc7SVJm6xjkv5k9sa0Y9XX1Nmk1wMU9yQ3WodM8f5ZQdHlwMSkjR3LcJbUIRwy2Ne3dV0PLPaL9i6/w640-h490/Pic4.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; list-style-type: disc; margin: 10px 0px 0px; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;li&gt;Once the VM gets provisioned, you must see the installed Azure AD Login extensions under the Extensions + applications menu under Settings blade of the respective VM.&amp;nbsp; &lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2_pAc5PuEVwejTMI0X2DFIYj06JMWWuhhfFUAgiBTbKrt_Xx8BAfWQCYzhz95acU2jVVU41BTmDzF_oRC5rRe-bcX_I4mTAWFx_dQixNFHL3rhZKrCR6RHosTqThxsKBrMGx1nGlOZLrF9x1pIzYYdOwMVS4s_KBQ0WNSraMR85fBGAkRGu2s2XYY/s1894/Pic5.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;542&quot; data-original-width=&quot;1894&quot; height=&quot;183&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2_pAc5PuEVwejTMI0X2DFIYj06JMWWuhhfFUAgiBTbKrt_Xx8BAfWQCYzhz95acU2jVVU41BTmDzF_oRC5rRe-bcX_I4mTAWFx_dQixNFHL3rhZKrCR6RHosTqThxsKBrMGx1nGlOZLrF9x1pIzYYdOwMVS4s_KBQ0WNSraMR85fBGAkRGu2s2XYY/w640-h183/Pic5.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;h2 id=&quot;AzureActiveDirectoryLoginforLinuxVirtualMachine-EnablingAADloginfeatureonExistingApplicationVMs&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; border-bottom-color: rgb(255, 255, 255); color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 20px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: -0.008em; line-height: 1.5; margin: 30px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span class=&quot;nh-number&quot;&gt;1.4.&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;Enabling AAD login feature on Existing VMs&lt;/span&gt;&lt;/h2&gt;&lt;ul style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; list-style-type: disc; margin: 10px 0px 0px; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;li&gt;&lt;span style=&quot;color: black;&quot;&gt;Go to the Setting blade of the respective VM and click on Extensions + application menu. Click +Add to add a new extension&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 10px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicRHffpxBTIanl41W4ZpkLTSU4cOQrswEgZTFj4KyiPeRLWSNu4l7Jpot-woIZROuA2O5psLGDRhJC8_x7g5d7-6V_sQU54Yd0TqztfAC3Gc01VvbM_fcWM97yNlTSKQPmG3uTWelc1agoEkB7qrxVHkUmhwAXlno49iCjTHKxHH1x7EwGPM2cEgZd/s881/Pic6.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;494&quot; data-original-width=&quot;881&quot; height=&quot;358&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicRHffpxBTIanl41W4ZpkLTSU4cOQrswEgZTFj4KyiPeRLWSNu4l7Jpot-woIZROuA2O5psLGDRhJC8_x7g5d7-6V_sQU54Yd0TqztfAC3Gc01VvbM_fcWM97yNlTSKQPmG3uTWelc1agoEkB7qrxVHkUmhwAXlno49iCjTHKxHH1x7EwGPM2cEgZd/w640-h358/Pic6.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;ul style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; list-style-type: disc; margin: 10px 0px 0px; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;li&gt;&lt;span style=&quot;color: black;&quot;&gt;Select extension&amp;nbsp; &quot;Azure AD based SSH Login&quot; and click Next and then Review and create button. Click Create after the validation passed message is shown.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 10px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjArHS0OAYFiXpwFmfS0YI4UDtsfBinknRscAIdbsz8TgyADzyTi1kecLChWZskgKuZ514HSZ3RF61iuGdpXnpmNuG8uG6xxo0BTaJOKcz68HVqQprOVjY-Wi4K841gt52QzGhwezeO7eU-9XgFgG7sfc88g88oXFr_uEF1_xZJ8vYS49-vveRMhgN8/s1848/Pic7.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;734&quot; data-original-width=&quot;1848&quot; height=&quot;254&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjArHS0OAYFiXpwFmfS0YI4UDtsfBinknRscAIdbsz8TgyADzyTi1kecLChWZskgKuZ514HSZ3RF61iuGdpXnpmNuG8uG6xxo0BTaJOKcz68HVqQprOVjY-Wi4K841gt52QzGhwezeO7eU-9XgFgG7sfc88g88oXFr_uEF1_xZJ8vYS49-vveRMhgN8/w640-h254/Pic7.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;ul style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; list-style-type: disc; margin: 10px 0px 0px; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;li&gt;&lt;span style=&quot;color: black;&quot;&gt;After the installation complete check the Extensions + application menu again under the Settings blade of the VM. This time it must show the installed extension&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 10px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3SFkxM_I--na9F2hfSZM8y-L8syrEubxLlja5TATagI3TDPGD_C-vUjt_2YjjmPpLtP8ESTvXyNfF09VRL3usYlgdPLekYaReVUZ6ElgT_-DChrv5-eCys-n_VYjUmVhLyMPPA0HaMOoA8FU_59JKtheJsp_vzm2EZcXSLDJp7Du5scXwakYV_MV4/s1909/Pic8.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;442&quot; data-original-width=&quot;1909&quot; height=&quot;148&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3SFkxM_I--na9F2hfSZM8y-L8syrEubxLlja5TATagI3TDPGD_C-vUjt_2YjjmPpLtP8ESTvXyNfF09VRL3usYlgdPLekYaReVUZ6ElgT_-DChrv5-eCys-n_VYjUmVhLyMPPA0HaMOoA8FU_59JKtheJsp_vzm2EZcXSLDJp7Du5scXwakYV_MV4/w640-h148/Pic8.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;h2 id=&quot;AzureActiveDirectoryLoginforLinuxVirtualMachine-TerraformScripttoenableAADlogin(LinuxVM)&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; border-bottom-color: rgb(255, 255, 255); color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 20px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: -0.008em; line-height: 1.5; margin: 30px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span class=&quot;handy-header aui-icon aui-icon-small aui-iconfont-link&quot; style=&quot;background-position: 0px 0px; background-repeat: no-repeat; border: medium none; cursor: copy; display: inline-block; height: 16px; line-height: 0; margin: 6px 0px 0px -20px; padding: 0px 4px 0px 0px; position: absolute; text-align: left; text-indent: -999em; vertical-align: text-bottom; visibility: hidden; width: 16px;&quot; title=&quot;Copy link&quot;&gt;&lt;/span&gt;&lt;span class=&quot;nh-number&quot;&gt;1.5.&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;Terraform Script to enable AAD login (Linux VM)&lt;/span&gt;&lt;/h2&gt;&lt;blockquote style=&quot;-webkit-text-stroke-width: 0px; background-color: white; border-left: 1px solid rgb(223, 225, 229); color: #7a869a; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 10px 0px 0px 19px; orphans: 2; padding: 10px 20px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;pre data-bidi-marker=&quot;true&quot; style=&quot;font-family: ConfluenceInstalledFont, monospace; margin: 0px; padding: 0px;&quot;&gt;resource &quot;azurerm_linux_virtual_machine&quot; &quot;example&quot; {&lt;br /&gt;   // blah-blah&lt;br /&gt;   identity {&lt;br /&gt;      type = &quot;SystemAssigned&quot; &lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;resource &quot;azurerm_virtual_machine_extension&quot; &quot;example&quot; {&lt;br /&gt;   name = &quot;AADSSHLoginForLinux_extn&quot;&lt;br /&gt;   virtual_machine_id = azurerm_linux_virtual_machine.example.id&lt;br /&gt;   publisher = &quot;Microsoft.Azure.ActiveDirectory&quot;&lt;br /&gt;   type = &quot;AADSSHLoginForLinux&quot;&lt;br /&gt;   type_handler_version = &quot;1.0&quot;&lt;br /&gt;}&lt;/pre&gt;&lt;/blockquote&gt;&lt;h2 id=&quot;AzureActiveDirectoryLoginforLinuxVirtualMachine-EnablingRBAC(Configureroleassignments)&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; border-bottom-color: rgb(255, 255, 255); color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 20px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: -0.008em; line-height: 1.5; margin: 30px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span class=&quot;handy-header aui-icon aui-icon-small aui-iconfont-link&quot; style=&quot;background-position: 0px 0px; background-repeat: no-repeat; border: medium none; cursor: copy; display: inline-block; height: 16px; line-height: 0; margin: 6px 0px 0px -20px; padding: 0px 4px 0px 0px; position: absolute; text-align: left; text-indent: -999em; vertical-align: text-bottom; visibility: hidden; width: 16px;&quot; title=&quot;Copy link&quot;&gt;&lt;/span&gt;&lt;span class=&quot;nh-number&quot;&gt;1.6.&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;Enabling RBAC (Configure role assignments)&lt;/span&gt;&lt;/h2&gt;&lt;p style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 10px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;color: green;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;Any of the following roles must be given to the user accessing the VM.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 10px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;color: green;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: maroon;&quot;&gt;💡 &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;Assigning any of these roles to a particular user or to a particular group is mandatory inorder to access the VM via Azure AD&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;credentials&lt;/span&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;ol style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; list-style-type: decimal; margin: 10px 0px 0px; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;li&gt;&lt;b&gt;Virtual Machine Administrator Login&lt;/b&gt;: Users who have this role assigned can log in to an Azure virtual machine with administrator privileges.&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;color: green;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;b style=&quot;text-align: left;&quot;&gt;Virtual Machine User Login&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: #171717;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;:&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;Users who have this role assigned can log in to an Azure virtual machine with regular user privileges&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;ul style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; list-style-type: disc; margin: 10px 0px 0px; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;li&gt;From the Access control (IAM) menu of the respective VM; click on +Add and select Add role assignment submenu option. You must have &quot;Owner&quot; or &quot;User Access Administrator&quot; privilege to perform this operation.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0KtwjHDJplmOrRwtjlqf_3HIgJ_7_4QJHKzmfWzFpW7WQUS07Vl3oVjcRm2hlaGXoYDaOGIMPl38Js0k-K_aPrgJXP6sygfaPepu7qHHuIbgtUuUY1g7uAkrukmmKU59X2WcZDqB9Z6AaBeZTPQfOljmgOHR1df-eSIxV0RYG4c4okesIFfZePYtJ/s1358/Pic9.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;212&quot; data-original-width=&quot;1358&quot; height=&quot;100&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0KtwjHDJplmOrRwtjlqf_3HIgJ_7_4QJHKzmfWzFpW7WQUS07Vl3oVjcRm2hlaGXoYDaOGIMPl38Js0k-K_aPrgJXP6sygfaPepu7qHHuIbgtUuUY1g7uAkrukmmKU59X2WcZDqB9Z6AaBeZTPQfOljmgOHR1df-eSIxV0RYG4c4okesIFfZePYtJ/w640-h100/Pic9.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; list-style-type: disc; margin: 10px 0px 0px; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;li&gt;Search for any of the above role and proceed. I have selected the &quot;Virtual Machine Administrator Login&quot; role for this article. Click Next&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibeiGj-knacM6clNv3giNdGTNxcI07QkDiManYkh71PdULsnN2HpyGulWa3QvtfWmj22LTq0qayQYueFSPZAdQloAmcsArWjh6sB7LdWeN5Elw47wigxh7lbxdS6FnDBAcTo-CBD_jK0gxJt8iGWLhYk5TZ8sLJXihBEdSOE41QYrM1elUIDr2yCu8/s1169/Pic10.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;515&quot; data-original-width=&quot;1169&quot; height=&quot;282&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibeiGj-knacM6clNv3giNdGTNxcI07QkDiManYkh71PdULsnN2HpyGulWa3QvtfWmj22LTq0qayQYueFSPZAdQloAmcsArWjh6sB7LdWeN5Elw47wigxh7lbxdS6FnDBAcTo-CBD_jK0gxJt8iGWLhYk5TZ8sLJXihBEdSOE41QYrM1elUIDr2yCu8/w640-h282/Pic10.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; list-style-type: disc; margin: 10px 0px 0px; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;li&gt;Select an user or group to whom you want the role to get assigned. Click Review + assign&lt;/li&gt;&lt;/ul&gt;&lt;h2 id=&quot;AzureActiveDirectoryLoginforLinuxVirtualMachine-ConfiguringAzureBastion(WithNativesupport,NewBastionHost)&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; border-bottom-color: rgb(255, 255, 255); color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 20px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: -0.008em; line-height: 1.5; margin: 30px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span class=&quot;handy-header aui-icon aui-icon-small aui-iconfont-link&quot; style=&quot;background-position: 0px 0px; background-repeat: no-repeat; border: medium none; cursor: copy; display: inline-block; height: 16px; line-height: 0; margin: 6px 0px 0px -20px; padding: 0px 4px 0px 0px; position: absolute; text-align: left; text-indent: -999em; vertical-align: text-bottom; visibility: hidden; width: 16px;&quot; title=&quot;Copy link&quot;&gt;&lt;/span&gt;&lt;span class=&quot;nh-number&quot;&gt;1.7.&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;Configuring Azure Bastion (With Native support, New Bastion Host)&lt;/span&gt;&lt;/h2&gt;&lt;ul style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; list-style-type: disc; margin: 10px 0px 0px; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;li&gt;&lt;span style=&quot;color: black;&quot;&gt;Create a new azure bastion service.&amp;nbsp;&lt;/span&gt;Keeping all other configurations of your choice, make sure to check the &quot;Native client support&quot; feature on under the Advanced tab.&lt;span&gt; &lt;/span&gt;💡 &lt;span style=&quot;color: #993300;&quot;&gt;This is very&amp;nbsp; important!&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #993300;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 10px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYim4un_K1OJvvXJe11hBf7POs9UtxLTXuZTRm13hQ-O0iYzLIBS_R3-WGwjm7lKtl9YClE6SVyQrIqp5xCckcEuhHAILfGcFbb4i4qT8MwJJLAIhXTwuCDLpa1b259MjBVuMOcrsjVgOJdY0xqTHVQex-ySADhmuKHR5p08UeDRgbh71vzga4g7t6/s851/bastionNew.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;513&quot; data-original-width=&quot;851&quot; height=&quot;386&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYim4un_K1OJvvXJe11hBf7POs9UtxLTXuZTRm13hQ-O0iYzLIBS_R3-WGwjm7lKtl9YClE6SVyQrIqp5xCckcEuhHAILfGcFbb4i4qT8MwJJLAIhXTwuCDLpa1b259MjBVuMOcrsjVgOJdY0xqTHVQex-ySADhmuKHR5p08UeDRgbh71vzga4g7t6/w640-h386/bastionNew.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;h2 id=&quot;AzureActiveDirectoryLoginforLinuxVirtualMachine-ConfiguringAzureBastion(WithNativesupport,ExistingBastionHost)&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; border-bottom-color: rgb(255, 255, 255); color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 20px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: -0.008em; line-height: 1.5; margin: 30px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span class=&quot;handy-header aui-icon aui-icon-small aui-iconfont-link&quot; style=&quot;background-position: 0px 0px; background-repeat: no-repeat; border: medium none; cursor: copy; display: inline-block; height: 16px; line-height: 0; margin: 6px 0px 0px -20px; padding: 0px 4px 0px 0px; position: absolute; text-align: left; text-indent: -999em; vertical-align: text-bottom; visibility: hidden; width: 16px;&quot; title=&quot;Copy link&quot;&gt;&lt;/span&gt;&lt;span class=&quot;nh-number&quot;&gt;1.8.&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;Configuring Azure Bastion (With Native support, Existing Bastion Host)&lt;/span&gt;&lt;/h2&gt;&lt;ul style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; list-style-type: disc; margin: 10px 0px 0px; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;li&gt;&lt;span style=&quot;color: black;&quot;&gt;Go to the Configuration option under the Setting tab and check the &quot;Native client support&quot; checkbox. Hit Apply.&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 10px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFCVEg6Zwfv-RulYejtEK7WurKd0UrIAHJ0UDEZIEDgjR04_eMKtFvgJtbF_H_uNp8Lxtlq7ZYyePNoggSAyUNFw82PRKEEZVNsmjf2KVVrvJCJC8UnieDLqyURvYBdg91C-445Q1ZZGJzmNg8uOkwzGSeq7sww9uWKxrgjaF9577BDr7IoIRPkGt2/s1349/bastionOld.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;717&quot; data-original-width=&quot;1349&quot; height=&quot;340&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFCVEg6Zwfv-RulYejtEK7WurKd0UrIAHJ0UDEZIEDgjR04_eMKtFvgJtbF_H_uNp8Lxtlq7ZYyePNoggSAyUNFw82PRKEEZVNsmjf2KVVrvJCJC8UnieDLqyURvYBdg91C-445Q1ZZGJzmNg8uOkwzGSeq7sww9uWKxrgjaF9577BDr7IoIRPkGt2/w640-h340/bastionOld.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;h2 id=&quot;AzureActiveDirectoryLoginforLinuxVirtualMachine-TerraformScripttoenableNativeclientsupportforAzureBastionHost&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; border-bottom-color: rgb(255, 255, 255); color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 20px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: -0.008em; line-height: 1.5; margin: 30px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span class=&quot;handy-header aui-icon aui-icon-small aui-iconfont-link&quot; style=&quot;background-position: 0px 0px; background-repeat: no-repeat; border: medium none; cursor: copy; display: inline-block; height: 16px; line-height: 0; margin: 6px 0px 0px -20px; padding: 0px 4px 0px 0px; position: absolute; text-align: left; text-indent: -999em; vertical-align: text-bottom; visibility: hidden; width: 16px;&quot; title=&quot;Copy link&quot;&gt;&lt;/span&gt;&lt;span class=&quot;nh-number&quot;&gt;1.9.&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;Terraform Script to enable Native client support for Azure Bastion Host&lt;/span&gt;&lt;/h2&gt;&lt;blockquote style=&quot;-webkit-text-stroke-width: 0px; background-color: white; border-left: 1px solid rgb(223, 225, 229); color: #7a869a; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 10px 0px 0px 19px; orphans: 2; padding: 10px 20px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;pre data-bidi-marker=&quot;true&quot; style=&quot;font-family: ConfluenceInstalledFont, monospace; margin: 0px; padding: 0px;&quot;&gt;resource &quot;azurerm_bastion_host&quot; &quot;example&quot; {&lt;br /&gt;   // blah-blah&lt;br /&gt;   tunneling_enabled = true&lt;br /&gt;}&lt;/pre&gt;&lt;/blockquote&gt;&lt;h2 id=&quot;AzureActiveDirectoryLoginforLinuxVirtualMachine-LogintoApplicationVMswithAzureADcredentialsviaBastionHost(LocalLaptop/Desktop)&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; border-bottom-color: rgb(255, 255, 255); color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 20px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: -0.008em; line-height: 1.5; margin: 30px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span class=&quot;handy-header aui-icon aui-icon-small aui-iconfont-link&quot; style=&quot;background-position: 0px 0px; background-repeat: no-repeat; border: medium none; cursor: copy; display: inline-block; height: 16px; line-height: 0; margin: 6px 0px 0px -20px; padding: 0px 4px 0px 0px; position: absolute; text-align: left; text-indent: -999em; vertical-align: text-bottom; visibility: hidden; width: 16px;&quot; title=&quot;Copy link&quot;&gt;&lt;/span&gt;&lt;span class=&quot;nh-number&quot;&gt;1.10.&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;Login to Application VMs with Azure AD credentials via Bastion Host (Local Laptop/Desktop)&lt;/span&gt;&lt;/h2&gt;&lt;ul style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; list-style-type: disc; margin: 10px 0px 0px; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;li&gt;Open Windows Command Prompt or Windows PowerShell IDE in your machine.&amp;nbsp;&lt;/li&gt;&lt;li&gt;Type&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;az login&lt;/b&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;and press enter.&amp;nbsp;&lt;span style=&quot;color: #993300;&quot;&gt;(&lt;span style=&quot;color: black;&quot;&gt;Make sure you are disconnected from G+D VPN,&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #993300;&quot;&gt; 💡 &lt;/span&gt;&lt;span style=&quot;color: #993300; letter-spacing: 0px;&quot;&gt;This is important!&lt;/span&gt;&lt;span style=&quot;color: #993300;&quot;&gt;)&lt;i&gt;.&amp;nbsp;&lt;/i&gt;&lt;span style=&quot;color: black;&quot;&gt;This will open up a browser window as would ask for login credentials.&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;Please enter your azure active directory login credentials.&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #993300;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 10px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;color: #993300;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;span style=&quot;color: #993300;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFJYn3EcbD_7LYillJEnTLO8s-b1B-BoRQrFg699jyGe65VZJrdvsEe9iK9Qgi5Yoh3Eimgh2kn0vYm9G0DFysTCxEvvHBtvzC1lv7p-cpQcK1Wv7yTrDVwFUJ3kpALfUn2AqscxkhD4uqy6Dn8ACBz-yMTklshwltjz8Z5NJBDw3-uCKtFKc57MRI/s1323/azlogin.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;138&quot; data-original-width=&quot;1323&quot; height=&quot;66&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFJYn3EcbD_7LYillJEnTLO8s-b1B-BoRQrFg699jyGe65VZJrdvsEe9iK9Qgi5Yoh3Eimgh2kn0vYm9G0DFysTCxEvvHBtvzC1lv7p-cpQcK1Wv7yTrDVwFUJ3kpALfUn2AqscxkhD4uqy6Dn8ACBz-yMTklshwltjz8Z5NJBDw3-uCKtFKc57MRI/w640-h66/azlogin.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;ul style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; list-style-type: disc; margin: 10px 0px 0px; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;li&gt;&lt;span style=&quot;color: #993300;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;Upon successful login, it will show all the subscription on which you have access under the tenant. You can execute the following command to list all subscriptions in a readable table format.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;blockquote style=&quot;-webkit-text-stroke-width: 0px; background-color: white; border-left: 1px solid rgb(223, 225, 229); color: #7a869a; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 10px 0px 0px 19px; orphans: 2; padding: 10px 20px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;pre data-bidi-marker=&quot;true&quot; style=&quot;font-family: ConfluenceInstalledFont, monospace; margin: 0px; padding: 0px;&quot;&gt;az account list -o table  &lt;span style=&quot;color: #993300;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;confluence-embedded-file-wrapper confluence-embedded-manual-size&quot; style=&quot;display: inline-block; max-width: none; position: relative;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;ul style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; list-style-type: disc; margin: 10px 0px 0px; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;li&gt;&lt;span style=&quot;color: #993300;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;Type the following command to check the current subscription you are logged in.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;blockquote style=&quot;-webkit-text-stroke-width: 0px; background-color: white; border-left: 1px solid rgb(223, 225, 229); color: #7a869a; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 10px 0px 0px 19px; orphans: 2; padding: 10px 20px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;pre data-bidi-marker=&quot;true&quot; style=&quot;font-family: ConfluenceInstalledFont, monospace; margin: 0px; padding: 0px;&quot;&gt;az account show -o table&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/pre&gt;&lt;/blockquote&gt;&lt;p style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 10px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;color: #993300;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; If it&#39;s the right subscription then move to the next step. Else execute the following command to set your correct subscription.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;blockquote style=&quot;-webkit-text-stroke-width: 0px; background-color: white; border-left: 1px solid rgb(223, 225, 229); color: #7a869a; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 10px 0px 0px 19px; orphans: 2; padding: 10px 20px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;p style=&quot;margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;az account set --subscription &quot;&amp;lt;&amp;lt;subscription_id or subscription_name&amp;gt;&amp;gt;&quot;&amp;nbsp;&lt;/p&gt;&lt;/blockquote&gt;&lt;ul style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; list-style-type: disc; margin: 10px 0px 0px; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;li&gt;&lt;span style=&quot;color: #993300;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;Get the resource id of your target VM by running the following query. Copy the return value and keep in notepad. You would need this in the next step&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;blockquote style=&quot;-webkit-text-stroke-width: 0px; background-color: white; border-left: 1px solid rgb(223, 225, 229); color: #7a869a; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 10px 0px 0px 19px; orphans: 2; padding: 10px 20px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;pre data-bidi-marker=&quot;true&quot; style=&quot;font-family: ConfluenceInstalledFont, monospace; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;az vm show --name &amp;lt;&amp;lt;vm name&amp;gt;&amp;gt; --resource-group &amp;lt;&amp;lt;resource group name&amp;gt;&amp;gt; --query &quot;id&quot;&lt;/pre&gt;&lt;/blockquote&gt;&lt;ul style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; list-style-type: disc; margin: 10px 0px 0px; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;li&gt;&lt;span style=&quot;color: #993300;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;Now the important part which we are waiting for. We are going to login to our target VM via Azure Bastion. Run the following command&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;blockquote style=&quot;-webkit-text-stroke-width: 0px; background-color: white; border-left: 1px solid rgb(223, 225, 229); color: #7a869a; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 10px 0px 0px 19px; orphans: 2; padding: 10px 20px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;pre data-bidi-marker=&quot;true&quot; style=&quot;font-family: ConfluenceInstalledFont, monospace; margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;az network bastion ssh \&lt;br /&gt; --name &quot;&amp;lt;&amp;lt;bastion-host name&amp;gt;&amp;gt;&quot; \&lt;br /&gt; --resource-group &quot;&amp;lt;&amp;lt;resource group name&amp;gt;&amp;gt;&quot; \&lt;br /&gt; --target-resource-id &quot;&amp;lt;&amp;lt;vm resource id copied from the previous step&amp;gt;&amp;gt;&quot; \&lt;br /&gt; --auth-type &quot;AAD&quot;&lt;/pre&gt;&lt;/blockquote&gt;&lt;ul style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; list-style-type: disc; margin: 10px 0px 0px; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;li&gt;&lt;span style=&quot;color: #993300;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;b&gt;Voila&lt;/b&gt;!... you are now successfully connected to your target VM via Azure Bastion. 😊 The prompt will quickly change to show your [AAD login id]@[target VM name]&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style=&quot;color: #993300;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: orange;&quot;&gt;Congratulations&lt;/span&gt;&lt;/b&gt;! for coming this far. Hope this article will help you to further explore more on this topic.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: #993300;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;Do share with me about your experience and what you have built upon this
 foundation. I would love 
to hear from you. &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://techiemate.blogspot.com/feeds/8349035789796483157/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techiemate.blogspot.com/2022/09/azure-active-directory-login-for-linux.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/8349035789796483157'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/8349035789796483157'/><link rel='alternate' type='text/html' href='http://techiemate.blogspot.com/2022/09/azure-active-directory-login-for-linux.html' title='Azure Active Directory Login for Linux Virtual Machines'/><author><name>Atanu Gupta</name><uri>http://www.blogger.com/profile/05529718294081550882</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_LZ_SzyDY_u8HW4LiUYlsEJKSSMR5zYs-ow0dK7kjPtYVYnB_nHhGXM3Ad8Gt9AxMhbi0UO3mSjuYBQq2Sli5kUe05z21o-xTJYAM-Pw6TErhMe4ITlrqdadJSCp_xYQS1rf5k8diG7IlmVmai1fllCvN7o9A8b0JSaV5Gn6SCwv5zw/s220/1714907742840.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6PZG_uAVEe6xsgH0Mv6svXwUbVCWsS0rmRmX7Hff8je6tO5TSFkTXksxooYY8Rnm-aNvwZSncPjQmq2o0lzyEHLC6o7HYXPe_gRyplt1bEPEsP5C37a9FjaUPz4hk77WcMcf6czB7FaAQ16rVZDBrIrVWK0lbWwC8aeH5Co_qnmrw9KFLVkfNsD2_/s72-w640-h199-c/cmdAZ.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6011381329995167460.post-434719320556565373</id><published>2022-02-10T18:30:00.002+05:30</published><updated>2022-02-10T18:32:17.425+05:30</updated><title type='text'>Azure SQL Diagnostics &amp; Event Hub</title><content type='html'>&lt;p&gt;&lt;b&gt;Auditing &amp;amp; Monitoring&lt;/b&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;is one of the strong pillar in any SDLC process and in today&#39;s cloud arena it became even more important. In this article we would learn how to enable auditing capability in Azure SQL database and would also witness some LIVE stream of audit data. When it comes to auditing in Azure SQL, the platform gives you three choices for log destination. You can choose as per your requirement&lt;/p&gt;&lt;h4 id=&quot;AzureSQL-Auditing&amp;amp;MonitoringisoneofthestrongpillarinanySDLCprocessandintoday&#39;scloudarenaitbecameevenmoreimportant.InthisarticlewewouldlearnhowtoenableauditingcapabilityinAzureSQLdatabaseandwouldalsowitnesssomeLIVEstreamofauditdata.WhenitcomestoauditinginA&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 600; letter-spacing: -0.003em; line-height: 1.42857; margin: 20px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&amp;nbsp;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEibV-Q3uzzxHJ1cOCoGE4Lo5IrPi7qxSRyRl_6bfVY0KkD7YhXJDU0HnVofUAfbvTGerYcr-W8EedQEAEOaF2M1PMMHcsiMu3NSKvb0r58yxlyd4j3w1mq41h_Bx_fN1XsyoW67pGNnwmF7VUpkSw0bfNItnWN9P8ov5ixl8YDWVdC_F4zk15ssb2Po=s395&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;187&quot; data-original-width=&quot;395&quot; height=&quot;151&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEibV-Q3uzzxHJ1cOCoGE4Lo5IrPi7qxSRyRl_6bfVY0KkD7YhXJDU0HnVofUAfbvTGerYcr-W8EedQEAEOaF2M1PMMHcsiMu3NSKvb0r58yxlyd4j3w1mq41h_Bx_fN1XsyoW67pGNnwmF7VUpkSw0bfNItnWN9P8ov5ixl8YDWVdC_F4zk15ssb2Po=s320&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/h4&gt;&lt;br /&gt;&lt;p style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 10px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;br /&gt;&lt;span class=&quot;confluence-embedded-file-wrapper image-left-wrapper confluence-embedded-manual-size&quot; style=&quot;display: inline-block; float: left; margin: 0px 10px 10px 0px; max-width: none; position: relative;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 10px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 10px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 10px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 10px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;/p&gt;&lt;p style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 10px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 10px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;/p&gt;&lt;ul style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; list-style-type: disc; margin: 10px 0px 0px; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;li&gt;You can enable auditing either at the server level or at the database level. For this article we would go ahead and enable it at the database level. So, go to your Azure SQL database instance, select&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;Auditing&lt;/b&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;from the left pane under Security and enable auditing. &lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 10px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjkjQD0JL-QIrcWeJDj4GOLxXKYzL9bHfyWLJQNe1CV_A1nMoEvUYKjNoQwmjs8hJN8BYBZBCAuKHPU4-XIsTC4kBEZTN2sRVt15OI1P5oWVY4N_tXJOWpqp73ifP4XBAzZkM9NFgQTteMzdsa-WFyodrwekMHxi2KHLmQX5E6kLlm1KLm7o-suE7MI=s893&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;592&quot; data-original-width=&quot;893&quot; height=&quot;424&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjkjQD0JL-QIrcWeJDj4GOLxXKYzL9bHfyWLJQNe1CV_A1nMoEvUYKjNoQwmjs8hJN8BYBZBCAuKHPU4-XIsTC4kBEZTN2sRVt15OI1P5oWVY4N_tXJOWpqp73ifP4XBAzZkM9NFgQTteMzdsa-WFyodrwekMHxi2KHLmQX5E6kLlm1KLm7o-suE7MI=w640-h424&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 10px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;/p&gt;&lt;ul style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; list-style-type: disc; margin: 10px 0px 0px; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;li&gt;We are going to use&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;Event Hub&lt;/b&gt;&amp;nbsp;for this article to stream all telemetry data from Azure SQL. So, go ahead and select that option and provide the required details.&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;i&gt;Make sure you have created your Event Hub resource and namespace beforehand in the same region where your Azure SQL service is running&lt;/i&gt;. Hit Save.&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 10px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;This will go ahead and add a new log category named &quot;&lt;b&gt;SQLSecurityAuditEvents&lt;/b&gt;&quot; in the Azure SQL Diagnostic setting. This is the LIVE telemetry information you need to capture for all your SQL compliance and security audits. For example&lt;/p&gt;&lt;ol style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; list-style-type: decimal; margin: 10px 0px 0px; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;li&gt;What are all SQL statements getting executed and on which database, from which IP address those request came and at what datetime, how many rows got affected and much more.....&lt;/li&gt;&lt;li&gt;Successful logins&amp;nbsp;&lt;/li&gt;&lt;li&gt;Failed logins&lt;/li&gt;&lt;/ol&gt;&lt;p style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 10px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEg2QZA9znMo5yx1fTxOuPSamcACB7Owa9WSlGNvJlC1IHqm_rwQ4Nf3S_E90jhg4foOG-jFvIvlq_UIi9Sk5rNvGFBVbtf3NwCqgQmP3t2ZkyDPuiVPUDA203JtaMLBKXsK7iH9Z8HFLVZWYnU7lLK7onGa3F2P9te2FBQsGo0NPh3UGXBB43IQrKbc=s699&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;699&quot; data-original-width=&quot;676&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEg2QZA9znMo5yx1fTxOuPSamcACB7Owa9WSlGNvJlC1IHqm_rwQ4Nf3S_E90jhg4foOG-jFvIvlq_UIi9Sk5rNvGFBVbtf3NwCqgQmP3t2ZkyDPuiVPUDA203JtaMLBKXsK7iH9Z8HFLVZWYnU7lLK7onGa3F2P9te2FBQsGo0NPh3UGXBB43IQrKbc=w386-h400&quot; width=&quot;386&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&amp;nbsp;&lt;span style=&quot;letter-spacing: 0px;&quot;&gt;That&#39;s it.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;letter-spacing: 0px;&quot;&gt;You are done with the required configuration.&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 10px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;letter-spacing: 0px;&quot;&gt;Now lets run few SQL queries to generate some audit logs. I have used Azure Data Studio to connect and run the queries on my database but you can use any tool of your choice. Make sure you have whitelisted your IP to satisfy the firewall rules.&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 10px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;letter-spacing: 0px;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjHLwykrIvNwswnSLW2aPKWknsb-EdYFfS2zf5IVNyHAujQ_ST55uzkENcYysRCPAfwZEB3MsD8mlacqEawb1PubhaGFSb4tLIGbplmV2aJE03llIz8ANmg6t91ACugPoGNvKDBDJKxXZWVnGNgvWxiSJw2nS9W4mzFwyLgYgxhtyYC7nbZbWDwcTVo=s1560&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;828&quot; data-original-width=&quot;1560&quot; height=&quot;341&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjHLwykrIvNwswnSLW2aPKWknsb-EdYFfS2zf5IVNyHAujQ_ST55uzkENcYysRCPAfwZEB3MsD8mlacqEawb1PubhaGFSb4tLIGbplmV2aJE03llIz8ANmg6t91ACugPoGNvKDBDJKxXZWVnGNgvWxiSJw2nS9W4mzFwyLgYgxhtyYC7nbZbWDwcTVo=w640-h341&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class=&quot;confluence-embedded-file-wrapper&quot; style=&quot;display: inline-block; max-width: 100%; position: relative;&quot;&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;ul style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; list-style-type: disc; margin: 10px 0px 0px; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;li&gt;&lt;span style=&quot;letter-spacing: 0px;&quot;&gt;Now there&#39;s no way you can view the logs by directly going into your Event Hub. So, inorder to view the logs we will take help of Azure Service Bus Explorer desktop application. So, open the explorer, connect to your event hub and fire up a listener to witness live feed the logs.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 10px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEi7mAu1wvAdxr6H5mnA8O92-lqlTH4XsfvgCLpSYY9TrxJLi8_3gzK-NdwrHijNzt5PktMoRakBnDVbvgARzGTE6lHz8XNJKbNCTi4Mx2u06pgXbL83uGjO5Ls5XuBqztlIFb1NOhNR9h0oQ1RO40yYvIpQpJZD1wU17fX92pOgrua2cVHBx846lQzr=s1318&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;759&quot; data-original-width=&quot;1318&quot; height=&quot;368&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEi7mAu1wvAdxr6H5mnA8O92-lqlTH4XsfvgCLpSYY9TrxJLi8_3gzK-NdwrHijNzt5PktMoRakBnDVbvgARzGTE6lHz8XNJKbNCTi4Mx2u06pgXbL83uGjO5Ls5XuBqztlIFb1NOhNR9h0oQ1RO40yYvIpQpJZD1wU17fX92pOgrua2cVHBx846lQzr=w640-h368&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class=&quot;confluence-embedded-file-wrapper confluence-embedded-manual-size&quot; style=&quot;display: inline-block; max-width: none; position: relative;&quot;&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;ul style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; list-style-type: disc; margin: 10px 0px 0px; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;li&gt;Browse through the events and select one as per your requirement. Copy the EventText and view it in any JSON Format Viewer.&amp;nbsp; Your query and many other valuable information will show up in the logs.&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 10px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiIx7e0GJ-qTrHIlKwhVHixB0TdSJYtdwSAVBY5OxQ2ND9R7ajvFhO31z2VRJUr4KEdY5QRAQZjtoC6_OTZEKFM6CCzAIqW1sc55Enytyecyxb5dxgAvTZX26B049sulXNI05W7yknC_jqFU7dewD03_PbU4MuwFzC-2nF65kQJUNw6Sgp4Kz-UfhPb=s1418&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;649&quot; data-original-width=&quot;1418&quot; height=&quot;292&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiIx7e0GJ-qTrHIlKwhVHixB0TdSJYtdwSAVBY5OxQ2ND9R7ajvFhO31z2VRJUr4KEdY5QRAQZjtoC6_OTZEKFM6CCzAIqW1sc55Enytyecyxb5dxgAvTZX26B049sulXNI05W7yknC_jqFU7dewD03_PbU4MuwFzC-2nF65kQJUNw6Sgp4Kz-UfhPb=w640-h292&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjJkTYut6IweEVW2pnJbpKS38jDFTADDaXH8Fp8UfBnvElKmvaTRI2BOeLXKwiwXol0ZPZfyC1NQwq9HP6EL8tUpi9B8M8J25X1YSEVKOYE642qw26Q7WE0jgYKTszbuD7AZP635vDyxIomfcUE72fEftpzsHAbUOyzYGMRAhDr3NXlBaB5rW8fakaP=s1163&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;535&quot; data-original-width=&quot;1163&quot; height=&quot;294&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjJkTYut6IweEVW2pnJbpKS38jDFTADDaXH8Fp8UfBnvElKmvaTRI2BOeLXKwiwXol0ZPZfyC1NQwq9HP6EL8tUpi9B8M8J25X1YSEVKOYE642qw26Q7WE0jgYKTszbuD7AZP635vDyxIomfcUE72fEftpzsHAbUOyzYGMRAhDr3NXlBaB5rW8fakaP=w640-h294&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;ul style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; list-style-type: disc; margin: 10px 0px 0px; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;li&gt;&lt;span style=&quot;letter-spacing: 0px;&quot;&gt;Stop the Listener when done.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; margin: 10px 0px 0px; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;color: #993300;&quot;&gt;&lt;span style=&quot;letter-spacing: 0px;&quot;&gt;In real time scenario you won&#39;t be using Service Bus Explorer to view and monitor live events. There will be some Big Data analytic service sitting at the other side of Event Hub which will do all the big data processing, monitoring and reporting on the Event Hub logs data.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #172b4d; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Oxygen, Ubuntu, &amp;quot;Fira Sans&amp;quot;, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 14px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 10px 0px 0px; orphans: 2; padding: 0px; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;letter-spacing: 0px;&quot;&gt;Hope this article will give you an understand on how to log and monitor telemetry data from Azure SQL.&amp;nbsp; &lt;/span&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://techiemate.blogspot.com/feeds/434719320556565373/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techiemate.blogspot.com/2022/02/azure-sql-diagnostics-event-hub.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/434719320556565373'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/434719320556565373'/><link rel='alternate' type='text/html' href='http://techiemate.blogspot.com/2022/02/azure-sql-diagnostics-event-hub.html' title='Azure SQL Diagnostics &amp; Event Hub'/><author><name>Atanu Gupta</name><uri>http://www.blogger.com/profile/05529718294081550882</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_LZ_SzyDY_u8HW4LiUYlsEJKSSMR5zYs-ow0dK7kjPtYVYnB_nHhGXM3Ad8Gt9AxMhbi0UO3mSjuYBQq2Sli5kUe05z21o-xTJYAM-Pw6TErhMe4ITlrqdadJSCp_xYQS1rf5k8diG7IlmVmai1fllCvN7o9A8b0JSaV5Gn6SCwv5zw/s220/1714907742840.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEibV-Q3uzzxHJ1cOCoGE4Lo5IrPi7qxSRyRl_6bfVY0KkD7YhXJDU0HnVofUAfbvTGerYcr-W8EedQEAEOaF2M1PMMHcsiMu3NSKvb0r58yxlyd4j3w1mq41h_Bx_fN1XsyoW67pGNnwmF7VUpkSw0bfNItnWN9P8ov5ixl8YDWVdC_F4zk15ssb2Po=s72-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6011381329995167460.post-7907728137209156269</id><published>2021-07-14T14:46:00.008+05:30</published><updated>2021-07-16T16:08:55.152+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term=".Net"/><category scheme="http://www.blogger.com/atom/ns#" term="AKS"/><category scheme="http://www.blogger.com/atom/ns#" term="App Services"/><category scheme="http://www.blogger.com/atom/ns#" term="Arc"/><category scheme="http://www.blogger.com/atom/ns#" term="Azure"/><category scheme="http://www.blogger.com/atom/ns#" term="Azure Arc"/><category scheme="http://www.blogger.com/atom/ns#" term="Container"/><category scheme="http://www.blogger.com/atom/ns#" term="Docker"/><category scheme="http://www.blogger.com/atom/ns#" term="GitOps"/><category scheme="http://www.blogger.com/atom/ns#" term="K8s"/><category scheme="http://www.blogger.com/atom/ns#" term="Kubernetes"/><category scheme="http://www.blogger.com/atom/ns#" term="PaaS"/><category scheme="http://www.blogger.com/atom/ns#" term="Web App"/><title type='text'>3. Azure Arc : Running Azure App Service in Azure Arc Enabled K8s</title><content type='html'>&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglyb4ZNGIy_Y-PzbemViPcqoxA6OGRYBgrHdawzYNbzKc7SAXEEifrS_MMwtdAgEx4GHMEV8tbDoWZJx8GefJ3fbkTWL2848eTYyoMcS5SKDBB7eln0hBQAkf0fBqvs2PiK2aloHi9368/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;126&quot; data-original-width=&quot;512&quot; height=&quot;158&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglyb4ZNGIy_Y-PzbemViPcqoxA6OGRYBgrHdawzYNbzKc7SAXEEifrS_MMwtdAgEx4GHMEV8tbDoWZJx8GefJ3fbkTWL2848eTYyoMcS5SKDBB7eln0hBQAkf0fBqvs2PiK2aloHi9368/w640-h158/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;span style=&quot;text-align: left;&quot;&gt;In the first article of my Azure Azc series; we have successfully onboarded an Azure Kubernetes Service (AKS) cluster into Azure Arc enabled Kubernetes. If you haven&#39;t followed that yet, I highly recommend you to visit that article first and configure your clusters if you want to follow along.&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://techiemate.blogspot.com/2021/07/kubernetes-azure-arc.html&quot; target=&quot;_blank&quot;&gt;1. Azure Arc : Setting up &#39;Kubernetes - Azure Arc&#39; with AKS cluster&lt;/a&gt;&lt;/p&gt;&lt;p&gt;In this article we would run an Azure App Service - Web App inside our Azure Arc for Kubernetes cluster.&amp;nbsp;&lt;/p&gt;&lt;p&gt;Hang on! Just read the above statement again. Azure Arc is meant for hybrid, multi-cloud capability and running an application on that doesn&#39;t mean that we can run it on any cloud behind the scene? Yes, your are right 😊, your Azure App Service can now run anywhere; hardly matters its on-premise or on any other cloud provider&#39;s platform. Sounds Interesting! Let&#39;s dive.&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Lets go inside the resource group 
(arc-rg-01 in my case) where we have both our Kubernetes service cluster
 and the Kubernetes - Azure Arc cluster.&lt;/li&gt;&lt;div style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFZfUUCabWquZ_R-9SfLEdoTJUWNcFM2z5W3v8h0qxAYgjZ9ydbNIOIH551hOhLw1dmR3HG9gRqjJx2jZYVs2CWnTghWgHMCnxvP8ntI-MnGU-CajXd-J_0y8lr_wXqC2HBDqoQipfmSU/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;175&quot; data-original-width=&quot;1282&quot; height=&quot;88&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFZfUUCabWquZ_R-9SfLEdoTJUWNcFM2z5W3v8h0qxAYgjZ9ydbNIOIH551hOhLw1dmR3HG9gRqjJx2jZYVs2CWnTghWgHMCnxvP8ntI-MnGU-CajXd-J_0y8lr_wXqC2HBDqoQipfmSU/w640-h88/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;li&gt;We would need a public static IP address to configure our app service which we would see shortly. So, for now just go ahead and create a public ip address in the your managed cluster (MC_) resource group (because I am running my AKS cluster in Azure) before moving forward. I gave the name as &quot;my-webapp-arc-pip&quot; leaving all other setting as default.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfLIkySYRLr5RjMez3zi1p8ItAFzSL_ESqKmGEGxTyYhzfFGyglgoZ250shcjn2C6aFcCTWu3-KeEWTcAkP5Ob0w6H2SLMQz-C7ziBbAHW0bur6kP6BncHTZAROyHtiIWpT4vstJrIZ3s/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;465&quot; data-original-width=&quot;430&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfLIkySYRLr5RjMez3zi1p8ItAFzSL_ESqKmGEGxTyYhzfFGyglgoZ250shcjn2C6aFcCTWu3-KeEWTcAkP5Ob0w6H2SLMQz-C7ziBbAHW0bur6kP6BncHTZAROyHtiIWpT4vstJrIZ3s/w370-h400/image.png&quot; width=&quot;370&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Once done... copy the IP address and keep it in notepad.&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbXgEXlFtiZGJ5auybSQl0x9X6Vb7zp-gRKDI_TxB6HBNuQcQQ7ezZWQ9zP22lRBQoQcHCDeQc-ZmPErun9LgyidcbuTxpAO4WpI4YoKKN-vSO-sc78xIpyYCNGazwcucUVsYQxQg9olo/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;261&quot; data-original-width=&quot;1431&quot; height=&quot;116&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbXgEXlFtiZGJ5auybSQl0x9X6Vb7zp-gRKDI_TxB6HBNuQcQQ7ezZWQ9zP22lRBQoQcHCDeQc-ZmPErun9LgyidcbuTxpAO4WpI4YoKKN-vSO-sc78xIpyYCNGazwcucUVsYQxQg9olo/w640-h116/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Search for &quot;Azure Arc&quot; in the search bar (azure portal) and select it from the result&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiD6WnqmFFOryeFM8I5S4U1vq-3_ESXkdZjUhUjwnJk1bdOSdHpUPUi9Eox_ipvT-gaA8IS8L-AucrCu080d9E-Tl0YCcrCQpmxMOAk_8flJe3J5XBZsurQlbHHhFbMCHd68tIz2e5tuug/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;344&quot; data-original-width=&quot;964&quot; height=&quot;229&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiD6WnqmFFOryeFM8I5S4U1vq-3_ESXkdZjUhUjwnJk1bdOSdHpUPUi9Eox_ipvT-gaA8IS8L-AucrCu080d9E-Tl0YCcrCQpmxMOAk_8flJe3J5XBZsurQlbHHhFbMCHd68tIz2e5tuug/w640-h229/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Choose &#39;Kubernetes clusters&#39; under Infrastructure to find your Azure Arc for K8s cluster.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXyQcja_6JLclFm5Gvjf8JioG4p4-1SOTjX6estjrgfcu2LN0hkAPDaFz9CAQdf2PxRJc2vNRR3ZrniQ3uBzenmE-bR95s2hExvJ1HIyXIENGYFVLzCHH53bPNBM2KS3bWrpkuZ7yoK2w/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;525&quot; data-original-width=&quot;1000&quot; height=&quot;336&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXyQcja_6JLclFm5Gvjf8JioG4p4-1SOTjX6estjrgfcu2LN0hkAPDaFz9CAQdf2PxRJc2vNRR3ZrniQ3uBzenmE-bR95s2hExvJ1HIyXIENGYFVLzCHH53bPNBM2KS3bWrpkuZ7yoK2w/w640-h336/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Click on that, choose &quot;Extensions (preview)&quot; and then click +Add. The extension is in preview at the time of writing this article but its works perfectly. So, go ahead.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvtBL67-Bf_eTPgZZHzpTO0PBLXyqXhKnbI0Vyphn731_qAgTUh-HGVmHSmXBaHypW-W2vxeYhclWPQis4jvvG2tcRIkNVhFTqo7h0TiNFrdJYy9yKtCyam6XmR6525Gf7UB8Xvikp-Mg/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;520&quot; data-original-width=&quot;1339&quot; height=&quot;248&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvtBL67-Bf_eTPgZZHzpTO0PBLXyqXhKnbI0Vyphn731_qAgTUh-HGVmHSmXBaHypW-W2vxeYhclWPQis4jvvG2tcRIkNVhFTqo7h0TiNFrdJYy9yKtCyam6XmR6525Gf7UB8Xvikp-Mg/w640-h248/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Select &quot;Application services extension (Preview)&quot;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZRmMz1-OZHbJ2uwFxtu41E_X_bgVYjmoZ1bNsGDJARKTV5Lg3uu-0rhUV-0gPJi426UGLrGHkPkeIi2ZBqJgzGpOENdihBrhhjTDdZ0wsoaoAVydIlRMHRJUxTqYxNz5SMVvZd6BmsiY/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;450&quot; data-original-width=&quot;525&quot; height=&quot;343&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZRmMz1-OZHbJ2uwFxtu41E_X_bgVYjmoZ1bNsGDJARKTV5Lg3uu-0rhUV-0gPJi426UGLrGHkPkeIi2ZBqJgzGpOENdihBrhhjTDdZ0wsoaoAVydIlRMHRJUxTqYxNz5SMVvZd6BmsiY/w400-h343/image.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Give your instance name, create a custom location and put the public ip address (copied to your notepad) in the static ip textbox. This custom location will show up in your azure region list once we configure the web app. This is again a magic which we will see shortly 😊&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiK5kTj5oy9tNLNAisrtSddT1ffAk4ihcKgV_fqsY1fyJTnH2krmeFLyqlRJ3v1Wm2nn4t-YRajdDVS0Ycx5hhiHKkmqaEiOnWSSmCKI79kzO2EK1S8XgzU9gHoPWlsDXUEpF8kMOkHtMU/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;1216&quot; data-original-width=&quot;876&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiK5kTj5oy9tNLNAisrtSddT1ffAk4ihcKgV_fqsY1fyJTnH2krmeFLyqlRJ3v1Wm2nn4t-YRajdDVS0Ycx5hhiHKkmqaEiOnWSSmCKI79kzO2EK1S8XgzU9gHoPWlsDXUEpF8kMOkHtMU/w461-h640/image.png&quot; width=&quot;461&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Click Next, Next and at the &quot;Run Script&quot; section, it will automatically generate the required PowerShell script which you need to download or copy to clipboard so that you can run it using any powershell platform.&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLdhecU-QTHgOPG9cT8Gam_JLgobWOT_DLdAiiWVqR8maHOU_nKzqmXx5x__2M5u6nVcqE7ZUu20Wo0ZvQrQdez2Bx5DJlexHQgYI3Dc9WCnlbl_O3-V_rKRDp5OD5ghVVzCuYGtpNFug/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;563&quot; data-original-width=&quot;876&quot; height=&quot;412&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLdhecU-QTHgOPG9cT8Gam_JLgobWOT_DLdAiiWVqR8maHOU_nKzqmXx5x__2M5u6nVcqE7ZUu20Wo0ZvQrQdez2Bx5DJlexHQgYI3Dc9WCnlbl_O3-V_rKRDp5OD5ghVVzCuYGtpNFug/w640-h412/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;I just copied it to clipboard &lt;b&gt;but don&#39;t run it straightway.&lt;/b&gt; We need to enable the custom-location feature for our k8s cluster (do not confuse this with arc cluster). This is a very important step often get missed; else the generated powershell script would fail throwing permission denied error. So, let&#39;s go ahead and run the below script. Replace the values as per your environment.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: &amp;quot;Andale Mono&amp;quot;, &amp;quot;Lucida Console&amp;quot;, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; text-align: left; width: 100%;&quot;&gt;&lt;code&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;az extension add &lt;/span&gt;&lt;span class=&quot;hljs-parameter&quot;&gt;--name&lt;/span&gt; customlocation&lt;/code&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: &amp;quot;Andale Mono&amp;quot;, &amp;quot;Lucida Console&amp;quot;, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; text-align: left; width: 100%;&quot;&gt;&lt;code&gt;az connectedk8s enable-features -n &quot;&amp;lt;cluster-name&quot; -g &quot;&amp;lt;resource group&amp;gt;&quot; --features cluster-connect custom-locations
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnf5I054wW3R-7ASQ9At_qnKuO_zhVlDwmlHqZ7HPO4BNkhTRfUhqrNFinoCoKVXlRrA9vpmB2977ETXWJSkx9uGaT3eWcjqHRyn63mLNDCss5-ZVUlZ7kvQ3nb5L5AeuGHQYWCgrehw8/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;151&quot; data-original-width=&quot;1478&quot; height=&quot;66&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnf5I054wW3R-7ASQ9At_qnKuO_zhVlDwmlHqZ7HPO4BNkhTRfUhqrNFinoCoKVXlRrA9vpmB2977ETXWJSkx9uGaT3eWcjqHRyn63mLNDCss5-ZVUlZ7kvQ3nb5L5AeuGHQYWCgrehw8/w640-h66/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Now run the generated PowerShell script.&amp;nbsp; I ran it using PowerShell ISE editor but you are free to use any of your choice. The script would take a while to finish, so go grab your favorite beverage and relax. I already took mine 🍺&lt;/li&gt;&lt;li&gt;On successful completion of the script, you will see the &quot;&lt;span data-bind=&quot;text: value&quot;&gt;microsoft.web.appservice&quot;&amp;nbsp;&lt;/span&gt;extension has been installed successfully in your cluster.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHd2AcM0zvOFMKGA1uh8TbjJjBAW2jll85aSGG4TAinj-GupfX-k6-vwKpMbbhvqo4tT07wYXvasEgXy4MadTzSsEClZQrGdUu4l4TG0LcNAxv-wdm0BBQh2PAqXrX-JQ9_JRSsj95aoM/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;524&quot; data-original-width=&quot;1709&quot; height=&quot;196&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHd2AcM0zvOFMKGA1uh8TbjJjBAW2jll85aSGG4TAinj-GupfX-k6-vwKpMbbhvqo4tT07wYXvasEgXy4MadTzSsEClZQrGdUu4l4TG0LcNAxv-wdm0BBQh2PAqXrX-JQ9_JRSsj95aoM/w640-h196/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Now check the Custom locations under Management to find that the custom location has also been created successfully.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1ykI2HyqK6NjKf9Qs9rq32_-HUlf4JHNglg9ROn3gsiNspwhYCicB5i-rCZoa7cFAefgVgCjBiKxHEie9R1I4OZmZeFqXB_DjTCE6C56ZY5_tw06BOhWbT0L55axgfxDxscq532bV_VM/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;508&quot; data-original-width=&quot;1137&quot; height=&quot;286&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1ykI2HyqK6NjKf9Qs9rq32_-HUlf4JHNglg9ROn3gsiNspwhYCicB5i-rCZoa7cFAefgVgCjBiKxHEie9R1I4OZmZeFqXB_DjTCE6C56ZY5_tw06BOhWbT0L55axgfxDxscq532bV_VM/w640-h286/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;Great! now we are all set to create a app service (web app) and run in on out K8s Arc cluster. So, lets get going😉&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Click &quot;App services&quot; under Services and click to create a new web app&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhY7A7JoITedX1awjVfPhN5LXw8eqEPDJKk7ktKJXQ3bwpimEv2BNTevn0Zl6-qBvPQ8Orf8RcFIoJDnGDgklu_PYCdEySNqx0MlU46RSk1OucOJ8uH5reDErjKXPCgqJzZuy0LYOE8a68/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;709&quot; data-original-width=&quot;731&quot; height=&quot;622&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhY7A7JoITedX1awjVfPhN5LXw8eqEPDJKk7ktKJXQ3bwpimEv2BNTevn0Zl6-qBvPQ8Orf8RcFIoJDnGDgklu_PYCdEySNqx0MlU46RSk1OucOJ8uH5reDErjKXPCgqJzZuy0LYOE8a68/w640-h622/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Now in the next screen before doing anything, click the region dropdown. Voila! our new custom region shows up. Yeah! its right there.... amazing. Select that.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivQCohWa-5dPK2j08Kp0IMnN4cKdvMMazgQ8WDxp4tzHiXa1HLsP7gqnHu-H12_Wv1yic5tFykYZBkua3JrLnxeFUd-e397JClI7mz9c4fZ2jrgE0tAJccqcqmjo1f5eYju4vha1BvOp8/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;581&quot; data-original-width=&quot;909&quot; height=&quot;410&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivQCohWa-5dPK2j08Kp0IMnN4cKdvMMazgQ8WDxp4tzHiXa1HLsP7gqnHu-H12_Wv1yic5tFykYZBkua3JrLnxeFUd-e397JClI7mz9c4fZ2jrgE0tAJccqcqmjo1f5eYju4vha1BvOp8/w640-h410/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Fill up other details as required. You might have also noticed by this time that url has also changed on change of custom location as a region. This is enough to tell us that this not an ordinary azure app service which we use to create. I have selected the runtime stack as .Net core&amp;nbsp; but you are free to choose any of your choice. Review and create.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibxf_IPhBzMUfZtb5izDO3LguIyKLh8IJfi9zMSrxPVhsriX2DaLj4odX5v7n8MIUr5_yZyW4aZJkaya9hDibOibc_xXe9B6D03dCZ2HDvchiEpg3ZVgTLqo_4-u2gtU2FNtXFsATbMKo/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;661&quot; data-original-width=&quot;915&quot; height=&quot;462&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibxf_IPhBzMUfZtb5izDO3LguIyKLh8IJfi9zMSrxPVhsriX2DaLj4odX5v7n8MIUr5_yZyW4aZJkaya9hDibOibc_xXe9B6D03dCZ2HDvchiEpg3ZVgTLqo_4-u2gtU2FNtXFsATbMKo/w640-h462/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Once complete, check the &quot;App services&quot; under Services to find our service.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiN2WZh3PxAZ9PbSPNdL1T2vJujh9wJ89j2jZQX_NCHNWk8Wr5AcWYhxrckVtMtCJw5x9HqA8xW2ATTi-i3XHz67S8izAYPSaX0vuzTEL_XrQkSMCYmnzV2q9M2veakJu5H_cto5HEJnVc/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;602&quot; data-original-width=&quot;1368&quot; height=&quot;282&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiN2WZh3PxAZ9PbSPNdL1T2vJujh9wJ89j2jZQX_NCHNWk8Wr5AcWYhxrckVtMtCJw5x9HqA8xW2ATTi-i3XHz67S8izAYPSaX0vuzTEL_XrQkSMCYmnzV2q9M2veakJu5H_cto5HEJnVc/w640-h282/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Click on that and get the URL. Run it!&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhI8pMaBftpPjUXeOTQVq0U2R8QeqggPYjcnbhXwmgmQyMoj_oQ2uEyTV8_EX3pYf24OxCJhys6VHkx3benOetl20PDwCz9hWf52dgb12t8vA56vYrBJdHkXZvPBZIjkigbnJMOzVH_30U/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;268&quot; data-original-width=&quot;1774&quot; height=&quot;96&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhI8pMaBftpPjUXeOTQVq0U2R8QeqggPYjcnbhXwmgmQyMoj_oQ2uEyTV8_EX3pYf24OxCJhys6VHkx3benOetl20PDwCz9hWf52dgb12t8vA56vYrBJdHkXZvPBZIjkigbnJMOzVH_30U/w640-h96/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLgiDQ8_4h16igGGe7ihbbraAyRf4v3gbeK2qERqpTyF9QXOcYpFFlQ_LY_txVezrvMS2vO2y8eC_FF0aRob7EWATd2AhEq67TrJ4JzWd_S6HJhbf74V9z8xYiZfSVklI6-z92eT7KBDw/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;780&quot; data-original-width=&quot;1608&quot; height=&quot;310&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLgiDQ8_4h16igGGe7ihbbraAyRf4v3gbeK2qERqpTyF9QXOcYpFFlQ_LY_txVezrvMS2vO2y8eC_FF0aRob7EWATd2AhEq67TrJ4JzWd_S6HJhbf74V9z8xYiZfSVklI6-z92eT7KBDw/w640-h310/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;A big virtual High Five!!!! We have done it!.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now our Azure app service is running on Azure Arc for K8s cluster and the underlying cluster can be anywhere.. on-premise, any cloud provider&#39;s platform, wherever... We just do not mind 😋&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;We can keep deploying our code to this app service manually, from VS or by DevOps pipeline and let Azure do all the heavy lifting to host that in a multi cloud platform.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;color: orange;&quot;&gt;Congratulations&lt;/span&gt;&lt;/b&gt;! for coming this far. Hope this article will help you to further explore more on this topic.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Do share with me about your experience and what you have built upon this
 foundation. You can take it upto any level and integrate. I would love 
to hear from you.&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techiemate.blogspot.com/feeds/7907728137209156269/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techiemate.blogspot.com/2021/07/3-azure-arc-running-azure-app-service.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/7907728137209156269'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/7907728137209156269'/><link rel='alternate' type='text/html' href='http://techiemate.blogspot.com/2021/07/3-azure-arc-running-azure-app-service.html' title='3. Azure Arc : Running Azure App Service in Azure Arc Enabled K8s'/><author><name>Atanu Gupta</name><uri>http://www.blogger.com/profile/05529718294081550882</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_LZ_SzyDY_u8HW4LiUYlsEJKSSMR5zYs-ow0dK7kjPtYVYnB_nHhGXM3Ad8Gt9AxMhbi0UO3mSjuYBQq2Sli5kUe05z21o-xTJYAM-Pw6TErhMe4ITlrqdadJSCp_xYQS1rf5k8diG7IlmVmai1fllCvN7o9A8b0JSaV5Gn6SCwv5zw/s220/1714907742840.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglyb4ZNGIy_Y-PzbemViPcqoxA6OGRYBgrHdawzYNbzKc7SAXEEifrS_MMwtdAgEx4GHMEV8tbDoWZJx8GefJ3fbkTWL2848eTYyoMcS5SKDBB7eln0hBQAkf0fBqvs2PiK2aloHi9368/s72-w640-h158-c/image.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6011381329995167460.post-7768448821589244528</id><published>2021-07-07T12:03:00.036+05:30</published><updated>2021-07-16T10:34:15.304+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term=".Net"/><category scheme="http://www.blogger.com/atom/ns#" term="AKS"/><category scheme="http://www.blogger.com/atom/ns#" term="Arc"/><category scheme="http://www.blogger.com/atom/ns#" term="Azure"/><category scheme="http://www.blogger.com/atom/ns#" term="Azure Arc"/><category scheme="http://www.blogger.com/atom/ns#" term="Container"/><category scheme="http://www.blogger.com/atom/ns#" term="Docker"/><category scheme="http://www.blogger.com/atom/ns#" term="GitOps"/><category scheme="http://www.blogger.com/atom/ns#" term="K8s"/><category scheme="http://www.blogger.com/atom/ns#" term="Kubernetes"/><category scheme="http://www.blogger.com/atom/ns#" term="PaaS"/><category scheme="http://www.blogger.com/atom/ns#" term="Web App"/><title type='text'>2. Azure Arc : Deploying .Net Core App into Azure Arc enabled K8s with Git Ops</title><content type='html'>&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVkYwZCtyZ-Hns-UtIEo75mHawhgTQKka6GEk8dF7RoM9P8axf6boVKUEUUx1Yc758Z0xdO3wR4ZbG4oBFmmRpSugC2qBwA-9BndfK5bs7rtqg6-OugK59T5hyIYpu35ZvcpHIIfrTTr0/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;435&quot; data-original-width=&quot;1767&quot; height=&quot;158&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVkYwZCtyZ-Hns-UtIEo75mHawhgTQKka6GEk8dF7RoM9P8axf6boVKUEUUx1Yc758Z0xdO3wR4ZbG4oBFmmRpSugC2qBwA-9BndfK5bs7rtqg6-OugK59T5hyIYpu35ZvcpHIIfrTTr0/w640-h158/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;In the first article of my Azure Azc series we have successfully onboarded an Azure Kubernetes Service (AKS) cluster into Azure Arc enabled Kubernetes. If you haven&#39;t followed that yet, then I highly recommend to visit that article first as we will continue to build on that cluster.&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://techiemate.blogspot.com/2021/07/kubernetes-azure-arc.html&quot; target=&quot;_blank&quot;&gt;1. Azure Arc : Setting up &#39;Kubernetes - Azure Arc&#39; with AKS cluster&lt;/a&gt;&lt;/p&gt;&lt;p&gt;We will also make use of Git Repository and Docker Hub registry. For this article, I will be using my public repo and hub but you are free to use yours.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;a href=&quot;https://github.com/PassHours/Hello-AzureArc&quot; target=&quot;_blank&quot;&gt;PassHours/Hello-AzureArc&lt;/a&gt;&amp;nbsp;(git repo)&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://hub.docker.com/repository/docker/atanudochub/helloazurearc&quot; target=&quot;_blank&quot;&gt;atanudochub/helloazurearc&lt;/a&gt;&amp;nbsp;(docker hub registry/image)&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div&gt;I have already developed a sample .Net core web app and uploaded it in my git repository. It&#39;s a very basic web app to display a welcome screen &quot;Welcome to Azure Arc&quot; but you got the idea 😊&lt;/div&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjl_fBMwYJkkQTxITcRo11wMMlDomwK4GWBuJWaktPy59PcAAuOsvXBSQ2DuCG-ugObH7wOu6khiUQxqP4kMQjkOPErfXWJyMxE_BR-my8brd29hpfP_pluw6W5LPh6I1aR5Qv6PHU1fOE/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;813&quot; data-original-width=&quot;1319&quot; height=&quot;394&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjl_fBMwYJkkQTxITcRo11wMMlDomwK4GWBuJWaktPy59PcAAuOsvXBSQ2DuCG-ugObH7wOu6khiUQxqP4kMQjkOPErfXWJyMxE_BR-my8brd29hpfP_pluw6W5LPh6I1aR5Qv6PHU1fOE/w640-h394/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;span style=&quot;text-align: left;&quot;&gt;The application is containerized and the image has been uploaded in my docker hub registry.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRRGavYYJ6HXwKl6GpSQOM91opCW_R1E-7wugDvqLr20jn-FPKR0PFZhGXbMSQZZkbWRVkVrbNDaC6UcO8Vdny_03eJ6JRgG7OiRW2n6uCjMwwgT4pKWnHIXZpo3JdxsksuJo0F31zEWQ/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;321&quot; data-original-width=&quot;1873&quot; height=&quot;110&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRRGavYYJ6HXwKl6GpSQOM91opCW_R1E-7wugDvqLr20jn-FPKR0PFZhGXbMSQZZkbWRVkVrbNDaC6UcO8Vdny_03eJ6JRgG7OiRW2n6uCjMwwgT4pKWnHIXZpo3JdxsksuJo0F31zEWQ/w640-h110/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;So, the platform is all set for us to proceed.&lt;/div&gt;&lt;div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Lets go inside the resource group (arc-rg-01 in my case) where we have both our Kubernetes service cluster and the Kubernetes - Azure Arc cluster.&lt;/li&gt;&lt;/ul&gt;&lt;div style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZW6IG2pzrfSL5a-UcpAm2i1w9iONWEVXISqLNItINzKxTN1BEel0KJWQTocCaptdIZiVv7_Oqyq14qT4-fli9NicNk3HiHNrptgrS9xBjQsQvltHDIsSTwWhhjMfRzd4XWBwkw2xwmkM/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;172&quot; data-original-width=&quot;1009&quot; height=&quot;110&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZW6IG2pzrfSL5a-UcpAm2i1w9iONWEVXISqLNItINzKxTN1BEel0KJWQTocCaptdIZiVv7_Oqyq14qT4-fli9NicNk3HiHNrptgrS9xBjQsQvltHDIsSTwWhhjMfRzd4XWBwkw2xwmkM/w640-h110/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Get into the Kubernetes - Azure Arc cluster and click the &quot;GitOps&quot; option from the left menu. It will be empty as we have configured nothing yet.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjs1GbG1guiPfVUXBqM45cEPfJLQAWyT0cqXftTNDgaHhODc69JYtAtgdV6AtxZXWkw3tFTfUtK2qjH5d5vTfI0IeTQazOxA-sLb8GBGMx_c1QQcKPCpLj59Jotnmq2FUN7Kc1gaqwiCjw/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;514&quot; data-original-width=&quot;733&quot; height=&quot;448&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjs1GbG1guiPfVUXBqM45cEPfJLQAWyT0cqXftTNDgaHhODc69JYtAtgdV6AtxZXWkw3tFTfUtK2qjH5d5vTfI0IeTQazOxA-sLb8GBGMx_c1QQcKPCpLj59Jotnmq2FUN7Kc1gaqwiCjw/w640-h448/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Now the interesting part. We would like to deploy our &lt;b&gt;Hello-AzureArc &lt;/b&gt;containerized application into our AKS cluster through the Azure Arc for Kubernetes GitOps channel and you would be surprised to see that how easy it is. Microsoft has done a great job in simplifying things here by providing a single command 👉 &lt;i&gt;az k8sconfiguration create&lt;/i&gt;. All the heavy duty complex operations are taken care behind the scene for you.&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: &amp;quot;Andale Mono&amp;quot;, &amp;quot;Lucida Console&amp;quot;, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;az k8sconfiguration create \
  --name &amp;lt;&amp;lt;your choice&amp;gt;&amp;gt; \
  --cluster-name &amp;lt;&amp;lt;your cluster name&amp;gt;&amp;gt; \
  --resource-group &amp;lt;&amp;lt;your k8s cluster resource group&amp;gt;&amp;gt; \
  --operator-instance-name &amp;lt;&amp;lt;your choice&amp;gt;&amp;gt; \
  --operator-namespace &amp;lt;&amp;lt;your choice&amp;gt;&amp;gt; \
  --repository-url &amp;lt;&amp;lt;your git repo url&amp;gt;&amp;gt; \
  --scope cluster --cluster-type connectedClusters \
  --operator-params=&quot;--git-poll-interval 5s --git-readonly&quot;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;I have issued the following command in the cloud bash shell of Azure portal. You can also issue the exact same command if you are following along with me else replace the values accordingly. I have scoped the deployment to cluster level but you can also scope it to namespace level as well.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhC_ExE1TIsSjDdiiu9HYeVVr69NwGdaYRelVmNSWEpQmsKYurmRhIecfqC8znUKza5dSt85BAK81u4DmvcDuxQIWU71WJojg2iMpXu6YBYtG3Gwru2Tv9VhOBvnQ30NZkQtQCumIFFZw0/&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;209&quot; data-original-width=&quot;729&quot; height=&quot;184&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhC_ExE1TIsSjDdiiu9HYeVVr69NwGdaYRelVmNSWEpQmsKYurmRhIecfqC8znUKza5dSt85BAK81u4DmvcDuxQIWU71WJojg2iMpXu6YBYtG3Gwru2Tv9VhOBvnQ30NZkQtQCumIFFZw0/w640-h184/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The interesting part to note here in the command is the last line&amp;nbsp;&lt;i&gt;--operator-params.&lt;/i&gt;&amp;nbsp;This is the param where you are applying your gitops command. I am giving the command instruction here to poll my git repo (as mentioned in the --repository-url param) every 5 seconds (bit aggressive here for this demo but in real life it would be much higher value, may be every 30 mins), get all the changes and apply in my cluster. A typical continuous deployment scenario.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Upon completion, you will find the configuration (hello-arc in my case) showing up under the GitOps menu. The Operator state will show &quot;Pending&quot; first and then will turn to &quot;Installed&quot; after completion of the deployment process. So, have some patience here.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiUAVUpE51oES7ud54NCFmJ0xon89l0SrmiKGKlofqh7Yf0pHQGSiLfl6qHFQmORWCo9BPG-QUy3MN0aLr5i6hJ2KGTRubGdIhvBa02NFX9Ki2B4-80Y86jG_zSIPxdCf6vfLc954CN_M/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;505&quot; data-original-width=&quot;1480&quot; height=&quot;218&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiUAVUpE51oES7ud54NCFmJ0xon89l0SrmiKGKlofqh7Yf0pHQGSiLfl6qHFQmORWCo9BPG-QUy3MN0aLr5i6hJ2KGTRubGdIhvBa02NFX9Ki2B4-80Y86jG_zSIPxdCf6vfLc954CN_M/w640-h218/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;It signals done but we need to verify. Lets check our AKS cluster now in the following sequence in the Kubernetes resources section.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;👉 &lt;b&gt;Namespace&lt;/b&gt;. hello-arc is our namespace created successfully&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbn2BFs5Y8j_I6kvvTJewlXsuD1gnh8mSsBdHxKuhqfcWcC4MYU5YYyrvii8_PfzxWamoSCb2WRq3PqoF_O6Va4WmsH8-css67OcWgemaWJai0JpKQpNDidkJ_KS3bZoIHrz71sNtHdrE/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;547&quot; data-original-width=&quot;1145&quot; height=&quot;306&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbn2BFs5Y8j_I6kvvTJewlXsuD1gnh8mSsBdHxKuhqfcWcC4MYU5YYyrvii8_PfzxWamoSCb2WRq3PqoF_O6Va4WmsH8-css67OcWgemaWJai0JpKQpNDidkJ_KS3bZoIHrz71sNtHdrE/w640-h306/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;👉 &lt;b&gt;Workloads&lt;/b&gt;. Select the &quot;Pods&quot; tab and filter it by &quot;default&quot; namespace as we have not mapped it to any particular namespace and hence default. Three pods are up an running successfully.&lt;/div&gt;&lt;div&gt;Refer&amp;nbsp;&lt;a href=&quot;https://github.com/PassHours/Hello-AzureArc/blob/master/hello-azurearc.yml&quot; target=&quot;_blank&quot;&gt;hello-azurearc.yml&lt;/a&gt;&amp;nbsp;deployment yml in the git repo&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhM-sCqgTC3KrhcCIukyO_p6fnLMLvZ9nJrTK2WbafsjcbSwI9DoyqIRZmBMaKAiY5U7shVWR3ZIGc1gxPs2qDQTh-1MxLA2WxKyLXpntfyKpPYVIZzjCPfLhHabaDoPN1mo4BpCs6nzzY/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;548&quot; data-original-width=&quot;1652&quot; height=&quot;212&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhM-sCqgTC3KrhcCIukyO_p6fnLMLvZ9nJrTK2WbafsjcbSwI9DoyqIRZmBMaKAiY5U7shVWR3ZIGc1gxPs2qDQTh-1MxLA2WxKyLXpntfyKpPYVIZzjCPfLhHabaDoPN1mo4BpCs6nzzY/w640-h212/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;👉&amp;nbsp;&lt;b&gt;Services and ingresses&lt;/b&gt;. Our hello-arc-service is up and running having an external load balancer IP address.&lt;/div&gt;&lt;div&gt;Refer&amp;nbsp;&lt;a href=&quot;https://github.com/PassHours/Hello-AzureArc/blob/master/hello-azurearc.yml&quot; target=&quot;_blank&quot;&gt;hello-azurearc.yml&lt;/a&gt; deployment yml in the git repo&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiuZL2HBqN-arAKKKUvSIbr_gBfr93fFY-5xCyUz_7xcfzy_day4_IRAgiiut9mzRI49bcsRGbj7WrKGL0o0OfDGrOLScGJGWok0SAG9Ynp4-gLigcQKvyLJLiLvs8EjsgG9Mr7gHTvoMo/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;633&quot; data-original-width=&quot;1734&quot; height=&quot;234&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiuZL2HBqN-arAKKKUvSIbr_gBfr93fFY-5xCyUz_7xcfzy_day4_IRAgiiut9mzRI49bcsRGbj7WrKGL0o0OfDGrOLScGJGWok0SAG9Ynp4-gLigcQKvyLJLiLvs8EjsgG9Mr7gHTvoMo/w640-h234/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Click the External IP and voila! our app is running as expected. Auto magic isn&#39;t it 👼 We have just issued a single command and surprise!&lt;/li&gt;&lt;/ul&gt;&lt;div style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1MYtTU7TgbOK0ilbx6vg3Ct2sTd4I0ujE8W28ETFJyDI2Y7LJ6riCpAkTEzt6opipKZU-8QLhwEdN9xFlOvAR8m7Nh7RbxybER9ikzcxSjkYtPDnjH0Y6Z1nrd2QizDDLSJAxNrKf_f4/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;725&quot; data-original-width=&quot;1191&quot; height=&quot;390&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1MYtTU7TgbOK0ilbx6vg3Ct2sTd4I0ujE8W28ETFJyDI2Y7LJ6riCpAkTEzt6opipKZU-8QLhwEdN9xFlOvAR8m7Nh7RbxybER9ikzcxSjkYtPDnjH0Y6Z1nrd2QizDDLSJAxNrKf_f4/w640-h390/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So, I believe it&#39;s enough to witness the power of Azure Arc for Kubernetes. I have just touched the tip of the iceberg; purposefully avoided going deep as this could unnecessarily confuse readers and make the article long and complex. But you can explore. 👍&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The most significant part is that your kubernetes cluster can be running anywhere (on premise or on any cloud); the process is exact the same. You can manage and deploy apps into your clusters running anywhere sitting right on Azure. Cool !&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now if you make any changes in your application; just dockerize it; update the image with a new version number and upload it to the registry. The git operation will fire up automatically; would read that from your deployment yml in the git repo; download the image from your container registry and deploy it in your cluster behind the scene as a part of continuous deployment.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You can also run all your kubectl commands on the cluster and it works just fine&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;That&#39;s
 it.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;color: orange;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;color: orange;&quot;&gt;Congratulations&lt;/span&gt;&lt;/b&gt;! for coming this far. Hope this article will help you to further explore more on this topic.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Do share with me about your experience and what you have built upon this
 foundation. You can take it upto any level and integrate. I would love 
to hear from you.&lt;/div&gt;&lt;p&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://techiemate.blogspot.com/feeds/7768448821589244528/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techiemate.blogspot.com/2021/07/2-azure-arc-deploying-net-core-app-into.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/7768448821589244528'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/7768448821589244528'/><link rel='alternate' type='text/html' href='http://techiemate.blogspot.com/2021/07/2-azure-arc-deploying-net-core-app-into.html' title='2. Azure Arc : Deploying .Net Core App into Azure Arc enabled K8s with Git Ops'/><author><name>Atanu Gupta</name><uri>http://www.blogger.com/profile/05529718294081550882</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_LZ_SzyDY_u8HW4LiUYlsEJKSSMR5zYs-ow0dK7kjPtYVYnB_nHhGXM3Ad8Gt9AxMhbi0UO3mSjuYBQq2Sli5kUe05z21o-xTJYAM-Pw6TErhMe4ITlrqdadJSCp_xYQS1rf5k8diG7IlmVmai1fllCvN7o9A8b0JSaV5Gn6SCwv5zw/s220/1714907742840.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVkYwZCtyZ-Hns-UtIEo75mHawhgTQKka6GEk8dF7RoM9P8axf6boVKUEUUx1Yc758Z0xdO3wR4ZbG4oBFmmRpSugC2qBwA-9BndfK5bs7rtqg6-OugK59T5hyIYpu35ZvcpHIIfrTTr0/s72-w640-h158-c/image.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6011381329995167460.post-4861276137494718884</id><published>2021-07-02T15:12:00.008+05:30</published><updated>2021-07-07T08:29:58.304+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="AKS"/><category scheme="http://www.blogger.com/atom/ns#" term="Arc"/><category scheme="http://www.blogger.com/atom/ns#" term="Azure"/><category scheme="http://www.blogger.com/atom/ns#" term="Azure Arc"/><category scheme="http://www.blogger.com/atom/ns#" term="K8s"/><category scheme="http://www.blogger.com/atom/ns#" term="Kubernetes"/><category scheme="http://www.blogger.com/atom/ns#" term="PaaS"/><title type='text'>1. Azure Arc : Setting up &#39;Kubernetes - Azure Arc&#39; with AKS cluster</title><content type='html'>&lt;p&gt;At Ignite 2019, Satya Nadella, CEO of Microsoft, announced an array of new hybrid cloud products and services. The most significant announcement is Azure Arc, the hybrid and multi-cloud platform from Microsoft.&amp;nbsp;With Azure Arc, Microsoft has expanded the support for resources running outside of Azure.&lt;/p&gt;&lt;p&gt;As of today Azure Arc allows you to manage the following resources outside Azure.&lt;/p&gt;&lt;ul&gt;
&lt;li&gt;Servers - both physical and virtual machines running Windows or Linux.&lt;/li&gt;
&lt;li&gt;Kubernetes clusters - supporting multiple Kubernetes distributions.&lt;/li&gt;
&lt;li&gt;Azure data services - Azure SQL Managed Instance and PostgreSQL Hyperscale services.&lt;/li&gt;
&lt;li&gt;SQL Server - enroll instances from any location.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;Microsoft Azure Arc documentation:&amp;nbsp;&amp;nbsp;&lt;a href=&quot;https://docs.microsoft.com/en-us/azure/azure-arc/overview&quot;&gt;https://docs.microsoft.com/en-us/azure/azure-arc/overview&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;Imp&lt;/span&gt;&lt;/b&gt;: Azure Arc is not available in all the regions as of today. In some regions it&#39;s already GA or in Preview or Not Available at all. So make sure you check Azure Product availability page often&amp;nbsp;&lt;a href=&quot;https://azure.microsoft.com/en-in/global-infrastructure/services/?products=azure-arc&amp;amp;regions=all&quot;&gt;https://azure.microsoft.com/en-in/global-infrastructure/services/?products=azure-arc&amp;amp;regions=all&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I do not have any K8s cluster running anywhere (not on-premise neither in any other cloud) except one running in Azure, so in this article, I would onboard that AKS cluster into Azure Arc. But the process is same for any kubernetes cluster running in any on-premise/cloud platform.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So, without much theory... let&#39;s simply dive! 😉&lt;/div&gt;&lt;div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Create an AKS cluster in Azure if you do not have it already. A basic cluster setup would do if in case you want to follow along.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhShe1NVjaHyeJDamOHghyHgVgw56CiP4WsSyf1kckp_BKlAsNH0JqPOWXlDJxOysU7AM1_KqrDHQQw2Pdr_5w2QXeRWk-z3JYmkOgI5QdzycwCpu14HfByrbc5GDoYjlzjOjMpIQWm1QU/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;674&quot; data-original-width=&quot;860&quot; height=&quot;502&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhShe1NVjaHyeJDamOHghyHgVgw56CiP4WsSyf1kckp_BKlAsNH0JqPOWXlDJxOysU7AM1_KqrDHQQw2Pdr_5w2QXeRWk-z3JYmkOgI5QdzycwCpu14HfByrbc5GDoYjlzjOjMpIQWm1QU/w640-h502/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;We will issue some CLI commands in this demo. So, it&#39;s a good practice to have the latest CLI version installed if not already as old version may not support these commands.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKZkGtVuBngpvv1sj-vYRgYuKwmVB0yulqr3S0LHLQTbjA2Bx68VAftcyTzHYiFv-EjUoNGa8QEI8YTngnyE38bDQ6QcsHoYvhTYPBJbQ35MlGYlfu3-nZyncU4CZESoPS-zVX_p_sQKg/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;64&quot; data-original-width=&quot;472&quot; height=&quot;54&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKZkGtVuBngpvv1sj-vYRgYuKwmVB0yulqr3S0LHLQTbjA2Bx68VAftcyTzHYiFv-EjUoNGa8QEI8YTngnyE38bDQ6QcsHoYvhTYPBJbQ35MlGYlfu3-nZyncU4CZESoPS-zVX_p_sQKg/w400-h54/image.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Azure service principal assigned with the “Contributor” role is also required. So, login to azure from your CLI terminal and get that created. It can be any unique service principal name of your choice.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheMFkDybW3o32R1p7omGCrcEUfdakBzqy7wf-fYcQx2VkKuukKgYULvHvJaOdbQaWdZYDK-C01bv5O9gduPmmNq7aLKvf6U0MenhiPh-ztFPgXlXTmr6WgqlS2K6z9ejQ3PRpcJWaODM0/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;66&quot; data-original-width=&quot;779&quot; height=&quot;54&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheMFkDybW3o32R1p7omGCrcEUfdakBzqy7wf-fYcQx2VkKuukKgYULvHvJaOdbQaWdZYDK-C01bv5O9gduPmmNq7aLKvf6U0MenhiPh-ztFPgXlXTmr6WgqlS2K6z9ejQ3PRpcJWaODM0/w640-h54/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Copy the details from the above command and keep it in notepad. We would need these shortly&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhw-6LWzlthTaz4IaJLZaDc9_H13d1wRuP3xZizq54T3JqrQuDqLyxRL2viPPAjXq9NY3_waxyYSszCuwER0GxZM5zR-pN_ASVaMNEfacSwk9L-qIzfytR_vZwJGJFzUhP5F8-qfJWX1Hc/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;160&quot; data-original-width=&quot;575&quot; height=&quot;111&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhw-6LWzlthTaz4IaJLZaDc9_H13d1wRuP3xZizq54T3JqrQuDqLyxRL2viPPAjXq9NY3_waxyYSszCuwER0GxZM5zR-pN_ASVaMNEfacSwk9L-qIzfytR_vZwJGJFzUhP5F8-qfJWX1Hc/w400-h111/image.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Now two namespaces needs to be registered. &lt;i&gt;Microsoft.Kubernetes&lt;/i&gt; and &lt;i&gt;Microsoft.KubernetesConfiguration&lt;/i&gt;.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfmQIsfXDBOjxMCSvSRZ0e9W3QhBFwphZg03osZriJ9R5x5KgRfB-wuA0ZmBkx-_0HFowgXqtIaOhQconZUDOAqMA0wP6me0t7wo3QdTMheFapm5MSKrnISXDU79y4HihThiwNZClBHaQ/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;71&quot; data-original-width=&quot;784&quot; height=&quot;58&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfmQIsfXDBOjxMCSvSRZ0e9W3QhBFwphZg03osZriJ9R5x5KgRfB-wuA0ZmBkx-_0HFowgXqtIaOhQconZUDOAqMA0wP6me0t7wo3QdTMheFapm5MSKrnISXDU79y4HihThiwNZClBHaQ/w640-h58/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;The above commands are asynchronous in nature and hence you need to check their progress by the below commands. The Registration Status must show as &quot;Registered&quot; before you proceed forward.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjH5I5dAqSec77eOIJPGSBAGaF-37sHUWJ4MToz_wq40YjEiPO0MhKItP572PoPz5Aq6KGx_fsRRG7DXVd192KqinJDCLFo_1YwqEGMkhq0GShHuguO66-pnKSbWizKmGxaEzNjct7_akY/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;242&quot; data-original-width=&quot;862&quot; height=&quot;181&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjH5I5dAqSec77eOIJPGSBAGaF-37sHUWJ4MToz_wq40YjEiPO0MhKItP572PoPz5Aq6KGx_fsRRG7DXVd192KqinJDCLFo_1YwqEGMkhq0GShHuguO66-pnKSbWizKmGxaEzNjct7_akY/w640-h181/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Great!... now you have the stage ready. Microsoft provides an&amp;nbsp;&lt;b&gt;az_connect_aks.sh&lt;/b&gt; script which can be downloaded from&amp;nbsp;&lt;a href=&quot;https://github.com/microsoft/azure_arc/blob/main/azure_arc_k8s_jumpstart/aks/arm_template/scripts/az_connect_aks.sh&quot;&gt;https://github.com/microsoft/azure_arc/blob/main/azure_arc_k8s_jumpstart/aks/arm_template/scripts/az_connect_aks.sh&lt;/a&gt;. So, please do that and proceed with the next step&lt;/li&gt;&lt;li&gt;Replace the appId, password, tenantId with the values you had saved earlier in your notepad. Step 3. For resourceGroup and arcClusterName provide your resource group name and the AKS cluster name respectively&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTcU4sPAKNusaUHEjYW0PaRqPo0Z0TsDisU4-h5ssdhkD_9akU4IVIyjNmFl_z09Jzo3Od4yhrQvF08XZNHUlRH_xQODdyuDAkpkr-1SFIZ2TNyffqjkXtamWiyK7dOLCf3t2SNlOS2BA/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;145&quot; data-original-width=&quot;852&quot; height=&quot;109&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTcU4sPAKNusaUHEjYW0PaRqPo0Z0TsDisU4-h5ssdhkD_9akU4IVIyjNmFl_z09Jzo3Od4yhrQvF08XZNHUlRH_xQODdyuDAkpkr-1SFIZ2TNyffqjkXtamWiyK7dOLCf3t2SNlOS2BA/w640-h109/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Save the file and let&#39;s open the shell web interface (&lt;a href=&quot;http://shell.azure.com&quot;&gt;shell.azure.com&lt;/a&gt;) to run this script. Make sure the bash mode is selected&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHjHfFGYi2aQQtmP9rm279dazOyBcudfQ7y2Ay8NYGFuK1rYiiYt6R233hNr0zOL8ajS_3tMcGd9wlyXvuS2ZMN_kwRzjJ-yy1Qi0I4DwJIROl1x9siG7pYfR2BDcMisjizLqfu7vF7os/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;270&quot; data-original-width=&quot;775&quot; height=&quot;222&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHjHfFGYi2aQQtmP9rm279dazOyBcudfQ7y2Ay8NYGFuK1rYiiYt6R233hNr0zOL8ajS_3tMcGd9wlyXvuS2ZMN_kwRzjJ-yy1Qi0I4DwJIROl1x9siG7pYfR2BDcMisjizLqfu7vF7os/w640-h222/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;On successful upload, issue the ls -l command to find the file in the root directory&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAfaFVxrY3xAnzieQUpMjmnysvuUJUHzXQdvwdjtueW_DXWEgNprF8VB1voXelxqNAdJgB5hjfq-c8U2_tdzqJG2SSCZCin5D0mNUdJh1TPWkDhCV6rSnbDDI0m_ZMzldH9QznpV9FLL0/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;291&quot; data-original-width=&quot;889&quot; height=&quot;210&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAfaFVxrY3xAnzieQUpMjmnysvuUJUHzXQdvwdjtueW_DXWEgNprF8VB1voXelxqNAdJgB5hjfq-c8U2_tdzqJG2SSCZCin5D0mNUdJh1TPWkDhCV6rSnbDDI0m_ZMzldH9QznpV9FLL0/w640-h210/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Run the file &quot;. ./az_connect_aks.sh&quot;. The operation might take a while to complete.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgyh_U89eBmnvI87PByMTfOavOFF07K_eZUfpukq3DLMX28sphyT1I_jSDuFPljM5bAINcd77R1Nm_SErL3v2hcGnZSPug-ayntHcKNOKkamWEWWYnBibXjg6hKxGosVQnmLG47Yvev9k8/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;32&quot; data-original-width=&quot;471&quot; height=&quot;28&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgyh_U89eBmnvI87PByMTfOavOFF07K_eZUfpukq3DLMX28sphyT1I_jSDuFPljM5bAINcd77R1Nm_SErL3v2hcGnZSPug-ayntHcKNOKkamWEWWYnBibXjg6hKxGosVQnmLG47Yvev9k8/w400-h28/image.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Once done... go to the resource group of you AKS cluster to find one more cluster in there and that&#39;s the ARC cluster&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaaDH27tzrHGQwl0OHTbwRkas1ATH2sjzj2Ag10VZ2yxqo1JCmI5yeQ6HtvuJOVKi47Ah-Hdh2WHJ92aDd2yiInXHXBVWJkUMWtadp-Tp0mYXFxNEm6p9RJl2araGkeGTq5Y-_z__r6Gw/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;148&quot; data-original-width=&quot;1329&quot; height=&quot;71&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaaDH27tzrHGQwl0OHTbwRkas1ATH2sjzj2Ag10VZ2yxqo1JCmI5yeQ6HtvuJOVKi47Ah-Hdh2WHJ92aDd2yiInXHXBVWJkUMWtadp-Tp0mYXFxNEm6p9RJl2araGkeGTq5Y-_z__r6Gw/w640-h71/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;ul&gt;&lt;li style=&quot;text-align: left;&quot;&gt;You can also check the cluster by going into the Kubernetes - Azure Arc service instance&amp;nbsp;&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjhQymO0js4c4nio5J69J55IqcuXIiKs9Rd0HexVVlZ-fxv73TQPt6v6ukOsMUPsfg0mMRfAkeADSZaOwT8ZobX2P2zDrS-2f6s7anKdXoQWAqUr3ov5aC-NbG2k9UfXbnjYjHkSgRbEM/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;156&quot; data-original-width=&quot;752&quot; height=&quot;132&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjhQymO0js4c4nio5J69J55IqcuXIiKs9Rd0HexVVlZ-fxv73TQPt6v6ukOsMUPsfg0mMRfAkeADSZaOwT8ZobX2P2zDrS-2f6s7anKdXoQWAqUr3ov5aC-NbG2k9UfXbnjYjHkSgRbEM/w640-h132/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;That&#39;s it. You have successfully onboarded a kubernetes cluster in Kubernetes - Azure Arc. Now you can centrally monitor your kubernetes clusters running on any cloud, apply policies on those and do Git Operations sitting right in Azure. Isn&#39;t that cool stuff.&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;color: orange;&quot;&gt;Congratulations&lt;/span&gt;&lt;/b&gt;! for coming this far. Hope this article will help you to further explore more on this feature.&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;div&gt;Do share with me about your experience and what you have built upon this
 foundation. You can take it upto any level and integrate. I would love 
to hear from you.&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techiemate.blogspot.com/feeds/4861276137494718884/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techiemate.blogspot.com/2021/07/kubernetes-azure-arc.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/4861276137494718884'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/4861276137494718884'/><link rel='alternate' type='text/html' href='http://techiemate.blogspot.com/2021/07/kubernetes-azure-arc.html' title='1. Azure Arc : Setting up &#39;Kubernetes - Azure Arc&#39; with AKS cluster'/><author><name>Atanu Gupta</name><uri>http://www.blogger.com/profile/05529718294081550882</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_LZ_SzyDY_u8HW4LiUYlsEJKSSMR5zYs-ow0dK7kjPtYVYnB_nHhGXM3Ad8Gt9AxMhbi0UO3mSjuYBQq2Sli5kUe05z21o-xTJYAM-Pw6TErhMe4ITlrqdadJSCp_xYQS1rf5k8diG7IlmVmai1fllCvN7o9A8b0JSaV5Gn6SCwv5zw/s220/1714907742840.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhShe1NVjaHyeJDamOHghyHgVgw56CiP4WsSyf1kckp_BKlAsNH0JqPOWXlDJxOysU7AM1_KqrDHQQw2Pdr_5w2QXeRWk-z3JYmkOgI5QdzycwCpu14HfByrbc5GDoYjlzjOjMpIQWm1QU/s72-w640-h502-c/image.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6011381329995167460.post-7046297162566597207</id><published>2020-12-28T12:12:00.004+05:30</published><updated>2020-12-28T12:23:36.830+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Azure"/><category scheme="http://www.blogger.com/atom/ns#" term="Integration"/><category scheme="http://www.blogger.com/atom/ns#" term="iPaaS"/><category scheme="http://www.blogger.com/atom/ns#" term="JSON"/><category scheme="http://www.blogger.com/atom/ns#" term="Logic App"/><category scheme="http://www.blogger.com/atom/ns#" term="Microservices"/><category scheme="http://www.blogger.com/atom/ns#" term="PaaS"/><category scheme="http://www.blogger.com/atom/ns#" term="Tips / Tricks"/><title type='text'>Mocking data in Azure Logic Apps</title><content type='html'>&lt;p&gt;In any distributed system development, various pieces of an application gets developed by multiple teams from different parts of the geography. This is a OK till you hit a roadblock when you cannot proceed until another team finishes their work and provide the data you need. In today&#39;s microservices design model this is even more relevant where you need a dependent service to return the data you need so that you can complete your work.&lt;/p&gt;&lt;p&gt;This type is scenario is inevitable and you cannot help but rather have to live with it. So what to do? 😒&amp;nbsp;&lt;/p&gt;&lt;p&gt;Mocking!! Yes you are right. Why not mock the data you need to finish your work and later just do the plumbing work with the actual service when it&#39;s up and ready to throw back actual data. This is a great idea where teams can work on their own schedule without waiting and running after each other.&lt;/p&gt;&lt;p&gt;In Azure, when it comes to mocking, developers often fall back on &lt;b&gt;API Management&lt;/b&gt; to implement this with the help of APIM polices. But why going for such costly idea where the need is only to mock data when you can use your other friend &lt;b&gt;Logic Apps&lt;/b&gt; to achieve the same. Let&#39;s check it out 👍&lt;/p&gt;&lt;p&gt;&lt;b&gt;Scenario&lt;/b&gt;:&lt;/p&gt;&lt;p&gt;We need to get the employee details from the database service (developing by the back-end team) by passing the employee code. But the back-end team is not yet there and hence we need to mock the employee details.&lt;/p&gt;&lt;p&gt;Let&#39;s get started.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcm-_z2um9UYRReT7zFG9C3GIKOfqGPrXsk7kTQiFQi_y_Ax_NjfVegDd8o30aRJO0hHuUy4lUYRzJKEf-u_qUFu-edRgDjSk6zs5SXuZKSUUVNi9pCDRIwu74Mk6JL68a3PcUAuca830/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;614&quot; data-original-width=&quot;1434&quot; height=&quot;274&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcm-_z2um9UYRReT7zFG9C3GIKOfqGPrXsk7kTQiFQi_y_Ax_NjfVegDd8o30aRJO0hHuUy4lUYRzJKEf-u_qUFu-edRgDjSk6zs5SXuZKSUUVNi9pCDRIwu74Mk6JL68a3PcUAuca830/w640-h274/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Define an http endpoint where we will send the employee code as below&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMp44gfYfvSla7Owvri0PpBPSxbeNOHXXIXZyPmMUqrGKboianb7dPoF-DVjQ8uNitKEbrNpL8CnbBrPRbd1LDFN7NcLm2B_w99XE5tooa7F0-Yo8A5B_TKpmKfP-fZ-i-b46lUV2y7bg/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;465&quot; data-original-width=&quot;746&quot; height=&quot;398&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMp44gfYfvSla7Owvri0PpBPSxbeNOHXXIXZyPmMUqrGKboianb7dPoF-DVjQ8uNitKEbrNpL8CnbBrPRbd1LDFN7NcLm2B_w99XE5tooa7F0-Yo8A5B_TKpmKfP-fZ-i-b46lUV2y7bg/w640-h398/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Add a new action and search for the HTTP action&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyoj7SPS2VuA38A9ugxPvrOeKpj9aXy0iDp47011-3cNJj608v8sROU42WVQX4psoY9NcqNrjztxbqPLnmEw23BmRCDv8DYbqDT9Vfl3DTsQruwj9HcAl2tlHrOvtbCTusa2j3biaIMJI/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;364&quot; data-original-width=&quot;736&quot; height=&quot;316&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyoj7SPS2VuA38A9ugxPvrOeKpj9aXy0iDp47011-3cNJj608v8sROU42WVQX4psoY9NcqNrjztxbqPLnmEw23BmRCDv8DYbqDT9Vfl3DTsQruwj9HcAl2tlHrOvtbCTusa2j3biaIMJI/w640-h316/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Fill the details as per your requirement. In my case it&#39;s a GET call with the following details.&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaYgJLPkLPeIilLDmvapogzOg9Q2vWA9oiegZDD-gSuL8kjAqrz4SMZ3UuNMBpl2uDeGcT2BXBEeXZ9o0LoNOd5_8OBrPRSqXhokrrrdH8BdGzWY-DB5rjW-0qjNP8_UagjkGAX7ujNR4/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;366&quot; data-original-width=&quot;729&quot; height=&quot;322&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaYgJLPkLPeIilLDmvapogzOg9Q2vWA9oiegZDD-gSuL8kjAqrz4SMZ3UuNMBpl2uDeGcT2BXBEeXZ9o0LoNOd5_8OBrPRSqXhokrrrdH8BdGzWY-DB5rjW-0qjNP8_UagjkGAX7ujNR4/w640-h322/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;As mentioned the URI is the service that&#39;s getting developed by the backend team which is not yet ready. So, in this action we have to inject out mocking logic.&amp;nbsp;&lt;p&gt;&lt;/p&gt;&lt;p&gt;Click the &quot;...&quot; eclipse at the top right section of the action and select &quot;Static result (Preview)&quot; from the context menu. Yeah it&#39;s preview but works just fine. Go ahead!&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi7koPkujhJBPj89KqbAjKTS7yz9UYV1epG1PkjsSfPY3mj7bn3B29YIfCtoKEWDFFEAsdBL17HT837iJznJjAO6B_0tt1wXZ6KMxHmkx-gkxGXcpXK2ZilC8PCJkZgQuJeGg6uK-OwX8Y/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;370&quot; data-original-width=&quot;958&quot; height=&quot;248&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi7koPkujhJBPj89KqbAjKTS7yz9UYV1epG1PkjsSfPY3mj7bn3B29YIfCtoKEWDFFEAsdBL17HT837iJznJjAO6B_0tt1wXZ6KMxHmkx-gkxGXcpXK2ZilC8PCJkZgQuJeGg6uK-OwX8Y/w640-h248/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;Enable the Static result to get the following window. The default selections are good to go for our mocking purpose&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5u9kxNWL2MQTPAhvOUQd_K7lHLF4UwER3-SrgD_3jB_jYeMloG24n83D5vFNsTq1ALYG6je7TASwMeg3ZvDSAvd8nov2GX9O2YHu4YIXkP_l_Zxmn1iGVvPh790uz27Zw2DHBrCjRWFs/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;540&quot; data-original-width=&quot;731&quot; height=&quot;472&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5u9kxNWL2MQTPAhvOUQd_K7lHLF4UwER3-SrgD_3jB_jYeMloG24n83D5vFNsTq1ALYG6je7TASwMeg3ZvDSAvd8nov2GX9O2YHu4YIXkP_l_Zxmn1iGVvPh790uz27Zw2DHBrCjRWFs/w640-h472/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;But strangely there&#39;s no place to provide the static json response content here. Don&#39;t worry! It&#39;s there but we need to tweak a bit 😉&lt;p&gt;&lt;/p&gt;&lt;p&gt;Hit the JSON mode icon to switch to the JSON view mode as below&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLhRK-4_iGvjKPn8qKVDJxs4UI8FoG6sBsalMhyphenhyphenSn31ZRw3EsoGaSWnT70oNk8n_SxvyF59WlfSLk8Xe9cdyWDPxtY94kMJfwtOyUp0l6UUIcruhgm4nvi2FO4lxgCypDXS9xHzkfNGcQ/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;540&quot; data-original-width=&quot;731&quot; height=&quot;472&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLhRK-4_iGvjKPn8qKVDJxs4UI8FoG6sBsalMhyphenhyphenSn31ZRw3EsoGaSWnT70oNk8n_SxvyF59WlfSLk8Xe9cdyWDPxtY94kMJfwtOyUp0l6UUIcruhgm4nvi2FO4lxgCypDXS9xHzkfNGcQ/w640-h472/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWv0P9WeS6tOi4uqZM7C3lTbq_Fy5lQ8klXf85PkPdLLo1DNZyhKqexXg3WUrqQU6GQD6ZUJ9itXukDdcYzVitbeajYJ4t1Qu67X3YIU-iQgm1mJ9V33AM9iR0jEkdJh_-MzkOm2Xr2aU/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;480&quot; data-original-width=&quot;735&quot; height=&quot;418&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWv0P9WeS6tOi4uqZM7C3lTbq_Fy5lQ8klXf85PkPdLLo1DNZyhKqexXg3WUrqQU6GQD6ZUJ9itXukDdcYzVitbeajYJ4t1Qu67X3YIU-iQgm1mJ9V33AM9iR0jEkdJh_-MzkOm2Xr2aU/w640-h418/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;Now here in the outputs section paste your return JSON in a body tag as below. I just need the employee first_name, last_name , &quot;dept&quot; and &quot;rank&quot; from the database service. So, I have mocked that piece as the back-end service is not yet ready and I can continue with my development 😃&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgeJgP2kxYHvITRo5WljhAJGTZl-Cwo1uV5TGS7vL7AbFGmQHGKhkndDqBj7dmJ37PGMn69s7ikYkFRILdgCw4Mwedeir69xKkdtHC6RYtMAYZNPjt4KHfzkTAU_SyDZ5zVjN8_LOoMfG8/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;478&quot; data-original-width=&quot;732&quot; height=&quot;418&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgeJgP2kxYHvITRo5WljhAJGTZl-Cwo1uV5TGS7vL7AbFGmQHGKhkndDqBj7dmJ37PGMn69s7ikYkFRILdgCw4Mwedeir69xKkdtHC6RYtMAYZNPjt4KHfzkTAU_SyDZ5zVjN8_LOoMfG8/w640-h418/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Hit &lt;b&gt;Done&lt;/b&gt; as return to the workflow. Now you will find a new icon added to the action which denotes that this action has a static result configured&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6-L3v4NoaJmhxuFlCO5fpFy3hL2-bLTHt9-6tIZxigiLXXkHy7dp1xtGMpyonkpKgIanyzj4j_ppPnboiMrRMxI9dj8DSNkAjR3sdqrX2ZMpXoQoLFXzA0aYITy5BcFqwg5YkW_6SjfM/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;374&quot; data-original-width=&quot;733&quot; height=&quot;326&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6-L3v4NoaJmhxuFlCO5fpFy3hL2-bLTHt9-6tIZxigiLXXkHy7dp1xtGMpyonkpKgIanyzj4j_ppPnboiMrRMxI9dj8DSNkAjR3sdqrX2ZMpXoQoLFXzA0aYITy5BcFqwg5YkW_6SjfM/w640-h326/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;As a last step let&#39;s add an &quot;Response&quot; action in the workflow and return back the employee details to the caller.&amp;nbsp;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-PKTHYo_pkI6aXPzwwCJvv7TfZjylS2CHtWXcRRXWROEOhgQw0547hOKr87HAP_gxxR4_1iPiizwPv9qFm2sbCjJgj7QmJo0CO0qUkf8fAP_aujhwfiLcb4A558SUIKZ5YqkqevfAAng/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;241&quot; data-original-width=&quot;735&quot; height=&quot;210&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-PKTHYo_pkI6aXPzwwCJvv7TfZjylS2CHtWXcRRXWROEOhgQw0547hOKr87HAP_gxxR4_1iPiizwPv9qFm2sbCjJgj7QmJo0CO0qUkf8fAP_aujhwfiLcb4A558SUIKZ5YqkqevfAAng/w640-h210/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;b&gt;Save your logic app.&lt;/b&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;Done! let take a bird&#39;s eye view of our logic app workflow. This will help you to match if you are doing it in parallel along with this article&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpvsvTuop1Q-aoQfvcLpRGJBIe0SICQYHs9_8ZCppMYofOMmKuxmkrDwKNyTZTuUChnfqSHRsKx-f9JE4nZWZjUiOEEiOzJK2SyXrUjfmZHzysZVwrIyed97tTl5zIceM0USPEQWTYC4k/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;919&quot; data-original-width=&quot;591&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpvsvTuop1Q-aoQfvcLpRGJBIe0SICQYHs9_8ZCppMYofOMmKuxmkrDwKNyTZTuUChnfqSHRsKx-f9JE4nZWZjUiOEEiOzJK2SyXrUjfmZHzysZVwrIyed97tTl5zIceM0USPEQWTYC4k/w411-h640/image.png&quot; width=&quot;411&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Testing time! Copy the http endpoint from the trigger (first action) and paste it in any rest client to make the call. I have used postman rest client as below. Hit Send and get your static result back.&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGdmn8-prbKq7G5ziF1gADX-qiOT2ASODPuBOSBSk0UttCsZiKZIzMTVj47C90U7CtZ7U8x-Lzh4gVIGKzZ2lR7gwB9R1DReDmXrfpT53Q9A8DL_qCAqpNQYneo4gKPiRwW7tGIZtASis/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;550&quot; data-original-width=&quot;1464&quot; height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGdmn8-prbKq7G5ziF1gADX-qiOT2ASODPuBOSBSk0UttCsZiKZIzMTVj47C90U7CtZ7U8x-Lzh4gVIGKzZ2lR7gwB9R1DReDmXrfpT53Q9A8DL_qCAqpNQYneo4gKPiRwW7tGIZtASis/w640-h240/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;That&#39;s it. You have successfully implemented mocking and what a cool way to do so.&amp;nbsp;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;Isn&#39;t that great!&amp;nbsp;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;color: orange;&quot;&gt;Congratulations&lt;/span&gt;&lt;/b&gt;! for coming this far. Hope this article will help you to further explore more on this feature.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Do share with me about your experience and what you have built upon this
 foundation. You can take it upto any level and integrate. I would love 
to hear from you.&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techiemate.blogspot.com/feeds/7046297162566597207/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techiemate.blogspot.com/2020/12/mocking-data-in-azure-logic-apps.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/7046297162566597207'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/7046297162566597207'/><link rel='alternate' type='text/html' href='http://techiemate.blogspot.com/2020/12/mocking-data-in-azure-logic-apps.html' title='Mocking data in Azure Logic Apps'/><author><name>Atanu Gupta</name><uri>http://www.blogger.com/profile/05529718294081550882</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_LZ_SzyDY_u8HW4LiUYlsEJKSSMR5zYs-ow0dK7kjPtYVYnB_nHhGXM3Ad8Gt9AxMhbi0UO3mSjuYBQq2Sli5kUe05z21o-xTJYAM-Pw6TErhMe4ITlrqdadJSCp_xYQS1rf5k8diG7IlmVmai1fllCvN7o9A8b0JSaV5Gn6SCwv5zw/s220/1714907742840.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcm-_z2um9UYRReT7zFG9C3GIKOfqGPrXsk7kTQiFQi_y_Ax_NjfVegDd8o30aRJO0hHuUy4lUYRzJKEf-u_qUFu-edRgDjSk6zs5SXuZKSUUVNi9pCDRIwu74Mk6JL68a3PcUAuca830/s72-w640-h274-c/image.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6011381329995167460.post-2400731617658078835</id><published>2020-12-14T17:24:00.006+05:30</published><updated>2020-12-15T11:34:17.907+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Azure"/><category scheme="http://www.blogger.com/atom/ns#" term="iPaaS"/><category scheme="http://www.blogger.com/atom/ns#" term="JavaScript"/><category scheme="http://www.blogger.com/atom/ns#" term="Logic App"/><category scheme="http://www.blogger.com/atom/ns#" term="PaaS"/><title type='text'>Inject Inline javascript code in your Azure Logic App workflow</title><content type='html'>&lt;p&gt;JavaScript is web developers all time favourite. Writing small snippets of JS code into your application to implement few cool functionality is very tempting and developers; I know one cannot think of any web application which do not have any JS flavor in some form or the other 😀&amp;nbsp;&lt;/p&gt;&lt;p&gt;Wouldn&#39;t it be great if we can use our JavaScript knowledge and inject a JS snippet into an Azure Logic App workflow and pull a magic out of it. I know you are thinking &quot;Yessss! Why Not&quot;, so lets see how it an be done.&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;i&gt;[Please note that is article expects you to have the basic 
understanding of Azure Logic Apps and Functions. You can check on 
Microsoft Azure documentation for such]&amp;nbsp;&lt;/i&gt;&lt;/p&gt;&lt;p&gt;Our scenario for this article:&lt;/p&gt;&lt;p&gt;We need an Http endpoint which will accept a temperature and will do the Celsius or Fahrenheit conversion accordingly. If we send the temperature as Celsius then it will give us its Fahrenheit value and vice-versa.&lt;/p&gt;&lt;p&gt;In most cases I have seen developers quickly jumps into writing Azure Function to do this kind of simple stuff but after going through this article I hope you would think twice.&lt;/p&gt;&lt;p&gt;Our JSON payload will be as below which we will send while calling the Logic App endpoint. It&#39;s just sending the temperature in Celsius and expecting its respective Fahrenheit value.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: &amp;quot;Andale Mono&amp;quot;, &amp;quot;Lucida Console&amp;quot;, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;{
   &quot;temperature&quot;:&quot;40&quot;,
   &quot;metric&quot;:&quot;C&quot;
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Now the JavaScript snippet to do the conversion is as below. It&#39;s just applying the formula and doing the respective Celsius and Fahrenheit conversion after reading the temperature and metric from the http request. If metric is coming as &quot;C&quot; then the result will be it&#39;s respective Fahrenheit and vice-versa.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: &amp;quot;Andale Mono&amp;quot;, &amp;quot;Lucida Console&amp;quot;, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;var temp = workflowContext.trigger.outputs.body.temperature; 
var metric = workflowContext.trigger.outputs.body.metric;
var cf; 
if (metric == &quot;C&quot;)
    cf = (temp * 9/5) + 32 + &quot; degree Fahrenheit&quot;;
else if(metric == &quot;F&quot;)
    cf = (temp - 32) * 5/9 + &quot; degree Celsius&quot;;
else
    cf = &quot;Invalid input&quot;
return cf;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;That&#39;s it! really 😲&lt;/p&gt;&lt;p&gt;Now lets create a Logic App and inject this piece of JavaScript snippet. There is an &quot;Inline Code&quot; Operation with an Action &quot;Execute JavaScript Code (preview)&quot; in Logic App workflow which we will use to achieve our result. Yes it&#39;s in preview but works just fine. Don&#39;t worry... you can safely use it 👍&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_ImuC6p8GK_tE10NlCxSSbHEVlFqgCbFYPbbqS2dZoagzrWelmANCaQ96mMY-GJ66gG-4I_cZ6VVmeSPNd2P7otBvIAx9C8pq8YkAdtxYZ1ltQgbvtaS1OfPtZejWZkRvMsn-vYUl3sI/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;517&quot; data-original-width=&quot;688&quot; height=&quot;301&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_ImuC6p8GK_tE10NlCxSSbHEVlFqgCbFYPbbqS2dZoagzrWelmANCaQ96mMY-GJ66gG-4I_cZ6VVmeSPNd2P7otBvIAx9C8pq8YkAdtxYZ1ltQgbvtaS1OfPtZejWZkRvMsn-vYUl3sI/w400-h301/image.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Below is the full workflow and by looking at it you can pretty well understand what&#39;s it doing. So simple!&amp;nbsp;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiN0nut9-GqZUOBF94mrLFiJjkg1zjG4HDe3qC3zI0FmeB_c0yM9bMeGUqWEEoOY-n2SFupDqJ5-78DGbBfmeMAMIrniwhVYDgebQkayMI4cLbfvBoInDx0S3gEAake13MhH9JbHWISaMo/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;1072&quot; data-original-width=&quot;698&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiN0nut9-GqZUOBF94mrLFiJjkg1zjG4HDe3qC3zI0FmeB_c0yM9bMeGUqWEEoOY-n2SFupDqJ5-78DGbBfmeMAMIrniwhVYDgebQkayMI4cLbfvBoInDx0S3gEAake13MhH9JbHWISaMo/w416-h640/image.png&quot; width=&quot;416&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Save your Logic App and copy the Http Post Url to test it. I will use Postman rest client to test the endpoint but you can use any rest client of your choice.&lt;p&gt;&lt;/p&gt;&lt;p&gt;Test 1: Sending 20 degree Celsius and getting it&#39;s respective Fahrenheit value&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjT3TeVkRfdc7eT-4x7Lg6oVw5MoZ9efs4Sg8O6qpu15h4TtHbKhoQc7AjDkhzvqV-IvmbD07OgsZiLX_15Bit8HKcO2pa1Qcpfz7c6X-Gh5ch4obwfsQoLrN3H46SkReV6J32_CxRT1xs/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;625&quot; data-original-width=&quot;1467&quot; height=&quot;272&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjT3TeVkRfdc7eT-4x7Lg6oVw5MoZ9efs4Sg8O6qpu15h4TtHbKhoQc7AjDkhzvqV-IvmbD07OgsZiLX_15Bit8HKcO2pa1Qcpfz7c6X-Gh5ch4obwfsQoLrN3H46SkReV6J32_CxRT1xs/w640-h272/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Test 2: Sending 68 degree Fahrenheit and getting it&#39;s respective Celsius value&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3pFDMT8vJvzDCNiYup3u7cD6iQ7SXPjdBvQ1A6c0esMGSadEvM08pOLmKiO_Xz3C2TzNQH0_Z5KqsIzpj4OzLDULuX818TgL_ZnyTAdpqiMqcGVCLAQSEvkxf_GgpGcOQzCGYlfaDAik/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;614&quot; data-original-width=&quot;1459&quot; height=&quot;270&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3pFDMT8vJvzDCNiYup3u7cD6iQ7SXPjdBvQ1A6c0esMGSadEvM08pOLmKiO_Xz3C2TzNQH0_Z5KqsIzpj4OzLDULuX818TgL_ZnyTAdpqiMqcGVCLAQSEvkxf_GgpGcOQzCGYlfaDAik/w640-h270/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Cool! the outputs are as expected. With few line of JS snippet you are able to pull out the magic of temperature conversion which would otherwise need an Azure Function.&lt;p&gt;&lt;/p&gt;&lt;p&gt;Isn&#39;t that great!&amp;nbsp;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;div&gt;Great Job and&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: orange;&quot;&gt;Congratulations&lt;/span&gt;&lt;/b&gt;! for coming this far. Hope this article will help you to further explore more on this feature.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Do share with me about your experience and what you have built upon this
 foundation. You can take it upto any level and integrate. I would love 
to hear from you.&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techiemate.blogspot.com/feeds/2400731617658078835/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techiemate.blogspot.com/2020/12/inject-inline-javascript-code-in-your.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/2400731617658078835'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/2400731617658078835'/><link rel='alternate' type='text/html' href='http://techiemate.blogspot.com/2020/12/inject-inline-javascript-code-in-your.html' title='Inject Inline javascript code in your Azure Logic App workflow'/><author><name>Atanu Gupta</name><uri>http://www.blogger.com/profile/05529718294081550882</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_LZ_SzyDY_u8HW4LiUYlsEJKSSMR5zYs-ow0dK7kjPtYVYnB_nHhGXM3Ad8Gt9AxMhbi0UO3mSjuYBQq2Sli5kUe05z21o-xTJYAM-Pw6TErhMe4ITlrqdadJSCp_xYQS1rf5k8diG7IlmVmai1fllCvN7o9A8b0JSaV5Gn6SCwv5zw/s220/1714907742840.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_ImuC6p8GK_tE10NlCxSSbHEVlFqgCbFYPbbqS2dZoagzrWelmANCaQ96mMY-GJ66gG-4I_cZ6VVmeSPNd2P7otBvIAx9C8pq8YkAdtxYZ1ltQgbvtaS1OfPtZejWZkRvMsn-vYUl3sI/s72-w400-h301-c/image.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6011381329995167460.post-6442510453162705885</id><published>2020-11-30T17:08:00.003+05:30</published><updated>2020-12-15T11:35:23.731+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term=".Net"/><category scheme="http://www.blogger.com/atom/ns#" term="Azure"/><category scheme="http://www.blogger.com/atom/ns#" term="Design Patterns"/><category scheme="http://www.blogger.com/atom/ns#" term="Integration"/><category scheme="http://www.blogger.com/atom/ns#" term="iPaaS"/><category scheme="http://www.blogger.com/atom/ns#" term="Logic App"/><category scheme="http://www.blogger.com/atom/ns#" term="Microservices"/><category scheme="http://www.blogger.com/atom/ns#" term="PaaS"/><title type='text'>Implementing Fan-Out/Fan-In Design Pattern using Azure Logic Apps</title><content type='html'>Azure Logic Apps are great for building system integrations. It doesn&#39;t matter your systems are running on premise or in cloud (any); with this great iPaaS service you can bring them all together in a common platform very quickly.&amp;nbsp;&lt;div&gt;But did you ever thought that you can also use this service to host multiple web services which can work in parallel to give the desired output.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Think of a situation below:&lt;/div&gt;&lt;div&gt;&quot;You have three web services each destined to perform a special task and return back a result. Now this result from each service individually doesn&#39;t makes any sense. You need to collate all the results, do some data massaging on it and return back the end result to the caller.&quot;. Very common scenario nowadays. Right?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Yes you can achieve this by&lt;/div&gt;&lt;div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Calling each service one-by-one, store their individual result and then write code to prepare the end result&lt;/li&gt;&lt;li&gt;Azure Durable Functions with Orchestrator controller&lt;/li&gt;&lt;li&gt;Azure API Management with APIM policies.&lt;/li&gt;&lt;/ul&gt;All are right answers!&amp;nbsp;&lt;/div&gt;&lt;div&gt;This article is not to discourage you from using any of the above but rather intended to give you one more thought process to achieve the same using Azure Logic Apps which is worth a shot. Let&#39;s check it out.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;[Please note that is article expects you to have the basic understanding of Azure Logic Apps and Functions. You can check on Microsoft Azure documentation for such. 👍]&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I will use three very simple web services for this article. The services are nothing but Azure Functions which would simply return an integer value to the caller (in this case the logic app) where all will get summarized before flushing out the end result.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I have used one .Net and two Node.JS HttpTrigger function apps just to give it a multi-language web service flavour. The apps are just returning 10,20 and 30 respectively as their output.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;.Net Function app - 01&lt;/div&gt;&lt;div&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: &amp;quot;Andale Mono&amp;quot;, &amp;quot;Lucida Console&amp;quot;, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;using System.Net;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Primitives;
using Newtonsoft.Json;

public static async Task&amp;lt;IActionResult&amp;gt; Run(HttpRequest req, ILogger log)
{    
    log.LogInformation(&quot;C# HTTP trigger function processed a request.&quot;);
    return new OkObjectResult(10);
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;Node.JS Function app - 02&lt;/div&gt;&lt;div&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: &amp;quot;Andale Mono&amp;quot;, &amp;quot;Lucida Console&amp;quot;, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;module.exports = async function (context, req) {
    context.log(&#39;JavaScript HTTP trigger function processed a request.&#39;);    
    var responseMessage = 20;
    context.res = {
        body: parseInt(responseMessage)
    };
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;Node.JS Function app - 03&lt;/div&gt;&lt;div&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: &amp;quot;Andale Mono&amp;quot;, &amp;quot;Lucida Console&amp;quot;, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;module.exports = async function (context, req) {
    context.log(&#39;JavaScript HTTP trigger function processed a request.&#39;);
    var responseMessage = 30;
    context.res = {
        body: parseInt(responseMessage)
    };
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;We are done with our three web services hosted as Azure Function apps. Cool 😊&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now let&#39;s put a Logic App in front which will act as an abstraction layer to all the web services and would give us a single http endpoint to consume. The logic app will call all the web services in parallel (Fan-Out), collect all results (Fan-In), do a summation and would flush out the end result. So, in our case the end result would be 60.. right!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Let&#39;s take a bird&#39;s eye view of our Logic App&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5zXmDe0yS2Mf36k0lCz7vAmM9caEyn9T4s1A2ijhZ8sMqs4zL054235PddIhKUJ9NMf6VsmmbFYr78SNtLPA1w11Z5RE5H7FAoMxK-ytW71DxhvObO4JD70uK1bUZJZ2-vuke7aCg6PQ/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;1491&quot; data-original-width=&quot;2048&quot; height=&quot;466&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5zXmDe0yS2Mf36k0lCz7vAmM9caEyn9T4s1A2ijhZ8sMqs4zL054235PddIhKUJ9NMf6VsmmbFYr78SNtLPA1w11Z5RE5H7FAoMxK-ytW71DxhvObO4JD70uK1bUZJZ2-vuke7aCg6PQ/w640-h466/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;The first three variables are declared to store the respective values from the three web services. The fourth and fifth variable are for doing the summation and final result.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;Three web services are fanned-out in parallel as there is no dependency between each other. This will boost the speed as parallel processing is always faster. When all the runs are complete then the flow will be fanned-in for performing the data massaging (i.e. adding all the three results). The fourth and fifth variable are used to store the summation and ultimate flushing out the end result as a response to the caller.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;Now our Logic App is in place and we are ready to test. Just copy the Logic App Http endpoint from the workflow and call it from Postman (or any other rest client is just fine). In a moment you will find the output of 60 flashing in your screen. Voila! It just worked as expected and we have successfully showcased a very rich design pattern with the help of Azure Logic App.&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;div&gt;Great Job and&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: orange;&quot;&gt;Congratulations&lt;/span&gt;&lt;/b&gt;! for coming this far. Hope this article will help you to further explore more on this feature.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Do share with me about your experience and what you have built upon this
 foundation. You can take it upto any level and integrate. I would love 
to hear from you.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techiemate.blogspot.com/feeds/6442510453162705885/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techiemate.blogspot.com/2020/11/implementing-fan-outfan-in-design.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/6442510453162705885'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/6442510453162705885'/><link rel='alternate' type='text/html' href='http://techiemate.blogspot.com/2020/11/implementing-fan-outfan-in-design.html' title='Implementing Fan-Out/Fan-In Design Pattern using Azure Logic Apps'/><author><name>Atanu Gupta</name><uri>http://www.blogger.com/profile/05529718294081550882</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_LZ_SzyDY_u8HW4LiUYlsEJKSSMR5zYs-ow0dK7kjPtYVYnB_nHhGXM3Ad8Gt9AxMhbi0UO3mSjuYBQq2Sli5kUe05z21o-xTJYAM-Pw6TErhMe4ITlrqdadJSCp_xYQS1rf5k8diG7IlmVmai1fllCvN7o9A8b0JSaV5Gn6SCwv5zw/s220/1714907742840.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5zXmDe0yS2Mf36k0lCz7vAmM9caEyn9T4s1A2ijhZ8sMqs4zL054235PddIhKUJ9NMf6VsmmbFYr78SNtLPA1w11Z5RE5H7FAoMxK-ytW71DxhvObO4JD70uK1bUZJZ2-vuke7aCg6PQ/s72-w640-h466-c/image.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6011381329995167460.post-8189004475132364442</id><published>2020-09-29T17:34:00.008+05:30</published><updated>2020-12-15T11:36:27.871+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Azure"/><category scheme="http://www.blogger.com/atom/ns#" term="Integration"/><category scheme="http://www.blogger.com/atom/ns#" term="iPaaS"/><category scheme="http://www.blogger.com/atom/ns#" term="JSON"/><category scheme="http://www.blogger.com/atom/ns#" term="Logic App"/><category scheme="http://www.blogger.com/atom/ns#" term="XML"/><title type='text'>Azure Logic App Integration : Transform XML to JSON</title><content type='html'>&lt;p&gt;In Enterprise Integration or iPaaS, a scenario that often comes up is to convert a XML payload to Json. You might be receiving XML data from one system but needs to convert that to JSON before pushing it to another system. If both the source and destination systems understands same language then it&#39;s OK but that is not always the case. &lt;b&gt;So, there&#39;s a challenge&lt;/b&gt;.&lt;/p&gt;&lt;p&gt;Azure Logic App has some cool power and we will try to leverage on such in our integration scenario. Here our legacy &lt;b&gt;source&lt;/b&gt; system can only send XML data but our&amp;nbsp;&lt;b&gt;destination&lt;/b&gt; system only understands JSON.&amp;nbsp;&lt;/p&gt;&lt;h3&gt;&lt;strong&gt;Prerequisites&lt;/strong&gt;:&lt;/h3&gt;&lt;ul&gt; 
   &lt;li&gt;Azure Subscription (Free subscription will also do)&lt;/li&gt;&lt;li&gt;Basic XML, XSLT understanding&lt;/li&gt; 
   &lt;li&gt;Basic JSON understanding&lt;/li&gt; 
   &lt;li&gt;Azure Logic App basic Request/Response understanding&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;strong&gt;Let&#39;s get Started&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Create a simple xml document (&lt;b&gt;Vendor.xml&lt;/b&gt;). This is the payload our source system will send.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: &amp;quot;Andale Mono&amp;quot;, &amp;quot;Lucida Console&amp;quot;, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;
&amp;lt;Vendor&amp;gt;
   &amp;lt;VendorNumber&amp;gt;VND1&amp;lt;/VendorNumber&amp;gt;
   &amp;lt;VendorName&amp;gt;My Vendor&amp;lt;/VendorName&amp;gt;
   &amp;lt;GroupId&amp;gt;10&amp;lt;/GroupId&amp;gt;
   &amp;lt;Company&amp;gt;USRT&amp;lt;/Company&amp;gt;
   &amp;lt;VendorCity&amp;gt;My City&amp;lt;/VendorCity&amp;gt;
   &amp;lt;VendorContactPhone&amp;gt;1234567890&amp;lt;/VendorContactPhone&amp;gt;
   &amp;lt;VendorContactEmail&amp;gt;myvendor@vendoremail.com&amp;lt;/VendorContactEmail&amp;gt;&lt;br /&gt;   &amp;lt;VendorCountryRgn&amp;gt;USA&amp;lt;/VendorCountryRgn&amp;gt;
&amp;lt;/Vendor&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;But our destination system only understands JSON. Now we need to transform the above XML into JSON keeping all other information intact. So after transformation the data should look like this&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: &amp;quot;Andale Mono&amp;quot;, &amp;quot;Lucida Console&amp;quot;, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;{
   &quot;VendorNumber&quot;:&quot;VND1&quot;,
   &quot;VendorName&quot;:&quot;My Vendor&quot;,
   &quot;Company&quot;:&quot;USRT&quot;,
   &quot;VendorCity&quot;:&quot;My City&quot;,
   &quot;VendorContactPhone&quot;:&quot;1234567890&quot;,
   &quot;VendorContactEmail&quot;:&quot;myvendor@vendoremail.com&quot;,
   &quot;VendorCountryRgn&quot;:&quot;USA&quot;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Looks simple! but not that simple in Logic App. There&#39;s a few marketplace connectors available but that won&#39;t help much when it comes to customization and also they not free and has licensing and pricing model complexities. So why to go that route when we have a free yet powerful friend in hand which can do this task quite comfortably and also is a first class citizen in Azure Logic App. XSLT Transformation.&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;Here goes our &lt;b&gt;Vendor.xsl&lt;/b&gt; document. Save it in your machine as you would need this later. It&#39;s quite simple and self-explanatory. XSLT has immense power and hence you can understand what level of control you will have in handling XML complexities.&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: &amp;quot;Andale Mono&amp;quot;, &amp;quot;Lucida Console&amp;quot;, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;

&amp;lt;xsl:stylesheet version=&quot;1.0&quot; xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;&amp;gt;
&amp;lt;xsl:output omit-xml-declaration=&quot;yes&quot; method=&quot;text&quot; media-type=&quot;application/json&quot;/&amp;gt;
    &amp;lt;xsl:template match=&quot;/&quot;&amp;gt;
        &amp;lt;xsl:text&amp;gt;{ &amp;lt;/xsl:text&amp;gt;
        
        &amp;lt;xsl:text&amp;gt;&quot;VendorNumber&quot; : &quot;&amp;lt;/xsl:text&amp;gt;
        &amp;lt;xsl:value-of select=&quot;Vendor/VendorNumber&quot;/&amp;gt;
        &amp;lt;xsl:text&amp;gt;&quot;, &amp;lt;/xsl:text&amp;gt;
        
        &amp;lt;xsl:text&amp;gt;&quot;VendorName&quot; : &quot;&amp;lt;/xsl:text&amp;gt;
        &amp;lt;xsl:value-of select=&quot;Vendor/VendorName&quot;/&amp;gt;
        &amp;lt;xsl:text&amp;gt;&quot;, &amp;lt;/xsl:text&amp;gt;
        
        &amp;lt;xsl:text&amp;gt;&quot;Company&quot; : &quot;&amp;lt;/xsl:text&amp;gt;
        &amp;lt;xsl:value-of select=&quot;Vendor/Company&quot;/&amp;gt;
        &amp;lt;xsl:text&amp;gt;&quot;, &amp;lt;/xsl:text&amp;gt;
        
        &amp;lt;xsl:text&amp;gt;&quot;VendorCity&quot; : &quot;&amp;lt;/xsl:text&amp;gt;
        &amp;lt;xsl:value-of select=&quot;Vendor/VendorCity&quot;/&amp;gt;
        &amp;lt;xsl:text&amp;gt;&quot;, &amp;lt;/xsl:text&amp;gt;
        
        &amp;lt;xsl:text&amp;gt;&quot;VendorContactPhone&quot; : &quot;&amp;lt;/xsl:text&amp;gt;
        &amp;lt;xsl:value-of select=&quot;Vendor/VendorContactPhone&quot;/&amp;gt;
        &amp;lt;xsl:text&amp;gt;&quot;, &amp;lt;/xsl:text&amp;gt;
        
        &amp;lt;xsl:text&amp;gt;&quot;VendorContactEmail&quot; : &quot;&amp;lt;/xsl:text&amp;gt;
        &amp;lt;xsl:value-of select=&quot;Vendor/VendorContactEmail&quot;/&amp;gt;
        &amp;lt;xsl:text&amp;gt;&quot;, &amp;lt;/xsl:text&amp;gt;
        
        &amp;lt;xsl:text&amp;gt;&quot;VendorCountryRgn&quot; : &quot;&amp;lt;/xsl:text&amp;gt;
        &amp;lt;xsl:value-of select=&quot;Vendor/VendorCountryRgn&quot;/&amp;gt;
        &amp;lt;xsl:text&amp;gt;&quot; &amp;lt;/xsl:text&amp;gt;
        
        &amp;lt;xsl:text&amp;gt; }&amp;lt;/xsl:text&amp;gt;
    &amp;lt;/xsl:template&amp;gt;
&amp;lt;/xsl:stylesheet&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;We are done with our basic ground work. Now it&#39;s time to step into Azure. 😃&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://portal.azure.com/&quot; rel=&quot;nofollow noopener&quot; target=&quot;_blank&quot;&gt;Login &lt;/a&gt;to Azure portal&amp;nbsp;&lt;/li&gt;&lt;li&gt;We cannot apply this XSLT file straightway on our input XML in Logic App. For that we need to create an &quot;integration accounts&quot;. Let&#39;s do that. Search for integration in the Azure search bar and select.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1EwAeXGOHvImcBCQCqcEoOq9_cvbHul_yMTiNaIqVnyQCAYKk41z8nlhIT8GZxG1K-18BnobHY0bOq-95OJmCT-i10UFcyKskqtL6FVZrgjbUZWKP4ZQWQehkBmQFMIR43Ldgkq2nM84/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;309&quot; data-original-width=&quot;756&quot; height=&quot;262&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1EwAeXGOHvImcBCQCqcEoOq9_cvbHul_yMTiNaIqVnyQCAYKk41z8nlhIT8GZxG1K-18BnobHY0bOq-95OJmCT-i10UFcyKskqtL6FVZrgjbUZWKP4ZQWQehkBmQFMIR43Ldgkq2nM84/w640-h262/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Click +Add at the top and fill up the necessary details as per your choice. Create the account.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjO1BmaTfpSvNj5VlCXjAuDSFfh57mEtWsgcd9OzIewM8GahuOyYmvYhySkuMatq83g1fnMV5zqDA1qVh12vvruiognY_yviS34iKKFgiTNclRCDUBJgBJ3M2rZDYYgD2jpIdRd_-7fX9c/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;700&quot; data-original-width=&quot;879&quot; height=&quot;510&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjO1BmaTfpSvNj5VlCXjAuDSFfh57mEtWsgcd9OzIewM8GahuOyYmvYhySkuMatq83g1fnMV5zqDA1qVh12vvruiognY_yviS34iKKFgiTNclRCDUBJgBJ3M2rZDYYgD2jpIdRd_-7fX9c/w640-h510/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Once the integration account is created it will take you to the following landing page. There are lots of components available but for the sake of simplicity I won&#39;t go into those as it&#39;s not required for your case. It&#39;s required for typical B2B scenarios and if you are keep to learn then Azure has good documentation around it.&amp;nbsp; Here we&amp;nbsp;only need the&amp;nbsp;&lt;b&gt;Maps&lt;/b&gt;&amp;nbsp;component.&amp;nbsp;So click on that.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCv3eskaKXGdfnNCYzqvx9BwDyhQhtcM8Fr0GE9AGk-uLu-YqoL5jgyJ-fI18a9A9IotCkysFbQkWY_ciwyMnmzOmhHBvpeUIKJI2VaUd1rNW83e4okGdcw4_3aLSJa8XyHlbpJvfjaRw/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;710&quot; data-original-width=&quot;1885&quot; height=&quot;242&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCv3eskaKXGdfnNCYzqvx9BwDyhQhtcM8Fr0GE9AGk-uLu-YqoL5jgyJ-fI18a9A9IotCkysFbQkWY_ciwyMnmzOmhHBvpeUIKJI2VaUd1rNW83e4okGdcw4_3aLSJa8XyHlbpJvfjaRw/w640-h242/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Click +Add at the top and upload your Vendor.xsl file. This is the XSLT file we have created earlier. Click OK&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhf2YZrJfs8_rM-5FCpRQH2s2OG1AZz8-yMosrQBZ0XcVmkPg-DCIV5vsJo-oqFHrnbngHftnxuiQC3eOCbB8oGqmNtUyzVtoR4KA6OkqGwHDK-NMbVilGY7y8yxLq-ARNc4Ek8e7kSP3w/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;422&quot; data-original-width=&quot;814&quot; height=&quot;332&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhf2YZrJfs8_rM-5FCpRQH2s2OG1AZz8-yMosrQBZ0XcVmkPg-DCIV5vsJo-oqFHrnbngHftnxuiQC3eOCbB8oGqmNtUyzVtoR4KA6OkqGwHDK-NMbVilGY7y8yxLq-ARNc4Ek8e7kSP3w/w640-h332/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Great. Now let create the logic app for some real action. Search for Logic App in the Azure search bar and select.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijniaoiM9nMLXT2Yt4otg06R4od29XZ-8cqYsSZPWLrwSWTtJZS0CTW4KZqwsbqUgyIJg5DQCNLiwJE_41s2fdCls8XfCwFFYHd7pw_uPSMOCJfhjW50B1WGyzynTlE6P291OiMtwxjWw/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;281&quot; data-original-width=&quot;828&quot; height=&quot;218&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijniaoiM9nMLXT2Yt4otg06R4od29XZ-8cqYsSZPWLrwSWTtJZS0CTW4KZqwsbqUgyIJg5DQCNLiwJE_41s2fdCls8XfCwFFYHd7pw_uPSMOCJfhjW50B1WGyzynTlE6P291OiMtwxjWw/w640-h218/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Click +Add at the top and fill up the following details as per your choice. &lt;b&gt;One important point to remember here&lt;/b&gt;. Make sure your logic app location is same as your integration account location. This is a requirement. Create your logic app.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_wc9Aoh1OYa2pUHwcAMelZYMciIkfZq14FQUJHR2MlchgUMmTvoXcgoG4vL3FBbLUDEfGi1wN7O0dGC0FKqdRUSLxp_CHX2lTA2_3pLlgODwFK8pQi7ZPMnFXDu7gAvsAGFXpfK0aeXM/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;702&quot; data-original-width=&quot;878&quot; height=&quot;512&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_wc9Aoh1OYa2pUHwcAMelZYMciIkfZq14FQUJHR2MlchgUMmTvoXcgoG4vL3FBbLUDEfGi1wN7O0dGC0FKqdRUSLxp_CHX2lTA2_3pLlgODwFK8pQi7ZPMnFXDu7gAvsAGFXpfK0aeXM/w640-h512/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Now the most important part. We need to tell the Logic App to use the integration account so that it could pick up the XSLT transformation map from there. Go to the Settings&amp;gt;&amp;gt;Workflow Settings and map your integration account. Click Save&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyqO_Xb9zFHKw1ksVHBZUdk9Qo94ZW4KBt5LCZ4bM6gl0_klZgRt9yKA5LS9OWYz4zIQo_jIUZ1Srdz_I0FTOF06g7_xfaDrnuO5e9rCPPgK29JW7_LjWwFPJjRZgaqKXCzORYIEjcdDM/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;727&quot; data-original-width=&quot;917&quot; height=&quot;507&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyqO_Xb9zFHKw1ksVHBZUdk9Qo94ZW4KBt5LCZ4bM6gl0_klZgRt9yKA5LS9OWYz4zIQo_jIUZ1Srdz_I0FTOF06g7_xfaDrnuO5e9rCPPgK29JW7_LjWwFPJjRZgaqKXCzORYIEjcdDM/w640-h507/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Click Logic App designer under Development Tools and choose &quot;When a HTTP request is received&quot; trigger from the list of common triggers&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQq0qjnmyF4OaJCZwH8rZQ93tdq6KLOYizmlUqNAYy1B-tVRYbER4LW-_5tn-Hxpbd48Rjy-Y9DJnvJlmX5aYskB2o52R8VHs25yDABo0lFh4ikyWuFBx4Ri2q3MeoTWFqdqfYwloLJLU/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;552&quot; data-original-width=&quot;1098&quot; height=&quot;322&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQq0qjnmyF4OaJCZwH8rZQ93tdq6KLOYizmlUqNAYy1B-tVRYbER4LW-_5tn-Hxpbd48Rjy-Y9DJnvJlmX5aYskB2o52R8VHs25yDABo0lFh4ikyWuFBx4Ri2q3MeoTWFqdqfYwloLJLU/w640-h322/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;This will take you to the logic app workflow designer with the above trigger as the first element in the workflow. Do nothing here and click the &quot;Next Step&quot;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8_6FVZGxzsdPz7a0TPpJuUYrH8rY4JjYAEPi533x-VyzLhGQ-kONHpyQk7AONs6hkGJjAIc5BRmemIq8E3CFAIfZmvKVJ2WiA-O5Wg1kMohQQGokkze0C6JhCj5S_G-USG__r35MFbvU/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;708&quot; data-original-width=&quot;1583&quot; height=&quot;286&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8_6FVZGxzsdPz7a0TPpJuUYrH8rY4JjYAEPi533x-VyzLhGQ-kONHpyQk7AONs6hkGJjAIc5BRmemIq8E3CFAIfZmvKVJ2WiA-O5Wg1kMohQQGokkze0C6JhCj5S_G-USG__r35MFbvU/w640-h286/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Search for &quot;Transform XML&quot; and select Transform XML from the list of actions.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1d0V2vsfZjCWAAOVaU0NmkT9x1uvPGEVtHTJ4no1MVk5mt2AQ5m4mgXiByy-ofUv3cvnm0OkOSXwRaKjDEpCbOZuwVPWUsr5NayTuoDAMDrxf2AIS_UDFGjoyy0GOjfDy6MfiuyK0nXM/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;604&quot; data-original-width=&quot;662&quot; height=&quot;584&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1d0V2vsfZjCWAAOVaU0NmkT9x1uvPGEVtHTJ4no1MVk5mt2AQ5m4mgXiByy-ofUv3cvnm0OkOSXwRaKjDEpCbOZuwVPWUsr5NayTuoDAMDrxf2AIS_UDFGjoyy0GOjfDy6MfiuyK0nXM/w640-h584/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;For Contents, select the Body from the Dynamic content list. The is the http request body which we are going to send as an XML payload later.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHs-xupcfPTw5jBhr26NHGpwgLTpGWs_ByJeylv7jtKHvMWZ9YDqZbMCJAyTJ4GxBkB3g4aaiJAYZ9YewcnklD9bZCDN9fFBvG5DiVMlW_ak37aLu3GRyzv6J-PshAD9_Lx_CyfcHsL2E/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;540&quot; data-original-width=&quot;1250&quot; height=&quot;276&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHs-xupcfPTw5jBhr26NHGpwgLTpGWs_ByJeylv7jtKHvMWZ9YDqZbMCJAyTJ4GxBkB3g4aaiJAYZ9YewcnklD9bZCDN9fFBvG5DiVMlW_ak37aLu3GRyzv6J-PshAD9_Lx_CyfcHsL2E/w640-h276/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Choose the XSLT map from the &quot;Map&quot; dropdown. This is coming from your integration account where we have uploaded the Vendor.xsl file.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2PE7uEazCP9KxTu0o42SUBGX-MvqXlcufKAODeLdQCi1OU9ocLa6iTekqYTR1k2NsnXWcaJxdWNDyvk0zux_ztqetCif2c4XQ9sLVj6xn0CzFRw5he99RlQ6WLznExXIJN6wv4aNr7Sc/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;250&quot; data-original-width=&quot;848&quot; height=&quot;188&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2PE7uEazCP9KxTu0o42SUBGX-MvqXlcufKAODeLdQCi1OU9ocLa6iTekqYTR1k2NsnXWcaJxdWNDyvk0zux_ztqetCif2c4XQ9sLVj6xn0CzFRw5he99RlQ6WLznExXIJN6wv4aNr7Sc/w640-h188/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Now select the Add new parameter dropdown and select &quot;Transform options&quot; and the value as &quot;Apply XSLT output attributes&quot;. &lt;b&gt;This is very important &lt;/b&gt;else you will get a runtime error &lt;i&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&quot;Code&quot;: &quot;InvalidXsltContent&quot;, &quot;Message&quot;: &quot;An error occurred while processing map. &#39;Token Text in state Start would result in an invalid XML document. Make sure that the ConformanceLevel setting is set to ConformanceLevel.Fragment or ConformanceLevel.Auto if you want to write an XML fragment. &quot;&lt;/span&gt;&lt;/i&gt;.&amp;nbsp; This is to just to inform the runtime to use the output format as defined in the XSLT file which in our case is application/json.&amp;nbsp;&lt;b&gt;So, make sure you do not miss this step 👍&lt;/b&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGoNJwSpCyHb4EdqzLZHZjLaT2Pxq51bU5hU92gyTccYQzybwMFTwtXsu0CM-Ma8zxGS4gJIZFc2-BGVcdKiPuFgPSRJ22zY0E4IHmCxPy-FikujnwV_Sfu4f3AVd6JILhrxNH_LKj1Ic/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;387&quot; data-original-width=&quot;814&quot; height=&quot;304&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGoNJwSpCyHb4EdqzLZHZjLaT2Pxq51bU5hU92gyTccYQzybwMFTwtXsu0CM-Ma8zxGS4gJIZFc2-BGVcdKiPuFgPSRJ22zY0E4IHmCxPy-FikujnwV_Sfu4f3AVd6JILhrxNH_LKj1Ic/w640-h304/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Now we do not have any real source and destination system for this demo. So, we would return back the transformed JSON to the caller to simulate the XML to JSON conversion. Click on &quot;+New Step&quot;, search for &quot;Response&quot; and select the Response Action&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqD_ZToWaaPEb9HNZo7AtQdXrsOocZNQU1ocBR_EHu7b2mxxk0vdWaToLfHl6FCPvgI_0ybfXNHizKsxM3topQjkjbZUYPhuI-NcUbClIYQNS3oYIV6vN7gymggrg0IuadXUo3lZbWh7E/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;558&quot; data-original-width=&quot;750&quot; height=&quot;476&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqD_ZToWaaPEb9HNZo7AtQdXrsOocZNQU1ocBR_EHu7b2mxxk0vdWaToLfHl6FCPvgI_0ybfXNHizKsxM3topQjkjbZUYPhuI-NcUbClIYQNS3oYIV6vN7gymggrg0IuadXUo3lZbWh7E/w640-h476/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Select the &quot;Transformed XML&quot; from the Dynamic content selection window&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhi31MjfkCB9rti6dY-LVfJciRfmpejGp3-v0kueW0zvlCvDRx_KxP_laBC9LK2_TlUcXErXNSFJMzLqRe5rsK95I3K6ZHn0VpNPPpDdrvOYmpFMKE3XQPkhMGUaHfCO8J5kJdycY5Ay0s/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;533&quot; data-original-width=&quot;1187&quot; height=&quot;288&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhi31MjfkCB9rti6dY-LVfJciRfmpejGp3-v0kueW0zvlCvDRx_KxP_laBC9LK2_TlUcXErXNSFJMzLqRe5rsK95I3K6ZHn0VpNPPpDdrvOYmpFMKE3XQPkhMGUaHfCO8J5kJdycY5Ay0s/w640-h288/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;So, we have 3 steps in the workflow. Save the Logic app. This will generate the HTTP endpoint for us to test. Copy the HTTP POST URL endpoint and open any rest client of your choice. My favorite is &lt;b&gt;Postman&lt;/b&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1W1_riDcmTJvZI8jCl0in57qVk8skHcYMEqVk0pspFkLAP2u4IhQhkcl0cxnbYeWSfSW6bRBdhGaT_y7SLJJoBpXczsjByQ50vMjt7hyRl5LK6Xa4maLyIASDyyNJaaQRTojTtctJgBY/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;636&quot; data-original-width=&quot;1206&quot; height=&quot;338&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1W1_riDcmTJvZI8jCl0in57qVk8skHcYMEqVk0pspFkLAP2u4IhQhkcl0cxnbYeWSfSW6bRBdhGaT_y7SLJJoBpXczsjByQ50vMjt7hyRl5LK6Xa4maLyIASDyyNJaaQRTojTtctJgBY/w640-h338/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Paste the url endpoint to make a POST call. In the body copy-paste the XML data from the Vendor.xml file we have created previously. Hit Send and Voila!! We are successfully getting back JSON response by sending XML request. Isn&#39;t that great stuff😚&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4inF1WpvUvM0P8tdAMRzDgwFNnZIqy1t584yoLyLpiNZF043F3B2qQMEZzeg2qnuZ5pqPw_dxXw0Tob9uRB5oRX7806r4t0tHE7l0X0dxy-OODTzz9rh7u4LSF3y_WWlb8XSP5hCNQvA/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;780&quot; data-original-width=&quot;1611&quot; height=&quot;310&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4inF1WpvUvM0P8tdAMRzDgwFNnZIqy1t584yoLyLpiNZF043F3B2qQMEZzeg2qnuZ5pqPw_dxXw0Tob9uRB5oRX7806r4t0tHE7l0X0dxy-OODTzz9rh7u4LSF3y_WWlb8XSP5hCNQvA/w640-h310/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;Great Job and&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: orange;&quot;&gt;Congratulations&lt;/span&gt;&lt;/b&gt;! for coming this far. Hope this article will help you to further explore more on this feature.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Do share with me about your experience and what you have built upon this
 foundation. You can take it upto any level and integrate. I would love 
to hear from you.&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techiemate.blogspot.com/feeds/8189004475132364442/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techiemate.blogspot.com/2020/09/azure-logic-app-integration-transform.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/8189004475132364442'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/8189004475132364442'/><link rel='alternate' type='text/html' href='http://techiemate.blogspot.com/2020/09/azure-logic-app-integration-transform.html' title='Azure Logic App Integration : Transform XML to JSON'/><author><name>Atanu Gupta</name><uri>http://www.blogger.com/profile/05529718294081550882</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_LZ_SzyDY_u8HW4LiUYlsEJKSSMR5zYs-ow0dK7kjPtYVYnB_nHhGXM3Ad8Gt9AxMhbi0UO3mSjuYBQq2Sli5kUe05z21o-xTJYAM-Pw6TErhMe4ITlrqdadJSCp_xYQS1rf5k8diG7IlmVmai1fllCvN7o9A8b0JSaV5Gn6SCwv5zw/s220/1714907742840.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1EwAeXGOHvImcBCQCqcEoOq9_cvbHul_yMTiNaIqVnyQCAYKk41z8nlhIT8GZxG1K-18BnobHY0bOq-95OJmCT-i10UFcyKskqtL6FVZrgjbUZWKP4ZQWQehkBmQFMIR43Ldgkq2nM84/s72-w640-h262-c/image.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6011381329995167460.post-8690194249655994513</id><published>2020-09-07T18:02:00.000+05:30</published><updated>2020-12-15T11:37:03.602+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="ARM Template"/><category scheme="http://www.blogger.com/atom/ns#" term="Automation"/><category scheme="http://www.blogger.com/atom/ns#" term="Azure"/><category scheme="http://www.blogger.com/atom/ns#" term="DevOps"/><title type='text'>Creating ARM Templates with Azure Resource Group Project</title><content type='html'>&lt;p&gt;Automation is the buzzword nowadays and when it comes to Cloud, it 
becomes more inevitable. Creating various Azure resources and then 
logically grouping them inside a Resource group is a very common task we
 perform while working in Azure. We can go ahead and hit the Azure 
portal and create all the necessary resources by simple clicks and set 
up the environment in no time and get things running. Cool!&lt;/p&gt; 
  &lt;p&gt;This may be good and acceptable for your development environment. 
What about other environments such as QA,Staging or even Production. Is 
it feasible to repeat the same task over and over again in each 
environment and create the exact same stuff. What about human error. 
Manual processes are largely error prone and a slight hiccup could lead 
to a big costly mistake. Moreover you might not have permission to all 
the environments and the same you might forget the exact resource 
configurations few months down the line. So, in short there&#39;s hell lot 
of things that can go wrong if things are manual.&lt;/p&gt; 
  &lt;p&gt;&lt;strong&gt;Hence Automation&lt;/strong&gt;. In this article I will walk you 
through the steps of creating a simple ARM template containing an Azure 
Storage resource in VS-2017 solution and then deploying the same with 
the help of PowerShell to Azure Cloud. Hope you all would enjoy the 
journey!&lt;/p&gt; 
  &lt;p&gt;&lt;em&gt;Please note that I have purposefully left out some complex 
areas or haven’t deep dived into details at some places. This is just to
 make this article an easy read and help as a quick guide from where to 
start in creating and deploying ARM templates&lt;/em&gt;&lt;/p&gt; 
  &lt;h3&gt;&lt;strong&gt;Prerequisites&lt;/strong&gt;:&lt;/h3&gt; 
  &lt;ul&gt; 
   &lt;li&gt;Microsoft Visual Studio 2017 with Azure SDK installed.&lt;/li&gt; 
   &lt;li&gt;Azure Subscription (Free subscription of 30 days will also do)&lt;/li&gt; 
   &lt;li&gt;Basic JSON understanding&lt;/li&gt; 
   &lt;li&gt;Windows PowerShell (Command Line or ISE)&lt;/li&gt; 
  &lt;/ul&gt; 
  &lt;p&gt;&lt;strong&gt;Let&#39;s get Started&lt;/strong&gt;&lt;/p&gt; 
  &lt;ul&gt; 
   &lt;li&gt;Fire up your Visual Studio 2017&lt;/li&gt; 
   &lt;li&gt;File &amp;gt; New &amp;gt; Project. Click on &quot;Cloud&quot; in the left panel 
and then select &quot;Azure Resource Group&quot; project type. Give the project 
name, location as per your choice. Click &lt;strong&gt;OK&lt;/strong&gt;&lt;/li&gt; 
  &lt;/ul&gt; 
  &lt;div class=&quot;slate-resizable-image-embed slate-image-embed__resize-full-width&quot;&gt; 
   &lt;img alt=&quot;No alt text provided for this image&quot; data-li-src=&quot;https://media-exp1.licdn.com/dms/image/C5112AQGuG2dJ3u63oA/article-inline_image-shrink_1000_1488/0?e=1605139200&amp;amp;v=beta&amp;amp;t=8JS8LM5rINAPUB9nbh1IoZ-rw1J-GqWSIJ0iK8m5IU0&quot; data-media-urn=&quot;&quot; height=&quot;371&quot; src=&quot;https://media-exp1.licdn.com/dms/image/C5112AQGuG2dJ3u63oA/article-inline_image-shrink_1000_1488/0?e=1605139200&amp;amp;v=beta&amp;amp;t=8JS8LM5rINAPUB9nbh1IoZ-rw1J-GqWSIJ0iK8m5IU0&quot; width=&quot;640&quot; /&gt; 
  &lt;/div&gt; 
  &lt;ul&gt; 
   &lt;li&gt;Select &quot;Blank Template&quot; from the list of templates as of now. We will add resources later. Click &lt;strong&gt;OK&lt;/strong&gt;&lt;/li&gt; 
  &lt;/ul&gt; 
  &lt;div class=&quot;slate-resizable-image-embed slate-image-embed__resize-full-width&quot;&gt; 
   &lt;img alt=&quot;No alt text provided for this image&quot; data-li-src=&quot;https://media-exp1.licdn.com/dms/image/C5112AQEL0SuILpub2g/article-inline_image-shrink_1000_1488/0?e=1605139200&amp;amp;v=beta&amp;amp;t=CSkAHsMF5-sL55u5jrLNm4azWnzt84D18p_DclnQXi0&quot; data-media-urn=&quot;&quot; height=&quot;541&quot; src=&quot;https://media-exp1.licdn.com/dms/image/C5112AQEL0SuILpub2g/article-inline_image-shrink_1000_1488/0?e=1605139200&amp;amp;v=beta&amp;amp;t=CSkAHsMF5-sL55u5jrLNm4azWnzt84D18p_DclnQXi0&quot; width=&quot;640&quot; /&gt; 
  &lt;/div&gt; 
  &lt;ul&gt; 
   &lt;li&gt;A Resource Group project will be created as below.&lt;/li&gt; 
  &lt;/ul&gt; 
  &lt;div class=&quot;slate-resizable-image-embed slate-image-embed__resize-full-width&quot;&gt; 
   &lt;img alt=&quot;Solution Explorer&quot; data-li-src=&quot;https://media-exp1.licdn.com/dms/image/C5112AQEZ8Exdr9cD7A/article-inline_image-shrink_1000_1488/0?e=1605139200&amp;amp;v=beta&amp;amp;t=B3veES2pFffs5XxrDXa6NOaJgdK-Fdx4UfubH9Ic4qI&quot; data-media-urn=&quot;&quot; height=&quot;238&quot; src=&quot;https://media-exp1.licdn.com/dms/image/C5112AQEZ8Exdr9cD7A/article-inline_image-shrink_1000_1488/0?e=1605139200&amp;amp;v=beta&amp;amp;t=B3veES2pFffs5XxrDXa6NOaJgdK-Fdx4UfubH9Ic4qI&quot; width=&quot;640&quot; /&gt; 
  &lt;/div&gt; 
  &lt;p&gt;The main entry point is the &lt;strong&gt;azuredeploy.json&lt;/strong&gt;. This is where we will create all the resources along with its respective configurations. Next is &lt;strong&gt;azuredeploy.parameters.json&lt;/strong&gt;
 which is basically used to override any parameter that is defined in 
the azuredeploy.json file. Anything that needs to be customized on a per
 item basis should be placed here.&lt;strong&gt; Deploy-AzureResourceGroup.ps1&lt;/strong&gt; is the powershell script require to deploy the resources.&lt;/p&gt; 
  &lt;p&gt;We will only make use the azuredeploy.json in this demo and perform
 the other two steps a bit differently so to avoid any complexity and 
help in easy understanding.&lt;/p&gt; 
  &lt;ul&gt; 
   &lt;li&gt;Double-Click on the azuredeploy.json file to open the code window.&lt;/li&gt; 
  &lt;/ul&gt; 
  &lt;div class=&quot;slate-resizable-image-embed slate-image-embed__resize-full-width&quot;&gt; 
   &lt;img alt=&quot;No alt text provided for this image&quot; data-li-src=&quot;https://media-exp1.licdn.com/dms/image/C5112AQHNC-H-uAyD_Q/article-inline_image-shrink_1000_1488/0?e=1605139200&amp;amp;v=beta&amp;amp;t=xeJrb-z5nC257UChej_yTs-z0Ms_BPVQH6PKOAbmjCY&quot; data-media-urn=&quot;&quot; height=&quot;142&quot; src=&quot;https://media-exp1.licdn.com/dms/image/C5112AQHNC-H-uAyD_Q/article-inline_image-shrink_1000_1488/0?e=1605139200&amp;amp;v=beta&amp;amp;t=xeJrb-z5nC257UChej_yTs-z0Ms_BPVQH6PKOAbmjCY&quot; width=&quot;640&quot; /&gt; 
  &lt;/div&gt; 
  &lt;p&gt;There are four main sections in the json file.&lt;/p&gt; 
  &lt;p&gt;&lt;strong&gt;parameters &lt;/strong&gt;: Here we will define all the 
parameters respective to a resource in key-value pair instead of 
hard-coding in the resource body. &lt;/p&gt; 
  &lt;p&gt;&lt;strong&gt;variables &lt;/strong&gt;: &lt;em&gt;This is optional&lt;/em&gt;. These are 
piece of information which the ARM template can work out on the fly. 
Specially used to deploy similar resources in different environments.&lt;/p&gt; 
  &lt;p&gt;&lt;strong&gt;resources &lt;/strong&gt;: All resource code blocks will go into this section following the same structure and pattern.&lt;/p&gt; 
  &lt;p&gt;&lt;strong&gt;outputs &lt;/strong&gt;: &lt;em&gt;This is optional&lt;/em&gt;. Used when 
linking other ARM template with the master template or infact creating 
linked templates. Will not use this in this demo.&lt;/p&gt; 
  &lt;ul&gt; 
   &lt;li&gt;Once you opened the code view of the azuredeploy.json file, 
VS-2017 will automatically open a JSON Outline window for powerful 
navigation purpose. &lt;/li&gt; 
  &lt;/ul&gt; 
  &lt;div class=&quot;slate-resizable-image-embed slate-image-embed__resize-full-width&quot;&gt; 
   &lt;img alt=&quot;No alt text provided for this image&quot; data-li-src=&quot;https://media-exp1.licdn.com/dms/image/C5112AQFlUw_NJxHquw/article-inline_image-shrink_1000_1488/0?e=1605139200&amp;amp;v=beta&amp;amp;t=GIP7H8KIdGrDt21iDoANMs_iV9JFXHZ22G4MBI9NMBQ&quot; data-media-urn=&quot;&quot; height=&quot;224&quot; src=&quot;https://media-exp1.licdn.com/dms/image/C5112AQFlUw_NJxHquw/article-inline_image-shrink_1000_1488/0?e=1605139200&amp;amp;v=beta&amp;amp;t=GIP7H8KIdGrDt21iDoANMs_iV9JFXHZ22G4MBI9NMBQ&quot; width=&quot;640&quot; /&gt; 
  &lt;/div&gt; 
  &lt;p&gt;If you do not see this windows then goto View &amp;gt; Other Windows &amp;gt; JSON Outline&lt;/p&gt; 
  &lt;ul&gt; 
   &lt;li&gt;Now our target is to create a Azure Storage resource here. Right 
click on resource section inside the JSON Outline window and select &quot;Add
 New Resource&quot;&lt;/li&gt; 
  &lt;/ul&gt; 
  &lt;div class=&quot;slate-resizable-image-embed slate-image-embed__resize-full-width&quot;&gt; 
   &lt;img alt=&quot;No alt text provided for this image&quot; data-li-src=&quot;https://media-exp1.licdn.com/dms/image/C5112AQGpJCt2-4Vp7g/article-inline_image-shrink_1000_1488/0?e=1605139200&amp;amp;v=beta&amp;amp;t=Ka5kjKsl9LhAoMlCgoybVeFjM33PRXnoV8RL8S1pLbk&quot; data-media-urn=&quot;&quot; height=&quot;220&quot; src=&quot;https://media-exp1.licdn.com/dms/image/C5112AQGpJCt2-4Vp7g/article-inline_image-shrink_1000_1488/0?e=1605139200&amp;amp;v=beta&amp;amp;t=Ka5kjKsl9LhAoMlCgoybVeFjM33PRXnoV8RL8S1pLbk&quot; width=&quot;640&quot; /&gt; 
  &lt;/div&gt; 
  &lt;ul&gt; 
   &lt;li&gt;Scroll down to find the &quot;Storage Account&quot; resource. Give it a name of your choice. I gave &lt;strong&gt;demoStorage &lt;/strong&gt;but it can be any name. Click &quot;Add&quot;&lt;/li&gt; 
  &lt;/ul&gt; 
  &lt;div class=&quot;slate-resizable-image-embed slate-image-embed__resize-full-width&quot;&gt; 
   &lt;img alt=&quot;No alt text provided for this image&quot; data-li-src=&quot;https://media-exp1.licdn.com/dms/image/C5112AQEMNGIV_etqMQ/article-inline_image-shrink_1000_1488/0?e=1605139200&amp;amp;v=beta&amp;amp;t=eTaIzhGF9t1kAVXMrfp6cHBqCVnVP38VrOC6zgLzrwE&quot; data-media-urn=&quot;&quot; height=&quot;483&quot; src=&quot;https://media-exp1.licdn.com/dms/image/C5112AQEMNGIV_etqMQ/article-inline_image-shrink_1000_1488/0?e=1605139200&amp;amp;v=beta&amp;amp;t=eTaIzhGF9t1kAVXMrfp6cHBqCVnVP38VrOC6zgLzrwE&quot; width=&quot;640&quot; /&gt; 
  &lt;/div&gt; 
  &lt;ul&gt; 
   &lt;li&gt;Visual Studio will add all the necessary boilerplate code 
required for this resource type and will populate all the required 
sections of the ARM template with some default values.&lt;/li&gt; 
  &lt;/ul&gt; 
  &lt;div class=&quot;slate-resizable-image-embed slate-image-embed__resize-full-width&quot;&gt; 
   &lt;img alt=&quot;No alt text provided for this image&quot; data-li-src=&quot;https://media-exp1.licdn.com/dms/image/C5112AQEDyfsAiRSBAA/article-inline_image-shrink_1000_1488/0?e=1605139200&amp;amp;v=beta&amp;amp;t=Jl42bINboazFZrAy3sxj_umxfsiczNdq1xCQvST_hjk&quot; data-media-urn=&quot;&quot; height=&quot;343&quot; src=&quot;https://media-exp1.licdn.com/dms/image/C5112AQEDyfsAiRSBAA/article-inline_image-shrink_1000_1488/0?e=1605139200&amp;amp;v=beta&amp;amp;t=Jl42bINboazFZrAy3sxj_umxfsiczNdq1xCQvST_hjk&quot; width=&quot;640&quot; /&gt; 
  &lt;/div&gt; 
  &lt;ul&gt; 
   &lt;li&gt;Now lets do some minor modifications. The Storage name should be 
unique like any other Azure resources. Visual Studio has tried to make 
it unique by its own way but what if I want the storage name to start 
with &quot;demo&quot; as a prefix. Let do this.&lt;/li&gt; 
  &lt;/ul&gt; 
  &lt;p&gt;We will add one parameter name &quot;demoStoragePrefix&quot; as below in the &lt;strong&gt;parameters &lt;/strong&gt;section&lt;/p&gt; 
  &lt;pre spellcheck=&quot;false&quot;&gt;&lt;span class=&quot;hljs-string&quot;&gt;&quot;demoStoragePrefix&quot;&lt;/span&gt;: {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class=&quot;hljs-string&quot;&gt;&quot;type&quot;&lt;/span&gt;: &lt;span class=&quot;hljs-string&quot;&gt;&quot;string&quot;&lt;/span&gt;,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class=&quot;hljs-string&quot;&gt;&quot;minLength&quot;&lt;/span&gt;: 1,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class=&quot;hljs-string&quot;&gt;&quot;defaultValue&quot;&lt;/span&gt;: &lt;span class=&quot;hljs-string&quot;&gt;&quot;demo&quot;&lt;/span&gt;
&lt;/pre&gt; 
  &lt;pre spellcheck=&quot;false&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/pre&gt; 
  &lt;p&gt;In the &lt;strong&gt;variables &lt;/strong&gt;section lets modify the demoStorageName variable to read the prefix from the parameter we just defined above.&lt;/p&gt; 
  &lt;pre spellcheck=&quot;false&quot;&gt;&lt;span class=&quot;hljs-string&quot;&gt;&quot;demoStorageName&quot;&lt;/span&gt;: &lt;span class=&quot;hljs-string&quot;&gt;&quot;[concat(parameters(&#39;demoStoragePrefix&#39;), uniqueString(resourceGroup().id))]&quot;&lt;/span&gt;
&lt;/pre&gt; 
  &lt;p&gt;Now also add an additional parameter name &quot;metadata&quot; in the &lt;strong&gt;parameters &lt;/strong&gt;section.
 This is optional and most people do overlook but I strongly recommend 
to add this with every template as it makes the code more readable.&lt;/p&gt; 
  &lt;pre spellcheck=&quot;false&quot;&gt;&lt;span class=&quot;hljs-string&quot;&gt;&quot;metadata&quot;&lt;/span&gt;: {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class=&quot;hljs-string&quot;&gt;&quot;type&quot;&lt;/span&gt;: &lt;span class=&quot;hljs-string&quot;&gt;&quot;string&quot;&lt;/span&gt;,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class=&quot;hljs-string&quot;&gt;&quot;defaultValue&quot;&lt;/span&gt;: &lt;span class=&quot;hljs-string&quot;&gt;&quot;Creation of Storage Account&quot;&lt;/span&gt;
&lt;/pre&gt; 
  &lt;pre spellcheck=&quot;false&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/pre&gt; 
  &lt;ul&gt; 
   &lt;li&gt;Now the new modified json code block looks like this with the above changes in place.&lt;/li&gt; 
  &lt;/ul&gt; 
  &lt;div class=&quot;slate-resizable-image-embed slate-image-embed__resize-full-width&quot;&gt; 
   &lt;img alt=&quot;No alt text provided for this image&quot; data-li-src=&quot;https://media-exp1.licdn.com/dms/image/C5112AQEoPFvT6qTK-A/article-inline_image-shrink_1500_2232/0?e=1605139200&amp;amp;v=beta&amp;amp;t=unljtx2X94CnqlsdLnW_OnAxnUPWW8pkS63N_O2P47o&quot; data-media-urn=&quot;&quot; height=&quot;597&quot; src=&quot;https://media-exp1.licdn.com/dms/image/C5112AQEoPFvT6qTK-A/article-inline_image-shrink_1500_2232/0?e=1605139200&amp;amp;v=beta&amp;amp;t=unljtx2X94CnqlsdLnW_OnAxnUPWW8pkS63N_O2P47o&quot; width=&quot;640&quot; /&gt; 
  &lt;/div&gt; 
  &lt;ul&gt; 
   &lt;li&gt;Save the file and solution. We are done with our ARM template. Now lets dive into the deployment part.&lt;/li&gt; 
  &lt;/ul&gt; 
  &lt;p&gt;&lt;strong&gt;Open PowerShell window (Command line or ISE window will do)&lt;/strong&gt;&lt;/p&gt; 
  &lt;ul&gt; 
   &lt;li&gt;Connect to your Azure account. Execute the below command.&lt;/li&gt; 
  &lt;/ul&gt; 
  &lt;pre spellcheck=&quot;false&quot;&gt;Connect-AzureRmAccount
&lt;/pre&gt; 
  &lt;p&gt;This will prompt for your Azure username and password. Provide the 
details and login. A successful login with show all your subscriptions. I
 have only one subscription and hence it shows the details related to 
that.&lt;/p&gt; 
  &lt;pre spellcheck=&quot;false&quot;&gt;Account&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
SubscriptionName : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
SubscriptionId&amp;nbsp;&amp;nbsp; : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
TenantId&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
&lt;/pre&gt; 
  &lt;pre spellcheck=&quot;false&quot;&gt;Environment&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
&lt;/pre&gt; 
  &lt;ul&gt; 
   &lt;li&gt;Next set some deployment variables which we will use later in the steps. Select these steps and execute.&lt;/li&gt; 
  &lt;/ul&gt; 
  &lt;pre spellcheck=&quot;false&quot;&gt;&lt;span class=&quot;hljs-comment&quot;&gt;## Define Deployment Variables&lt;/span&gt;

   &lt;span class=&quot;hljs-comment&quot;&gt;## Your resource location. In my case I placed it in SE Asia&lt;/span&gt;
&amp;nbsp;&amp;nbsp; &lt;span class=&quot;hljs-variable&quot;&gt;$location&lt;/span&gt; = &lt;span class=&quot;hljs-string&quot;&gt;&#39;SouthEast Asia&#39;&lt;/span&gt; 
   &lt;span class=&quot;hljs-comment&quot;&gt;## Resource Group Name&lt;/span&gt;
&amp;nbsp;&amp;nbsp; &lt;span class=&quot;hljs-variable&quot;&gt;$resourceGroupName&lt;/span&gt; = &lt;span class=&quot;hljs-string&quot;&gt;&#39;ARMdemo-simple-storage&#39;&lt;/span&gt;
   &lt;span class=&quot;hljs-comment&quot;&gt;## Resource Group Deployment Name&lt;/span&gt;
&amp;nbsp;&amp;nbsp; &lt;span class=&quot;hljs-variable&quot;&gt;$resourceDeploymentName&lt;/span&gt; = &lt;span class=&quot;hljs-string&quot;&gt;&#39;ARMdemo-simple-storage-deployment&#39;&lt;/span&gt;
   &lt;span class=&quot;hljs-comment&quot;&gt;## The path of the template file in your local drive. Your location folder path can be different&lt;/span&gt;
&amp;nbsp;&amp;nbsp; &lt;span class=&quot;hljs-variable&quot;&gt;$templatePath&lt;/span&gt; = &lt;span class=&quot;hljs-variable&quot;&gt;$env&lt;/span&gt;:SystemDrive + &lt;span class=&quot;hljs-string&quot;&gt;&#39;\&#39;&lt;/span&gt; + &lt;span class=&quot;hljs-string&quot;&gt;&#39;Personal\Projects\DemoAzureRmStorageDeployment&#39;&lt;/span&gt;
&amp;nbsp;&amp;nbsp; &lt;span class=&quot;hljs-comment&quot;&gt;## The template filename. It will be same if you have taken the default filename which Visual Studio provides&lt;/span&gt;
   &lt;span class=&quot;hljs-variable&quot;&gt;$templateFile&lt;/span&gt; = &lt;span class=&quot;hljs-string&quot;&gt;&#39;azuredeploy.json&#39;&lt;/span&gt;
   &lt;span class=&quot;hljs-comment&quot;&gt;## The full template path along with the file&lt;/span&gt;
&amp;nbsp;&amp;nbsp; &lt;span class=&quot;hljs-variable&quot;&gt;$template&lt;/span&gt; = &lt;span class=&quot;hljs-variable&quot;&gt;$templatePath&lt;/span&gt; + &lt;span class=&quot;hljs-string&quot;&gt;&#39;\&#39;&lt;/span&gt; + &lt;span class=&quot;hljs-variable&quot;&gt;$templateFile&lt;/span&gt;

&lt;/pre&gt; 
  &lt;ul&gt; 
   &lt;li&gt;Create a Resource group in Azure under which our Storage resource
 will be placed. Now here you might be thinking that why we are not 
creating this resource group through the same ARM template. You are 
absolutely right but I have purposefully kept this separate to make our 
ARM template look simple. Otherwise we have to make it a bit complex by 
adding priority in the template regarding which resource should get 
created first and depends on what. Hope you understand. &lt;/li&gt; 
  &lt;/ul&gt; 
  &lt;pre spellcheck=&quot;false&quot;&gt;&lt;span class=&quot;hljs-comment&quot;&gt;### Create Resource Group&lt;/span&gt;
 &lt;span class=&quot;hljs-keyword&quot;&gt;New&lt;/span&gt;-AzureRmResourceGroup `
&amp;nbsp;&amp;nbsp;&amp;nbsp; -Name $resourceGroupName `
&amp;nbsp;&amp;nbsp;&amp;nbsp; -Location $location `
&amp;nbsp;&amp;nbsp;&amp;nbsp; -Verbose -Force
&lt;/pre&gt; 
  &lt;p&gt;Execute the above script. It will create the resource group name 
&quot;ARMdemo-simple-storage&quot; in &quot;SouthEast Asia&quot; region. These are coming 
from the deployment variables we set before. &lt;em&gt;Your name and region can be different based on what you have set in the variables.&lt;/em&gt;&lt;/p&gt; 
  &lt;ul&gt; 
   &lt;li&gt;Now the most important step. Deploying our ARM template with 
Powershell. Execute the following command. The command 
&quot;New-AzureRmResourceGroupDeployment&quot; will pick the ARM template from the
 location of our local drive and would deploy the resource under the 
resource group created above. The parameters passed are very much self 
explanatory&lt;/li&gt; 
  &lt;/ul&gt; 
  &lt;pre spellcheck=&quot;false&quot;&gt;&lt;span class=&quot;hljs-comment&quot;&gt;### Deploy Resources&lt;/span&gt;

&lt;span class=&quot;hljs-keyword&quot;&gt;New&lt;/span&gt;-AzureRmResourceGroupDeployment -Name $resourceDeploymentName -ResourceGroupName $resourceGroupName -TemplateFile $template -Verbose -Force
&lt;/pre&gt; 
  &lt;ul&gt; 
   &lt;li&gt;Wait for sometime for the deployment to finish. The command will 
also validate the ARM template before deployment and if looks fine will 
display &quot;-Template is valid&quot; else will throw an error message with 
description of what and where it went wrong.&lt;/li&gt; 
   &lt;li&gt;DONE with our automation.&lt;/li&gt; 
  &lt;/ul&gt; 
  &lt;p&gt;&lt;a href=&quot;https://portal.azure.com/&quot; rel=&quot;nofollow noopener&quot; target=&quot;_blank&quot;&gt;Login &lt;/a&gt;to Azure portal and check if everything is created as expected.&lt;/p&gt; 
  &lt;p&gt;First lets check the resource group. Our &quot;ARMdemo-simple-storage&quot; is there as expected.&lt;/p&gt; 
  &lt;div class=&quot;slate-resizable-image-embed slate-image-embed__resize-full-width&quot;&gt; 
   &lt;img alt=&quot;No alt text provided for this image&quot; data-li-src=&quot;https://media-exp1.licdn.com/dms/image/C5112AQEHW5WpfhbgJw/article-inline_image-shrink_1000_1488/0?e=1605139200&amp;amp;v=beta&amp;amp;t=kVkPM_IHBSeLeXIhNvuGzwIQ8AxKIOn-lWOSPAAR_9Y&quot; data-media-urn=&quot;&quot; height=&quot;213&quot; src=&quot;https://media-exp1.licdn.com/dms/image/C5112AQEHW5WpfhbgJw/article-inline_image-shrink_1000_1488/0?e=1605139200&amp;amp;v=beta&amp;amp;t=kVkPM_IHBSeLeXIhNvuGzwIQ8AxKIOn-lWOSPAAR_9Y&quot; width=&quot;640&quot; /&gt; 
  &lt;/div&gt; 
  &lt;p&gt;Let dive into it. Yes our storage account (provisioned thorough the
 ARM template) is showing up under the resource group in location : 
Southeast Asia. &lt;/p&gt; 
  &lt;div class=&quot;slate-resizable-image-embed slate-image-embed__resize-full-width&quot;&gt; 
   &lt;img alt=&quot;No alt text provided for this image&quot; data-li-src=&quot;https://media-exp1.licdn.com/dms/image/C5112AQGnozrZFWe3fA/article-inline_image-shrink_1000_1488/0?e=1605139200&amp;amp;v=beta&amp;amp;t=zeXGMNXeIaiMheJDAEERYzaR6VEU4CwlwW85bSM67CE&quot; data-media-urn=&quot;&quot; height=&quot;204&quot; src=&quot;https://media-exp1.licdn.com/dms/image/C5112AQGnozrZFWe3fA/article-inline_image-shrink_1000_1488/0?e=1605139200&amp;amp;v=beta&amp;amp;t=zeXGMNXeIaiMheJDAEERYzaR6VEU4CwlwW85bSM67CE&quot; width=&quot;640&quot; /&gt; 
  &lt;/div&gt; 
  &lt;p&gt;One thing to notice here is the unique storage name. The prefix is 
&quot;demo&quot; which we had set in the ARM template and the rest is appended 
from the resourceGroup id. Recall the below variable we set in the 
template. Amazing!&lt;/p&gt; 
  &lt;pre spellcheck=&quot;false&quot;&gt;&lt;span class=&quot;hljs-string&quot;&gt;&quot;variables&quot;&lt;/span&gt;: {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class=&quot;hljs-string&quot;&gt;&quot;demoStorageName&quot;&lt;/span&gt;: &lt;span class=&quot;hljs-string&quot;&gt;&quot;[concat(parameters(&#39;demoStoragePrefix&#39;), uniqueString(resourceGroup().id))]&quot;&lt;/span&gt;
}
&lt;/pre&gt; 
  &lt;p&gt;Click on the storage and you can view more details. &lt;/p&gt; 
  &lt;div class=&quot;slate-resizable-image-embed slate-image-embed__resize-full-width&quot;&gt; 
   &lt;img alt=&quot;No alt text provided for this image&quot; data-li-src=&quot;https://media-exp1.licdn.com/dms/image/C5112AQHOJ8WRfvyUaQ/article-inline_image-shrink_1000_1488/0?e=1605139200&amp;amp;v=beta&amp;amp;t=kpwijtQka1ROPDMyn72OvLjACaRZlBo3HgONxvIzZlo&quot; data-media-urn=&quot;&quot; height=&quot;257&quot; src=&quot;https://media-exp1.licdn.com/dms/image/C5112AQHOJ8WRfvyUaQ/article-inline_image-shrink_1000_1488/0?e=1605139200&amp;amp;v=beta&amp;amp;t=kpwijtQka1ROPDMyn72OvLjACaRZlBo3HgONxvIzZlo&quot; width=&quot;640&quot; /&gt; 
  &lt;/div&gt; 
  &lt;p&gt;Great Stuff and &lt;strong&gt;Well Done!&lt;/strong&gt; No more manual steps anymore. Going forward any redundant work you do, try to automate it. It will be a blessing.&lt;/p&gt; 
  &lt;p&gt;Do share with me about your experience and what you have built upon this foundation. You can take it upto any level and integrate. I would love to hear from you.&lt;/p&gt;&lt;div class=&quot;ember-view&quot; id=&quot;ember5644&quot;&gt;&lt;div class=&quot;reader-ugc-post-bar reader-ugc-post-bar--expanded&quot;&gt;&lt;div class=&quot;display-flex justify-space-between&quot;&gt;
  &lt;/div&gt;

&lt;/div&gt;
&lt;/div&gt;

        &lt;div class=&quot;reader-social-bar-v2 reader-social-bar-v2__sticky-container ember-view&quot; id=&quot;ember5660&quot;&gt;&lt;div class=&quot;social-details-social-activity ember-view&quot; id=&quot;ember5661&quot;&gt;    &lt;div class=&quot;ember-view&quot; id=&quot;ember5662&quot;&gt;&lt;div class=&quot;ember-view&quot; id=&quot;ember5663&quot;&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;div class=&quot;reader-social-bar-v2__social-counts&quot;&gt;
&lt;div class=&quot;p0 feed-shared-social-actions feed-shared-social-action-bar social-detail-base-social-actions ember-view&quot; id=&quot;ember5664&quot;&gt;        &lt;span class=&quot;reactions-react-button ember-view&quot; id=&quot;ember5665&quot;&gt;
&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;span class=&quot;comment ember-view&quot; id=&quot;ember5668&quot;&gt;  
  





&lt;/span&gt;&lt;div class=&quot;artdeco-dropdown artdeco-dropdown--placement-top artdeco-dropdown--justification-left ember-view&quot; id=&quot;ember5671&quot;&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techiemate.blogspot.com/feeds/8690194249655994513/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techiemate.blogspot.com/2020/09/creating-arm-templates-with-azure.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/8690194249655994513'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/8690194249655994513'/><link rel='alternate' type='text/html' href='http://techiemate.blogspot.com/2020/09/creating-arm-templates-with-azure.html' title='Creating ARM Templates with Azure Resource Group Project'/><author><name>Atanu Gupta</name><uri>http://www.blogger.com/profile/05529718294081550882</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_LZ_SzyDY_u8HW4LiUYlsEJKSSMR5zYs-ow0dK7kjPtYVYnB_nHhGXM3Ad8Gt9AxMhbi0UO3mSjuYBQq2Sli5kUe05z21o-xTJYAM-Pw6TErhMe4ITlrqdadJSCp_xYQS1rf5k8diG7IlmVmai1fllCvN7o9A8b0JSaV5Gn6SCwv5zw/s220/1714907742840.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6011381329995167460.post-5439105896550089503</id><published>2020-07-06T17:45:00.009+05:30</published><updated>2020-07-07T10:22:36.411+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Azure"/><category scheme="http://www.blogger.com/atom/ns#" term="Logic App"/><category scheme="http://www.blogger.com/atom/ns#" term="PaaS"/><category scheme="http://www.blogger.com/atom/ns#" term="Storage"/><category scheme="http://www.blogger.com/atom/ns#" term="Table"/><title type='text'>Azure Logic App : A must have weapon in your armoury</title><content type='html'>I often get involved in discussions where people talks about automation and orchestrating stuff so that manual operations can be mitigated. This discussion generally leads towards implementing DevOps tools and practices and to setup a sound CI/CD pipeline, etc. But, I rarely come across a situation where people brings&amp;nbsp;&lt;b&gt;&lt;font color=&quot;#b51200&quot;&gt;Logic App&lt;/font&gt;&lt;/b&gt; in this discussion. It a great service and should be a part of any automation discussion.&amp;nbsp;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Take an example (Order handling in an arbitrary eCommerce scenario). The situation is like&lt;/div&gt;&lt;div&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Receiving the &lt;b&gt;order&lt;/b&gt; in the system&lt;/li&gt;&lt;li&gt;Save the &lt;b&gt;order&lt;/b&gt; details in a database&amp;nbsp;&lt;/li&gt;&lt;li&gt;Generate a service ticket (ITSM) so that the &lt;b&gt;order&lt;/b&gt; can be handled&lt;/li&gt;&lt;li&gt;Generate a SMS and send it to the customer confirming the&amp;nbsp;&lt;b&gt;order&lt;/b&gt;&amp;nbsp;&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;A very common workflow..right! What would you prefer here? A DevOps Automation or an Workflow Automation? Obviously the second one, and here in this article we will implement the above scenario with the help of a Logic App workflow and would try to feel the power of this awesome service.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;font color=&quot;#b51200&quot;&gt;Please note that for simplicity purpose and to make this article an easy read we will go over a waterfall workflow model with sequential steps.&amp;nbsp;&lt;/font&gt;&lt;/i&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Let&#39;s revisit out scenario once again and this time we will put the integration pointers.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;Receiving the&amp;nbsp;&lt;b&gt;order&lt;/b&gt;&amp;nbsp;in the system 👉 Postman REST API client&lt;/li&gt;&lt;li&gt;Save the&amp;nbsp;&lt;b&gt;order&lt;/b&gt;&amp;nbsp;details in a database 👉 &lt;a href=&quot;https://portal.azure.com&quot; target=&quot;_blank&quot;&gt;Azure&lt;/a&gt; Table Storage&lt;/li&gt;&lt;li&gt;Generate a service ticket (ITSM) so that the&amp;nbsp;&lt;b&gt;order&lt;/b&gt;&amp;nbsp;can be handled 👉 &lt;a href=&quot;https://freshdesk.com/signup&quot; target=&quot;_blank&quot;&gt;FreshDesk&lt;/a&gt; (free account will do)&lt;/li&gt;&lt;li&gt;Generate a SMS and send it to the customer confirming the&amp;nbsp;&lt;b&gt;order&lt;/b&gt;&amp;nbsp;👉&amp;nbsp;&lt;a href=&quot;https://www.twilio.com/try-twilio&quot; target=&quot;_blank&quot;&gt;Twillio&lt;/a&gt;&amp;nbsp;(free account will do)&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;Make sure you have the above settings done before moving forward.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;OK, now we are all set. Let&#39;s dive.&lt;/div&gt;&lt;div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;First let&#39;s define the order information. We will use a simple JSON payload here for this demo just to simulate an order. &lt;b&gt;Please replace the phone number with yours&lt;/b&gt; (with proper +Country code) 📱&lt;/li&gt;&lt;/ul&gt;&lt;pre style=&quot;text-align: left;&quot;&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: &amp;quot;andale mono&amp;quot;, &amp;quot;lucida console&amp;quot;, monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;{
   &quot;orderNo&quot;: &quot;1&quot;,
   &quot;orderItem&quot; : &quot;Headphone&quot;,
   &quot;orderCustName&quot;: &quot;My Good Customer&quot;,
   &quot;orderCustMobile&quot; : &quot;+91XXXXXXXXXX&quot;,
   &quot;orderCity&quot;: &quot;Bangalore&quot;,
   &quot;orderState&quot;: &quot;Karnataka&quot;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/pre&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Login to Azure and search for Logic Apps.&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXAqnxL3b5C5fJ3Yxd_1cO32-ge1ELRPgwxqv6_EUnHJoETNE6pub3utExHntUcuGSQA2WCMaYMCW4zOIRgk0XzfuHpB0-l9c8wP8gG4-LabY5IKGRcBXco7tXPZktJOUxWNFvQ8_lELw/s980/Capture.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;265&quot; data-original-width=&quot;980&quot; height=&quot;174&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXAqnxL3b5C5fJ3Yxd_1cO32-ge1ELRPgwxqv6_EUnHJoETNE6pub3utExHntUcuGSQA2WCMaYMCW4zOIRgk0XzfuHpB0-l9c8wP8gG4-LabY5IKGRcBXco7tXPZktJOUxWNFvQ8_lELw/w640-h174/Capture.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Select your subscription, fill up the necessary details as per your choice, review and create the logic app.&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZrBq1o3vXiWU2ZlCIME2l8wD481y7K1GW4aWxtDW_48EfOmsV8yxjwQKdexKHMjt6eggG6xITzmgr20UiXu59xxty1fmp1PHveuEk6NTVEDAplc0nRhBbHEnBvW5RRKvH9kN854sYidc/s822/Capture.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;646&quot; data-original-width=&quot;822&quot; height=&quot;502&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZrBq1o3vXiWU2ZlCIME2l8wD481y7K1GW4aWxtDW_48EfOmsV8yxjwQKdexKHMjt6eggG6xITzmgr20UiXu59xxty1fmp1PHveuEk6NTVEDAplc0nRhBbHEnBvW5RRKvH9kN854sYidc/w640-h502/Capture.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Select &quot;&lt;i&gt;When a HTTP request is received&lt;/i&gt;&quot; trigger in the designer&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPv8gi789dXty_yeH-7gWt61ztoMIrH81qaM9nbQ2PFMWr2LaAsHggm09vnCy75pJd-jxPFRDm5e9CTERB4JTn8QjEjfvDCFbFcT0PH_mIZFizacZADvWpjvYtjErfg4BLTCh9wR4s524/s1609/Capture.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;781&quot; data-original-width=&quot;1609&quot; height=&quot;310&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPv8gi789dXty_yeH-7gWt61ztoMIrH81qaM9nbQ2PFMWr2LaAsHggm09vnCy75pJd-jxPFRDm5e9CTERB4JTn8QjEjfvDCFbFcT0PH_mIZFizacZADvWpjvYtjErfg4BLTCh9wR4s524/w640-h310/Capture.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Click the link &quot;Use sample payload to generate schema&quot; hyperlink at the bottom and paste the order JSON payload to generate the JSON schema. Save the logic app to generate the HTTP Post Url.&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgq8ztTo6q3KA72psr2JNXHw13XxHc2mpycTImYkr2VTD6mYE0hL-vOjDYuGW1RhWHeWt2uPuis2s5t_g5mzoBuS6QkkliBQUAxyap6DGqpsu3R8049xJFB5lyXXC4nb61h8CjTUMDhNzY/s696/Capture.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;439&quot; data-original-width=&quot;696&quot; height=&quot;404&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgq8ztTo6q3KA72psr2JNXHw13XxHc2mpycTImYkr2VTD6mYE0hL-vOjDYuGW1RhWHeWt2uPuis2s5t_g5mzoBuS6QkkliBQUAxyap6DGqpsu3R8049xJFB5lyXXC4nb61h8CjTUMDhNzY/w640-h404/Capture.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Click &quot;+ New Step&quot; to add an Azure Storage table data insert step. Make sure you have already created a blank table in Azure Storage account so that you can insert data in that table directly using this step. You can create that table from Logic app as well, but it&#39;s upto you. Here I have already created that table inorder to reduce an extra step&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Search for Azure Table Storage and select &quot;Insert Entity&quot; action&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhi2Cce4agTVwaRG10P42iEMPkJsXgymg7NzPz9q6SNS5jaGWKNYQCrVAVlpkKofaFZtPSYpeJl41z3WGdPjdVLcLoZExFMVzhL8znxMjRtOpZd8I_AMLZcHGebJHICBCD8FliKG8PPiq8/s730/Capture.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;556&quot; data-original-width=&quot;730&quot; height=&quot;488&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhi2Cce4agTVwaRG10P42iEMPkJsXgymg7NzPz9q6SNS5jaGWKNYQCrVAVlpkKofaFZtPSYpeJl41z3WGdPjdVLcLoZExFMVzhL8znxMjRtOpZd8I_AMLZcHGebJHICBCD8FliKG8PPiq8/w640-h488/Capture.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Give a name for your table storage connection, select your storage account and hit &quot;Create&quot;&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfSdPHIuakcAop30oTe9MvgjLy_FXoDLTwqDu8eciQNxZPGSLF-0Y0ecGnBLKeRzvSY38Hq9766CU4MCLqf6yl_6HASvvURyf1HGf-MjeBc0arYfQKJBfnobiUJpGVYFTQk3UoY7mPlEo/s695/Capture.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;415&quot; data-original-width=&quot;695&quot; height=&quot;382&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfSdPHIuakcAop30oTe9MvgjLy_FXoDLTwqDu8eciQNxZPGSLF-0Y0ecGnBLKeRzvSY38Hq9766CU4MCLqf6yl_6HASvvURyf1HGf-MjeBc0arYfQKJBfnobiUJpGVYFTQk3UoY7mPlEo/w640-h382/Capture.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Select your table name from the Table dropdown. Paste the JSON payload here and replace the values with the parameters from the dynamic content selection box. As we are saving data in Azure Storage Table so make sure to modify your payload with &lt;i&gt;PartitionKey&lt;/i&gt; and &lt;i&gt;RowKey&lt;/i&gt; parameters to make an unique combination for each row item. I have used the &lt;b&gt;orderNo&lt;/b&gt; and &lt;b&gt;orderCustMobile&lt;/b&gt;&amp;nbsp;fields but you can make your wish here 😐&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9j85GTUA4Zd8OT-HoITt5jj3xpYoC7EnDrH1_kjP6cbBSFJceJSnmYG46Z2snubqzeY6zxb0NPaW-GciefxNNnGBjHBL8KyHQ4Xz6g8gCi6GSqs3atvlKmLJVVR060X9U9dodwZ-PCZc/s693/Capture.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;443&quot; data-original-width=&quot;693&quot; height=&quot;410&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9j85GTUA4Zd8OT-HoITt5jj3xpYoC7EnDrH1_kjP6cbBSFJceJSnmYG46Z2snubqzeY6zxb0NPaW-GciefxNNnGBjHBL8KyHQ4Xz6g8gCi6GSqs3atvlKmLJVVR060X9U9dodwZ-PCZc/w640-h410/Capture.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Click &quot;+ New Step&quot; to add a &lt;b&gt;FreshDesk&lt;/b&gt; service ticket action.&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiS0rYFgH1iVMb4RBG4qN_nC7EtNerSTA2lEHSTuOAUkKfTTo0MmCPpc-TfHzLTHzis8oCtinph6kjdjfUn8V5_2EY7rANS-pTiyCeyXToticE4n21L-cXVEntQTcGyj6w2nkI9FN-c108/s695/Capture.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;635&quot; data-original-width=&quot;695&quot; height=&quot;584&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiS0rYFgH1iVMb4RBG4qN_nC7EtNerSTA2lEHSTuOAUkKfTTo0MmCPpc-TfHzLTHzis8oCtinph6kjdjfUn8V5_2EY7rANS-pTiyCeyXToticE4n21L-cXVEntQTcGyj6w2nkI9FN-c108/w640-h584/Capture.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Provide your FreshDesk connection parameters and hit Create&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJ_gLHD4AleyExNdDiMQ7Mstl6_tpv3SJN9s7_K65RGLC13khZ2a5H_bPKWJeo-X4ClJtSIY8lqx2IkGvHPO0DyF0wAsBwmX_M0gSsSkBzR9YwMh0tFw_-93Oii-b_Kc7N7zrlxrhhUoI/s701/Capture.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;328&quot; data-original-width=&quot;701&quot; height=&quot;300&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJ_gLHD4AleyExNdDiMQ7Mstl6_tpv3SJN9s7_K65RGLC13khZ2a5H_bPKWJeo-X4ClJtSIY8lqx2IkGvHPO0DyF0wAsBwmX_M0gSsSkBzR9YwMh0tFw_-93Oii-b_Kc7N7zrlxrhhUoI/w640-h300/Capture.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Fill up the ticket details to be logged. You can decorate it as per your requirement. For the Email dropdown choose any dummy name as it doesn&#39;t matter for this demo. In real life scenario you will be having your user list. Here our purpose is to log a service ticket.&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSD0NxrgpoAY6kjvlCseQlG3zWnGWtd8yQdeqqT1UQjVMWGQzRDndIlUBWjrVAxXGp30dizcI36auW_rZCJBa4iJ3luEmzKCxamq_BbtebLdmSRpEfcI7Uc8T-yDZjd3aWkNHH-kg_UEc/s691/Capture.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;479&quot; data-original-width=&quot;691&quot; height=&quot;444&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSD0NxrgpoAY6kjvlCseQlG3zWnGWtd8yQdeqqT1UQjVMWGQzRDndIlUBWjrVAxXGp30dizcI36auW_rZCJBa4iJ3luEmzKCxamq_BbtebLdmSRpEfcI7Uc8T-yDZjd3aWkNHH-kg_UEc/w640-h444/Capture.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Click &quot;+ New Step&quot; to add a&amp;nbsp;&lt;b&gt;Twilio &lt;/b&gt;SMS action. Select &quot;Send Text Message (SMS)&quot; action&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdYSPUehGs_CSaBLefhPLzO10X1xJuNoypSvN-JDGoKNpecQbOh9UIQgV7OzPBHaprGzh-Ta0guL8wQ7kCYZINxwGqp_6Otx1dlay7tA7UDFcCi9z-KVQC6qqtLTBlK2spInMwGf1Ra4s/s687/Capture.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;681&quot; data-original-width=&quot;687&quot; height=&quot;634&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdYSPUehGs_CSaBLefhPLzO10X1xJuNoypSvN-JDGoKNpecQbOh9UIQgV7OzPBHaprGzh-Ta0guL8wQ7kCYZINxwGqp_6Otx1dlay7tA7UDFcCi9z-KVQC6qqtLTBlK2spInMwGf1Ra4s/w640-h634/Capture.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Enter the Connection Name of your choice, Twilio Account id (the ACCOUNT SID value in the Twilio portal) and the Twilio Access Token (the AUTH TOKEN value in the Twilio portal)&amp;nbsp;and hit &quot;Create&quot;&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2x-m6oNdKQFeU-z9MNAhbL4j_JXsxH3zQatIPw0m8phvcJc7cutB4nX-NgtWXex-FBPaprxt68Emqc11q5NKiJIiMjvBLcaXlRBEjqmV-HLSNMy1nC9NOXWWsk234jGzumZvQiPGrTBY/s694/Capture.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;262&quot; data-original-width=&quot;694&quot; height=&quot;242&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2x-m6oNdKQFeU-z9MNAhbL4j_JXsxH3zQatIPw0m8phvcJc7cutB4nX-NgtWXex-FBPaprxt68Emqc11q5NKiJIiMjvBLcaXlRBEjqmV-HLSNMy1nC9NOXWWsk234jGzumZvQiPGrTBY/w640-h242/Capture.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Select the From Phone number which will be automatically populated from your Twilio account. Decorate your SMS message as you wish.&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpIrCiw1sOEyBVoh_WPdceBSaxf-dYg9sL4sso7UEEPDHwyhVwRfdaKerdVx2g9wqPfJtUQUrNXqzRSdm7S9L97DFF5oM-WQcju_at6Q8fbCrVdUqU5ss9cFFyCiQx3UrO7HDjE8hV7x8/s690/Capture.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;304&quot; data-original-width=&quot;690&quot; height=&quot;282&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpIrCiw1sOEyBVoh_WPdceBSaxf-dYg9sL4sso7UEEPDHwyhVwRfdaKerdVx2g9wqPfJtUQUrNXqzRSdm7S9L97DFF5oM-WQcju_at6Q8fbCrVdUqU5ss9cFFyCiQx3UrO7HDjE8hV7x8/w640-h282/Capture.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Click &quot;Save&quot; at the top to save your logic app. &lt;b&gt;This step is very important&lt;/b&gt; 😀&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;b&gt;&lt;font color=&quot;#b51200&quot; size=&quot;5&quot;&gt;&lt;br /&gt;&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;font color=&quot;#b51200&quot; size=&quot;5&quot;&gt;Show Time !!!!!!!&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Copy the Http POST Url from the first step of your logic app and open postman. We are about to make a rest call.&amp;nbsp;&lt;/div&gt;&lt;div&gt;Paste the Url at the address bar, select JSON (application/json)&amp;nbsp; as content type and put your JSON payload in the body as raw input. Hit Send to get a 202 Accepted response back.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVI1q6DMOWQCWFoKFKi9L2tQtuUKI4lgZlu5_9m7yOp6NPJLHUVJ5rDtXYydQTHjrM0jTY6lc2ZYrdEVxjhou8s4AmN8e_eUVoD9oY-Jz7_l9iLihKkOabh6ZgZkrxxUSsCQv-IMRt0xA/s1441/Capture.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;514&quot; data-original-width=&quot;1441&quot; height=&quot;228&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVI1q6DMOWQCWFoKFKi9L2tQtuUKI4lgZlu5_9m7yOp6NPJLHUVJ5rDtXYydQTHjrM0jTY6lc2ZYrdEVxjhou8s4AmN8e_eUVoD9oY-Jz7_l9iLihKkOabh6ZgZkrxxUSsCQv-IMRt0xA/w640-h228/Capture.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You have successfully made a rest call. Now three activities should happen. We must receive a record in table storage, service ticket logged in FreshDesk and a SMS in our mobile phone.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Open Azure Storage explorer and Aha! we have a new record in table&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimB2FVC8BqDI1NaPjqgu0ozrFNJ-m8tykKrpQizCZEgtHWiYer9Y4e3CCwlLBSBbGlB1ZXgWrxcByR_wXoVcMS2PEhyFgJiJGv-V7zl73tOiQV27sogk6ukT-zlKtsw3xyELUl7OqWrow/s1590/Capture.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;317&quot; data-original-width=&quot;1590&quot; height=&quot;128&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimB2FVC8BqDI1NaPjqgu0ozrFNJ-m8tykKrpQizCZEgtHWiYer9Y4e3CCwlLBSBbGlB1ZXgWrxcByR_wXoVcMS2PEhyFgJiJGv-V7zl73tOiQV27sogk6ukT-zlKtsw3xyELUl7OqWrow/w640-h128/Capture.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Open your&amp;nbsp;&lt;b&gt;FreshDesk&lt;/b&gt; ticketing dashboard and Voila! we have new service ticket 😲&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4EWn23T04yGxJryDamhbUc92fmP48CHCIZaD3y6hsCfsua0G6lkN5-8N1-HTpndRKOGGzvDfWQcmlaWVD1VOF9SrHONbz-rYyn4RWD_jelv4At2HuxcFUXBsG7qLzKvb5tkDKmZDKK1E/s1443/Capture.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;561&quot; data-original-width=&quot;1443&quot; height=&quot;248&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4EWn23T04yGxJryDamhbUc92fmP48CHCIZaD3y6hsCfsua0G6lkN5-8N1-HTpndRKOGGzvDfWQcmlaWVD1VOF9SrHONbz-rYyn4RWD_jelv4At2HuxcFUXBsG7qLzKvb5tkDKmZDKK1E/w640-h248/Capture.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Click the ticket and drill down to its details. Yep it showing the order details just as we configured it to be 👍&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbuGedI5wv31lJEgsVA_ak-F9fkoWffpPA1LW4zkntq8S-fMi2vTd5sqGk9hH2Z_Y2fLfK0b9-7z6plLFSljAXQV_bGTWCSsWNmkofjMxxd1HP0doZl5-_AsSAv-B9LFX2iW9fmPqqmVQ/s1084/Capture.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;675&quot; data-original-width=&quot;1084&quot; height=&quot;398&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbuGedI5wv31lJEgsVA_ak-F9fkoWffpPA1LW4zkntq8S-fMi2vTd5sqGk9hH2Z_Y2fLfK0b9-7z6plLFSljAXQV_bGTWCSsWNmkofjMxxd1HP0doZl5-_AsSAv-B9LFX2iW9fmPqqmVQ/w640-h398/Capture.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Awesome&lt;/b&gt;!... now as a last step lets check the mobile phone only to find the SMS sitting in our inbox. Now how cool is that !!!!!!!!&amp;nbsp; 👏👏👏&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDpk3rDLsDT3pbA-CTE924ePMdBgzv1QMyvcH8DYM-dfN8tMeII2UySLW6vlYfv1p-PJspNIEIfUyokKLgoWReNCRm1nJACvFaBlmZ6X8gut6azc0I8lAPa4oWXE-tWqJV6ekTVNduyRY/s1440/20200706_171533.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;940&quot; data-original-width=&quot;1440&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDpk3rDLsDT3pbA-CTE924ePMdBgzv1QMyvcH8DYM-dfN8tMeII2UySLW6vlYfv1p-PJspNIEIfUyokKLgoWReNCRm1nJACvFaBlmZ6X8gut6azc0I8lAPa4oWXE-tWqJV6ekTVNduyRY/s320/20200706_171533.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;We have successfully achieved our goal and the power of logic app simply drives us crazy. We have achieved a complicated, cost-effective and integrated solution using the serverless flavour of Azure with &lt;b&gt;NO CODE&lt;/b&gt;.&amp;nbsp; Good job!&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;color: orange;&quot;&gt;Congratulations&lt;/span&gt;&lt;/b&gt;! for coming this far. Hope this article will help you to further explore this feature.&lt;br /&gt;
&lt;div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Do share with me about your experience and what you have built upon this
 foundation. You can take it up to any level and integrate. I would love
 to hear from you.&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techiemate.blogspot.com/feeds/5439105896550089503/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techiemate.blogspot.com/2020/07/azure-logic-app-must-have-weapon-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/5439105896550089503'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/5439105896550089503'/><link rel='alternate' type='text/html' href='http://techiemate.blogspot.com/2020/07/azure-logic-app-must-have-weapon-in.html' title='Azure Logic App : A must have weapon in your armoury'/><author><name>Atanu Gupta</name><uri>http://www.blogger.com/profile/05529718294081550882</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_LZ_SzyDY_u8HW4LiUYlsEJKSSMR5zYs-ow0dK7kjPtYVYnB_nHhGXM3Ad8Gt9AxMhbi0UO3mSjuYBQq2Sli5kUe05z21o-xTJYAM-Pw6TErhMe4ITlrqdadJSCp_xYQS1rf5k8diG7IlmVmai1fllCvN7o9A8b0JSaV5Gn6SCwv5zw/s220/1714907742840.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXAqnxL3b5C5fJ3Yxd_1cO32-ge1ELRPgwxqv6_EUnHJoETNE6pub3utExHntUcuGSQA2WCMaYMCW4zOIRgk0XzfuHpB0-l9c8wP8gG4-LabY5IKGRcBXco7tXPZktJOUxWNFvQ8_lELw/s72-w640-h174-c/Capture.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6011381329995167460.post-6581932656372003344</id><published>2020-07-02T16:27:00.007+05:30</published><updated>2020-07-02T16:46:02.761+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Azure"/><category scheme="http://www.blogger.com/atom/ns#" term="Key Vault"/><category scheme="http://www.blogger.com/atom/ns#" term="Secret"/><category scheme="http://www.blogger.com/atom/ns#" term="Security"/><title type='text'>Azure Security :  Monitor KeyVault events to generate instant notification</title><content type='html'>&lt;b&gt;Security is everybody&#39;s responsibility&lt;/b&gt;. How many times you have heard this bold one liner? I am sure it&#39;s too many times during any design discussion or working with the security folks of any organization. 😐&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So, when the talks starts rolling towards managing secrets and keys, one service of Azure you just cannot ignore is &lt;b&gt;&lt;font color=&quot;#b51200&quot;&gt;Azure KeyVault&lt;/font&gt;&lt;/b&gt;. You can keep all your secret parameters in this highly recommended HSM-protected managed vault and can securely use them from other services without the fear of those getting exposed. Great, you have implemented a fine level of security and a big round of applause 👏👏 in the room.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;But.. ummm ...ok.. Now what about someone having access to the vault; intentionally (or accidentally may be a proper word) changes the value of any secret behind the scene without your knowledge. All the dependent downstream systems suddenly stops functioning and becomes unavailable straightaway.&amp;nbsp;&lt;b&gt;Isn&#39;t this qualifies for a security breach?&lt;/b&gt;&amp;nbsp;Agree! 😔&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I love a famous saying &quot;It&#39;s not about the change but not having any knowledge of that change leads to road block&quot;. Let&#39;s take this as a thumb-rule and implement a notification system in place when someone adds/updates a secret in the KeyVault with a serverless approach throughout.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This article may also help you in your &lt;b&gt;&lt;font color=&quot;#b51200&quot;&gt;&lt;a href=&quot;https://docs.microsoft.com/en-us/learn/certifications/exams/az-500&quot; target=&quot;_blank&quot;&gt;AZ-500 : Microsoft Azure Security Technologies&lt;/a&gt; &lt;/font&gt;&lt;/b&gt;preparation and lab. Let&#39;s dive! 👍&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;strong&gt;Prerequisites&lt;/strong&gt;:&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Azure Subscription (Free subscription of 30 days will also do)&lt;/li&gt;&lt;li&gt;SendGrid API Key (Follow &lt;a href=&quot;https://signup.sendgrid.com/&quot; target=&quot;_blank&quot;&gt;this&lt;/a&gt; to create a free SendGrid account if you do not have it already and get the API Key)&lt;/li&gt;&lt;li&gt;Basic knowledge of Azure services&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;We will use Azure Logic Apps along with Event Grid trigger to catch any KeyVault change event and would fire an instant email notification to the administrators.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;a href=&quot;https://portal.azure.com/&quot; rel=&quot;nofollow noopener&quot; target=&quot;_blank&quot;&gt;Login&lt;/a&gt; to Azure (If you do not have any subscription already then create one else login to your existing one)&amp;nbsp;&lt;/li&gt;&lt;li&gt;Create a resource group and then create a KeyVault in that resource group. Follow &lt;a href=&quot;https://docs.microsoft.com/en-us/azure-stack/user/azure-stack-key-vault-manage-portal?view=azs-2002&quot; target=&quot;_blank&quot;&gt;this&lt;/a&gt; link if you are new to KeyVault. &lt;b&gt;Just create the vault and do not add any secrets now&lt;/b&gt;.&lt;/li&gt;&lt;li&gt;Create an Azure Logic App (you can give any name of your choice; I have given &lt;i&gt;kv-change-notification&lt;/i&gt;)&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDVclljijn8bEnR-tWScUIFcdNKlhgUgFaEzW-RvJI6CT4EwGD1GEyJP9AtUUySEEj7Zl8z3guCF0CXAA-xS18qIfcozVL-tKxmCXSmvGkBKFKAP3uAqqPbVH6-xgZjJ0VXnAqp372ORQ/s818/Capture.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;627&quot; data-original-width=&quot;818&quot; height=&quot;306&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDVclljijn8bEnR-tWScUIFcdNKlhgUgFaEzW-RvJI6CT4EwGD1GEyJP9AtUUySEEj7Zl8z3guCF0CXAA-xS18qIfcozVL-tKxmCXSmvGkBKFKAP3uAqqPbVH6-xgZjJ0VXnAqp372ORQ/w400-h306/Capture.PNG&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Go to your Logic App and in the designer select the Event Grid trigger as below&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9Ih27uYsAKrvLObwxBl178_K6xxDtA_mUeYpyC0PcUrIuIseN7yVgtc-63paOzKYqxztVHa7TFX_6BQ0B2pnsXGpdfgogYojuWxzh1lPMZMoWA3izi7CjEdA8vER9pQIZh32QkFos_7Q/s1460/Capture.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;704&quot; data-original-width=&quot;1460&quot; height=&quot;309&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9Ih27uYsAKrvLObwxBl178_K6xxDtA_mUeYpyC0PcUrIuIseN7yVgtc-63paOzKYqxztVHa7TFX_6BQ0B2pnsXGpdfgogYojuWxzh1lPMZMoWA3izi7CjEdA8vER9pQIZh32QkFos_7Q/w640-h309/Capture.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Select your tenant and hit Sign In. This will ask you for your Azure credential and will create your Event Grid connector.&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqxMjUHLMfXWAPuTPlB8MX9PbgcJu0HYbK_GAHTVsQmTb7VOp3bHZApaX22UvCZWgwhMQ5QNwG2ZM78cmTMWSbGI1f-9ea6creUJtyhUiXVSDSyCW43EN07Q5NbA_DizMn3tKiGZkt4vo/s742/Capture.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;269&quot; data-original-width=&quot;742&quot; height=&quot;232&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqxMjUHLMfXWAPuTPlB8MX9PbgcJu0HYbK_GAHTVsQmTb7VOp3bHZApaX22UvCZWgwhMQ5QNwG2ZM78cmTMWSbGI1f-9ea6creUJtyhUiXVSDSyCW43EN07Q5NbA_DizMn3tKiGZkt4vo/w640-h232/Capture.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Click &quot;Continue&quot; to attach the event. Fill the details as required to connect with your KeyVault created earlier.&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxKYwmgstw-Fi0PDj6hVWOsiu0NUJ3mKikSUBOu9UwwuCVTcsqNFz4JOYxisDm34pgj2Doh_m6L6Umsdapz6AnXGZvVHkYx6RaVZcJzQOOJZbXT25fNl7rLUdE5-NXBjaBtb2cUxpuGgw/s716/Capture.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;403&quot; data-original-width=&quot;716&quot; height=&quot;360&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxKYwmgstw-Fi0PDj6hVWOsiu0NUJ3mKikSUBOu9UwwuCVTcsqNFz4JOYxisDm34pgj2Doh_m6L6Umsdapz6AnXGZvVHkYx6RaVZcJzQOOJZbXT25fNl7rLUdE5-NXBjaBtb2cUxpuGgw/w640-h360/Capture.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;b&gt;Select&lt;/b&gt; your Subscription,&amp;nbsp;&lt;/div&gt;&lt;div&gt;Resource Type as &quot;&lt;i&gt;Microsoft.KeyVault.vaults&lt;/i&gt;&quot;,&lt;/div&gt;&lt;div&gt;Resource Name is your KeyVault name (In my case I have give my vault name as &lt;i&gt;MyVault0001&lt;/i&gt;),&lt;/div&gt;&lt;div&gt;Event Type Item - 1 as &quot;&lt;i&gt;Micsrosoft.KeyVault.SecretNewVersionCreated&lt;/i&gt;&quot;&amp;nbsp;&lt;br /&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Click &quot;+ New Step&quot; to choose the event to fire if the above step holds true. Search for SendGrid and select the send email action&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVy6BcQYbzdJgWenS5tCgYUOMkCveqU-qitutdmvemyVKWd4Xwe5J8_iGRijfY38agFO8ILuWgleMn1rMdpwKsSxX5mQ5j17vuS2uOXrT2g5re9RULB1269wdR5bcoLapHgZorsaL8xOU/s675/Capture.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;675&quot; data-original-width=&quot;634&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVy6BcQYbzdJgWenS5tCgYUOMkCveqU-qitutdmvemyVKWd4Xwe5J8_iGRijfY38agFO8ILuWgleMn1rMdpwKsSxX5mQ5j17vuS2uOXrT2g5re9RULB1269wdR5bcoLapHgZorsaL8xOU/w602-h640/Capture.PNG&quot; width=&quot;602&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Provide a connection name and paste your SendGrid API . Hit Create. This will validate and would create your SendGrid connector.&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRaRt9cKQGphJT68RCy-IPdZKOpTCSxouvyVEAWY1dA4yu-hvDUdAe8vRJ62_5EGBxrZbmVgxrS6lfLciPx8VYPx8PDBa1Doyq6cvkuFA2CLSLhLgs7bhumQpOwGB6TK2u_pWDPmPuRyI/s632/Capture.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;210&quot; data-original-width=&quot;632&quot; height=&quot;212&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRaRt9cKQGphJT68RCy-IPdZKOpTCSxouvyVEAWY1dA4yu-hvDUdAe8vRJ62_5EGBxrZbmVgxrS6lfLciPx8VYPx8PDBa1Doyq6cvkuFA2CLSLhLgs7bhumQpOwGB6TK2u_pWDPmPuRyI/w640-h212/Capture.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;If the above validation is successful, the next window would ask you to provide all the mailing details. Fill it up as per the requirement. &lt;i&gt;Make sure the From and To email addresses really exists.&lt;/i&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivTiQNnqZSRntKl41YMptJIeaczmEEi5Tsr1EgA2QOpoH141MUqWBfS6IgfI0NxVGxk2X4ZocqUOns44vNRpqmqulmSVIlbiWaK6TirT87ag0BhsJurR0gkD1RUO7SGU6EnOZ7D1Dh2F0/s630/Capture.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;367&quot; data-original-width=&quot;630&quot; height=&quot;372&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivTiQNnqZSRntKl41YMptJIeaczmEEi5Tsr1EgA2QOpoH141MUqWBfS6IgfI0NxVGxk2X4ZocqUOns44vNRpqmqulmSVIlbiWaK6TirT87ag0BhsJurR0gkD1RUO7SGU6EnOZ7D1Dh2F0/w640-h372/Capture.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Hit Save at the top to save the logic app workflow. This is important.&lt;/li&gt;&lt;/ul&gt;Testing Time! 🙆&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Go to your KeyVault resource and enter a new secret.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwm4uPiXANxlw93_3sOOVknmi3A6T_7Soedtj9cdCUePM-HZl3rdV8epa4eX8ijCgVEZFdfi7tHXTFiCm5fQFIG4zr0TWlxzohAtKtCn3PlrDoCoETbYmmfiYuyV0l8yfK69TrnlN29Mg/s592/Capture.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;493&quot; data-original-width=&quot;592&quot; height=&quot;333&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwm4uPiXANxlw93_3sOOVknmi3A6T_7Soedtj9cdCUePM-HZl3rdV8epa4eX8ijCgVEZFdfi7tHXTFiCm5fQFIG4zr0TWlxzohAtKtCn3PlrDoCoETbYmmfiYuyV0l8yfK69TrnlN29Mg/w400-h333/Capture.PNG&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Check your mail. Voila! You have new mail 📧&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSv0VMONogUzGo2NXjqjyC3K9dZ1iAOPGBOXrNIqxy-qv0bs5hv6fyC4_rHbKZ_elrbiEsXzwj0EoL9NfBtq1u7AEXEwlqqGAuEsN3EYnIoZIXMe44bdo8CYFcq4C-VQ_H246hkBg4XW8/s1192/Capture.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;54&quot; data-original-width=&quot;1192&quot; height=&quot;28&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSv0VMONogUzGo2NXjqjyC3K9dZ1iAOPGBOXrNIqxy-qv0bs5hv6fyC4_rHbKZ_elrbiEsXzwj0EoL9NfBtq1u7AEXEwlqqGAuEsN3EYnIoZIXMe44bdo8CYFcq4C-VQ_H246hkBg4XW8/w640-h28/Capture.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzDMj6S5u03oHeNajJjFQv27PmTxfud6d2473hVYHI4QjHpw8t6we2mkOdgiYazmgSlmSfflZ1U-chfNcMZYOgBobZxtD3qXQ8zfoJfSrjz5omqUTeCYRACrOgBiY8EgrrMdP3NMG3UQU/s1208/Capture.PNG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;314&quot; data-original-width=&quot;1208&quot; height=&quot;166&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzDMj6S5u03oHeNajJjFQv27PmTxfud6d2473hVYHI4QjHpw8t6we2mkOdgiYazmgSlmSfflZ1U-chfNcMZYOgBobZxtD3qXQ8zfoJfSrjz5omqUTeCYRACrOgBiY8EgrrMdP3NMG3UQU/w640-h166/Capture.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;Now go ahead and modify the value of the secret in the vault and get notified once again. Great job!&lt;/div&gt;&lt;div&gt;So, with just few clicks you have developed a robust solution (that too serverless) which surely going to make the security admins very happy. Applause 👏 once again.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;color: orange;&quot;&gt;Congratulations&lt;/span&gt;&lt;/b&gt;! for coming this far. Hope this article will help you to further explore this feature.&lt;br /&gt;
&lt;div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Do share with me about your experience and what you have built upon this
 foundation. You can take it up to any level and integrate. I would love
 to hear from you.&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techiemate.blogspot.com/feeds/6581932656372003344/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techiemate.blogspot.com/2020/07/azure-security-monitor-keyvault-events.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/6581932656372003344'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6011381329995167460/posts/default/6581932656372003344'/><link rel='alternate' type='text/html' href='http://techiemate.blogspot.com/2020/07/azure-security-monitor-keyvault-events.html' title='Azure Security :  Monitor KeyVault events to generate instant notification'/><author><name>Atanu Gupta</name><uri>http://www.blogger.com/profile/05529718294081550882</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_LZ_SzyDY_u8HW4LiUYlsEJKSSMR5zYs-ow0dK7kjPtYVYnB_nHhGXM3Ad8Gt9AxMhbi0UO3mSjuYBQq2Sli5kUe05z21o-xTJYAM-Pw6TErhMe4ITlrqdadJSCp_xYQS1rf5k8diG7IlmVmai1fllCvN7o9A8b0JSaV5Gn6SCwv5zw/s220/1714907742840.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDVclljijn8bEnR-tWScUIFcdNKlhgUgFaEzW-RvJI6CT4EwGD1GEyJP9AtUUySEEj7Zl8z3guCF0CXAA-xS18qIfcozVL-tKxmCXSmvGkBKFKAP3uAqqPbVH6-xgZjJ0VXnAqp372ORQ/s72-w400-h306-c/Capture.PNG" height="72" width="72"/><thr:total>0</thr:total></entry></feed>