<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ Azure - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ Azure - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Mon, 18 May 2026 16:21:25 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/tag/azure/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ Load Balancing with Azure Application Gateway and Azure Load Balancer – When to Use Each One ]]>
                </title>
                <description>
                    <![CDATA[ You’ve probably heard someone mention load balancing when talking about cloud apps. Maybe even names like Azure Load Balancer, Azure Application Gateway, or something about Virtual Machines and Scale Sets. 😵‍💫 It all sounds important...but also a l... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/load-balancing-with-azure-application-gateway-and-azure-load-balancer/</link>
                <guid isPermaLink="false">6824f10a7d203c180e5ea4b2</guid>
                
                    <category>
                        <![CDATA[ Load Balancing ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Azure ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Azure Application Gateway ]]>
                    </category>
                
                    <category>
                        <![CDATA[ virtual machine ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Cloud ]]>
                    </category>
                
                    <category>
                        <![CDATA[ #virtual machine scale set ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Load Balancer ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Prince Onukwili ]]>
                </dc:creator>
                <pubDate>Wed, 14 May 2025 19:37:46 +0000</pubDate>
                <media:content url="https://cdn.hashnode.com/res/hashnode/image/upload/v1747235455030/cb82bfb4-8d7b-47e5-ab31-126906f60b40.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>You’ve probably heard someone mention load balancing when talking about cloud apps. Maybe even names like Azure Load Balancer, Azure Application Gateway, or something about Virtual Machines and Scale Sets. 😵‍💫</p>
<p>It all sounds important...but also a little confusing. Like, why are there so many moving parts? And what do they actually do?</p>
<p>In this guide, we’re going to break it all down – step by step – using real examples and simple language.</p>
<p>You’ll learn:</p>
<ul>
<li><p>What load balancers are (and why apps even need them)</p>
</li>
<li><p>How apps were deployed before load balancers existed (hint: everything lived on one lonely server)</p>
</li>
<li><p>How Azure Virtual Machines work – and how they let you scale up your apps</p>
</li>
<li><p>What Virtual Machine Scale Sets are, and how they help handle sudden traffic spikes</p>
</li>
<li><p>The differences between Azure Load Balancer and Azure Application Gateway, and when to use each</p>
</li>
</ul>
<p>By the end, you won’t just understand what these tools do – you’ll know <em>when</em> and <em>why</em> to use them in real-world scenarios.</p>
<p>Whether you’re a curious beginner, a hands-on builder, or someone just trying to wrap their head around Azure’s ecosystem, this guide is for you.</p>
<p>Ready to untangle the cloud spaghetti? Let’s go! 🍝🚀</p>
<h2 id="heading-table-of-contents">📚 Table of Contents</h2>
<ol>
<li><p><a class="post-section-overview" href="#heading-what-are-load-balancers">🧊 What Are Load Balancers?</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-applications-were-deployed-before-load-balancers">🖥️ How Applications Were Deployed Before Load Balancers</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-azure-virtual-machines-vms-the-building-blocks">⚙️ Azure Virtual Machines (VMs) – The Building Blocks</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-the-need-for-scaling-vertical-vs-horizontal">📈 The Need for Scaling – Vertical vs Horizontal</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-azure-virtual-machine-scale-sets-vmss-scaling-made-simple">🔁 Azure Virtual Machine Scale Sets (VMSS) – Scaling Made Simple</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-azure-load-balancer-spreading-the-traffic">📦 Azure Load Balancer – Spreading the Traffic</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-azure-application-gateway-smart-routing-for-modern-apps">🍴 Azure Application Gateway – Smart Routing for Modern Apps</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-azure-load-balancer-vs-azure-application-gateway">🔍 Azure Load Balancer vs Azure Application Gateway</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-use-cases-when-to-use-what">🧭</a> <a class="post-section-overview" href="#heading-use-cases-when-to-use-each-one">Use Cases: When to Use Each One</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-conclusion">✅ Conclusion</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-study-further">Study Further 📚</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-about-the-author">About the Author 👨‍💻</a></p>
</li>
</ol>
<h2 id="heading-what-are-load-balancers">🧊 What Are Load Balancers?</h2>
<p>Imagine you're running a small restaurant with just one chef in the kitchen. Everything goes smoothly when you have a few customers – each order is prepared one after the other, and everyone leaves satisfied.</p>
<p>But what happens when 50 people walk in all at once?</p>
<p>🍽️ One chef can’t handle that many orders at the same time.<br>⏳ People start waiting longer.<br>😤 Some customers leave.<br>💥 The chef gets overwhelmed – and eventually burns out.</p>
<p>This is what can happen to a server (the computer running your app) when too many users try to access it at the same time.</p>
<h3 id="heading-so-what-does-a-load-balancer-do">So, What Does a Load Balancer Do?</h3>
<p>A <strong>load balancer</strong> is like a smart restaurant manager. But instead of food orders, it handles user requests – the things people do when they open your app, click buttons, or load data.</p>
<p>Let’s say you now have three chefs (servers) instead of one. The load balancer’s job is to:</p>
<ul>
<li><p>👀 Watch for incoming orders (user requests)</p>
</li>
<li><p>🧠 Decide which chef (server) is available or least busy</p>
</li>
<li><p>🍽️ Send that request to the right one</p>
</li>
<li><p>🔁 Repeat this over and over, making sure things stay fast and smooth</p>
</li>
</ul>
<p>So in simple terms, a load balancer takes all the incoming traffic to your app and distributes it across multiple servers so no single server gets overloaded – cool, right? 🙂</p>
<h3 id="heading-why-were-load-balancers-introduced">Why Were Load Balancers Introduced?</h3>
<p>Back in the early days, many applications were hosted on just one machine – called a Single Server Deployment.</p>
<p>That was okay when you had a small number of users. But once things started to grow – more users, more actions, more data – single servers became a bottleneck:</p>
<ul>
<li><p>They could only handle a limited number of requests.</p>
</li>
<li><p>If they went down, your entire app would stop working.</p>
</li>
<li><p>Scaling (adding more power) was expensive and manual.</p>
</li>
</ul>
<p>💡 Enter <strong>load balancers</strong> – designed to solve this by making it possible to:</p>
<ul>
<li><p>Spread traffic across multiple servers (so no one server crashes under pressure),</p>
</li>
<li><p>Replace or restart servers without downtime,</p>
</li>
<li><p>Add or remove servers as needed, depending on how busy your app is (this is called <strong>scaling</strong>).</p>
</li>
</ul>
<h3 id="heading-a-simple-use-case-scenario">A Simple Use-Case Scenario</h3>
<p>Let’s say you're building an online store — your own mini Amazon. At first, you host your app on one Azure Virtual Machine. Things are great. But one day, you run a huge promo and suddenly…thousands of people flood in to browse, shop, and check out.</p>
<p>Your single VM starts lagging.</p>
<p>Orders fail. People complain. Your dream app? Crashing fast. 💥</p>
<p>So what do you do?</p>
<p>You spin up two more VMs to help out – but now you’ve got another problem: <em>How do you divide the traffic between the three?</em></p>
<p>This is where the load balancer steps in. It:</p>
<ul>
<li><p>Looks at every incoming user request</p>
</li>
<li><p>Figures out which VM is available and least busy</p>
</li>
<li><p>Sends the request there</p>
</li>
<li><p>Keeps rotating requests in real-time</p>
</li>
</ul>
<p>And the result?<br>✅ No single VM gets overwhelmed<br>✅ Your app stays fast and responsive<br>✅ Users are happy (and buying stuff again!)</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1746980088916/41be330b-8d5b-4709-b07d-3f1a19d641e7.png" alt="Load balancer illustration" class="image--center mx-auto" width="1204" height="672" loading="lazy"></p>
<h2 id="heading-how-applications-were-deployed-before-load-balancers">🖥️ How Applications Were Deployed Before Load Balancers</h2>
<p>Before cloud tools like load balancers came along, the typical way to run an application was pretty simple: You’d deploy the entire app on a single server, like running a small business from one tiny shop.</p>
<h3 id="heading-first-things-first-whats-a-server">First Things First: What’s a Server?</h3>
<p>Think of a server as a special computer that’s always connected to the internet. Its job is to “serve” your app to people when they visit your website, open your app, or use your service.</p>
<p>In cloud platforms like Azure, we usually call these Virtual Machines (VMs) – basically, software-powered servers you can spin up with a few clicks.</p>
<h3 id="heading-monoliths-vs-microservices">Monoliths vs Microservices</h3>
<p>Now, applications come in different “shapes.” The two most common are:</p>
<ul>
<li><p><strong>Monoliths</strong>: Everything is bundled together into one big app. All the code – from user login to shopping cart to checkout – lives in a single unit.</p>
</li>
<li><p><strong>Microservices</strong>: The app is broken into smaller, independent apps (services). Each service does one job – like login, payments, orders – and runs separately.</p>
</li>
</ul>
<h4 id="heading-how-were-these-apps-deployed">How Were These Apps Deployed?</h4>
<p>Whether it was a monolith or a bunch of microservices, they were all usually deployed on a single server (VM).</p>
<p>For monoliths, you just ran the entire app directly on the server. For microservices: you'd run each service in a separate space on that same server, using <strong>containers</strong>.</p>
<h4 id="heading-wait-whats-a-container">Wait — What’s a Container?</h4>
<p>A container is like a mini-computer <em>inside</em> a computer. It has everything an app needs to run – code, tools, settings – and it keeps each app isolated from the others.</p>
<p>Why use containers?</p>
<ul>
<li><p>You can run multiple services on the same server without their underlying software (software needed for each app to run) interfering with each other.</p>
</li>
<li><p>It’s faster and more efficient than installing everything directly on the server.</p>
</li>
<li><p>They make moving apps between environments (for example, test → production) super smooth (no more “But, it works on my machine…”).</p>
</li>
</ul>
<p>Popular tools like Docker make working with containers easy.</p>
<h4 id="heading-connecting-it-all-together-domains-subdomains-and-reverse-proxies">Connecting It All Together: Domains, Subdomains, and Reverse Proxies</h4>
<p>When your app lives on a server, you want people to be able to reach it. That’s where <strong>domain names</strong> come in.</p>
<ul>
<li><p>Your server has a public IP address – a set of numbers like <code>102.80.1.23</code>, that gives it a unique identifier on the public internet</p>
</li>
<li><p>But instead of asking users to type numbers, you link that IP to a domain name, like <code>mycoolapp.com</code></p>
</li>
</ul>
<p>If your app has microservices, you might even assign <strong>subdomains</strong> like:</p>
<ul>
<li><p><code>api.mycoolapp.com</code> for the backend</p>
</li>
<li><p><code>dashboard.mycoolapp.com</code> for the user interface</p>
</li>
<li><p><code>payments.mycoolapp.com</code> for payments</p>
</li>
</ul>
<p>To manage all this, you’d use a <strong>reverse proxy</strong> (like Nginx or Apache). It listens on the main domain and subdomains, and forwards traffic to the right app or service.</p>
<p>Example:</p>
<ul>
<li><p>Someone visits <code>dashboard.mycoolapp.com</code></p>
</li>
<li><p>The reverse proxy checks the domain and forwards the request to the correct container running the dashboard service</p>
</li>
</ul>
<p>And to help with all of this setup – from deploying containers to configuring reverse proxies – there are developer-friendly tools like <a target="_blank" href="https://coolify.io">Coolify</a>. Coolify is an open-source platform that makes it super easy for developers and DevOps teams to:</p>
<ul>
<li><p>Deploy apps in containers</p>
</li>
<li><p>Set up domains and subdomains</p>
</li>
<li><p>Configure reverse proxies – all from a clean dashboard, no complex terminal commands needed</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1746979943646/a6525a09-f44a-4e00-a945-7bded3483b0d.jpeg" alt="Coolify dashboard example" class="image--center mx-auto" width="1788" height="853" loading="lazy"></p>
<p>All this was set up on ONE SERVER/VM. But here’s the catch: when that one server got overloaded or went down…💥 everything stopped.</p>
<p>That’s why we needed a better way. And that's where <strong>scaling</strong> and <strong>load balancing</strong> came in – to keep apps running smoothly, no matter the traffic.</p>
<h2 id="heading-azure-virtual-machines-vms-the-building-blocks">⚙️ Azure Virtual Machines (VMs) – The Building Blocks</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1746980948928/eb6a7fb2-7432-42ed-8cbd-bff6c8250d4e.jpeg" alt="Virtual Machine illustration" class="image--center mx-auto" width="1280" height="640" loading="lazy"></p>
<p>When it comes to running apps in the cloud, <strong>Virtual Machines (VMs)</strong> are the basic building blocks – kind of like renting an apartment in a giant digital skyscraper.</p>
<p>You don’t need to buy the whole building (aka physical servers), you just rent the space you need, when you need it.</p>
<h3 id="heading-what-exactly-is-a-virtual-machine">What Exactly Is a Virtual Machine?</h3>
<p>A Virtual Machine is a software-based computer that runs inside a real, physical computer (a server) – hosted in a data center, like those run by Microsoft Azure.</p>
<p>It looks and behaves like a normal computer:</p>
<ul>
<li><p>It has an operating system (Windows, Linux)</p>
</li>
<li><p>You can install apps</p>
</li>
<li><p>It has memory (RAM), storage (disks), and CPU</p>
</li>
</ul>
<p>But the best part? You don’t need to worry about the hardware. Azure takes care of that behind the scenes – all you do is say:</p>
<blockquote>
<p>“Hey Azure, give me a Linux VM with 4GB RAM and 2 CPUs.”</p>
</blockquote>
<p>And boom 💥 — it spins up in minutes.</p>
<h3 id="heading-why-use-a-vm">Why Use a VM?</h3>
<p>Let’s say you’ve built a web app – it’s just a simple blog. You want to deploy it and make it accessible to the world.</p>
<p>Here's what you can do with a VM:</p>
<ul>
<li><p>Set it up with your favorite OS (for example, Ubuntu)</p>
</li>
<li><p>Install web servers like Nginx or Apache</p>
</li>
<li><p>Deploy your app</p>
</li>
<li><p>Bind it to your domain name</p>
</li>
<li><p>Let the world visit your blog at <a target="_blank" href="http://myawesomeblog.com"><code>myawesomeblog.com</code></a></p>
</li>
</ul>
<p>It’s your own personal environment – no sharing, full control.</p>
<h2 id="heading-the-need-for-scaling-vertical-vs-horizontal">📈 The Need for Scaling – Vertical vs Horizontal</h2>
<p>Imagine your app is growing. At first, it’s just a few users. Then a few hundred. Then thousands are logging in, placing orders, chatting, uploading photos – all at once 😮</p>
<p>Suddenly, your server (VM) is under pressure. It’s like trying to pour a flood through a straw.</p>
<h3 id="heading-so-what-do-you-do-when-one-server-isnt-enough">So, What Do You Do When One Server Isn’t Enough?</h3>
<p>This is where scaling comes in – the art of upgrading your app’s infrastructure to keep up with traffic.</p>
<p>There are two main ways to scale:</p>
<h4 id="heading-option-1-vertical-scaling-aka-scaling-up">🧱 Option 1: Vertical Scaling (aka Scaling Up)</h4>
<p>You take your existing VM and give it more power:</p>
<ul>
<li><p>Add more CPUs 🧠</p>
</li>
<li><p>Increase RAM 🧵</p>
</li>
<li><p>Add faster disks ⚡</p>
</li>
</ul>
<p>Think of it like upgrading from a regular car to a sports car. It’s the same vehicle, just faster and stronger.</p>
<p><strong>Pros:</strong></p>
<ul>
<li><p>Simple to do</p>
</li>
<li><p>No major changes to your app setup</p>
</li>
</ul>
<p><strong>Cons:</strong></p>
<ul>
<li><p>There’s a limit to how much you can upgrade</p>
</li>
<li><p>Still a single point of failure: if the VM crashes, everything goes down 😬</p>
</li>
</ul>
<h4 id="heading-option-2-horizontal-scaling-aka-scaling-out">🧩 Option 2: Horizontal Scaling (aka Scaling Out)</h4>
<p>Instead of boosting one server, you add more servers – multiple VMs running copies of your app.</p>
<p>Now:</p>
<ul>
<li><p>Users can be distributed across all these VMs</p>
</li>
<li><p>If one goes down, others keep serving traffic</p>
</li>
<li><p>You can <em>dynamically</em> add or remove VMs based on traffic</p>
</li>
</ul>
<p>It’s like opening more checkout counters in a busy supermarket 🛒</p>
<p><strong>Pros:</strong></p>
<ul>
<li><p>The load is evenly distributed. For example, if one server previously handled 100% of the traffic, adding two more servers would result in the traffic being split into approximately 33% to 34% for each server.</p>
</li>
<li><p>Improves both performance and reliability</p>
</li>
<li><p>You can scale based on real-time demand, that is traffic inflow</p>
</li>
</ul>
<p><strong>Cons:</strong></p>
<ul>
<li><p>Needs something to split traffic between VMs – Load Balancers</p>
</li>
<li><p>More expensive. You end up paying the original amount for 1 VM (for example $30) for the number of VMs you provide – if you provide 3 VMs at $30 each, you end up paying $90 at the end of the month</p>
</li>
</ul>
<h3 id="heading-quick-real-world-example">Quick Real-World Example</h3>
<p>Let’s say you’ve launched an e-commerce site for sneakers 👟 Traffic spikes during a big sale? Your vertical scaling (bigger VM) might choke.</p>
<p>But with horizontal scaling:</p>
<ul>
<li><p>You spin up 5 VMs across different regions</p>
</li>
<li><p>Traffic is shared between them</p>
</li>
<li><p>If one VM slows down, others handle the load</p>
</li>
</ul>
<h4 id="heading-so-remember">So, remember 👇🏾</h4>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Scaling Type</td><td>Description</td><td>Pros</td><td>Cons</td></tr>
</thead>
<tbody>
<tr>
<td>🧱 Vertical Scaling</td><td>Make 1 VM more powerful (adding more CPU power, SSD, RAM, bandwidth, and so on)</td><td>Easy setup, fewer changes</td><td>Hardware limits, 1 point of failure - If that 1 server/VM goes down, so does your app :(</td></tr>
<tr>
<td>🧩 Horizontal Scaling</td><td>Add more VMs to handle traffic</td><td>Flexible, reliable</td><td>Needs traffic distribution logic (Load Balancer). Usually more expensive (the price of 1 VM times the number of VMs)</td></tr>
</tbody>
</table>
</div><h2 id="heading-azure-virtual-machine-scale-sets-vmss-scaling-made-simple">🔁 Azure Virtual Machine Scale Sets (VMSS) – Scaling Made Simple</h2>
<p>Okay – so we’ve talked about <strong>horizontal scaling</strong>: adding multiple VMs to handle growing traffic. Sounds great, right?</p>
<p>But here’s the thing: manually spinning up and configuring 5, 10, or 100 VMs... every time your app gets busy? Yeah, that’s not fun 🙃</p>
<h3 id="heading-enter-virtual-machine-scale-sets-vmss">Enter: Virtual Machine Scale Sets (VMSS)</h3>
<p>VMSS is Azure’s way of automating horizontal scaling. Instead of creating each VM one by one, you define a template, and Azure takes care of the rest:</p>
<ul>
<li><p>How many VMs to start with</p>
</li>
<li><p>How to configure them (OS, apps, settings) ⚙️</p>
</li>
<li><p>When to add or remove VMs based on traffic 📈📉</p>
</li>
</ul>
<h3 id="heading-a-simple-analogy">A Simple Analogy 🧃</h3>
<p>Think of VMSS like a juice dispenser at a party:</p>
<ul>
<li><p>At first, it pours into 2 cups (VMs)</p>
</li>
<li><p>If 10 guests show up? It starts filling 5 cups</p>
</li>
<li><p>Party slows down? Back to 2 cups again</p>
</li>
</ul>
<p>You never have to refill manually – the dispenser adjusts on its own. 🎉</p>
<h3 id="heading-how-it-works-without-the-jargon">How It Works (Without the Jargon 😌)</h3>
<ol>
<li><p><strong>You set the rules:</strong> “If CPU usage goes above 70%, add 2 more VMs.”</p>
</li>
<li><p><strong>Azure watches traffic and adjusts the number of VMs</strong> automatically.</p>
</li>
<li><p><strong>All VMs are identical</strong> – like clones, all running the same app setup.</p>
</li>
<li><p><strong>It works with Azure Load Balancer</strong> to spread traffic across all these VMs smoothly.</p>
</li>
</ol>
<h3 id="heading-real-life-example-food-delivery-app">Real-Life Example: Food Delivery App 🍕📱</h3>
<p>You’ve built an app where users order food. During lunch and dinner, traffic explodes.</p>
<p>💡 With VMSS:</p>
<ul>
<li><p>You start with 3 VMs in the morning</p>
</li>
<li><p>At 12PM, Azure sees high CPU usage, so it spins up 5 more VMs</p>
</li>
<li><p>At 3PM, traffic drops, so Azure removes the extra VMs</p>
</li>
</ul>
<p>You only pay for what you use. And users get a smooth experience – no delays, no crashes 👌🏾</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1746982520998/7fe3c997-fc8f-418a-861b-e999905ca43c.png" alt="Auto-scaling illustration" class="image--center mx-auto" width="455" height="176" loading="lazy"></p>
<h2 id="heading-azure-load-balancer-spreading-the-traffic">📦 Azure Load Balancer – Spreading the Traffic</h2>
<p>By now, you know that your app can live on multiple Virtual Machines (VMs), and that you can scale them easily using Virtual Machine Scale Sets (VMSS).</p>
<p>But here's the big question: when users start accessing your app – hundreds, even thousands at once – how do you make sure that all that traffic is fairly and efficiently distributed across those VMs?</p>
<p>You don’t want one VM to be overwhelmed while others are just chilling. You need a middleman – something smart enough to balance the load.</p>
<p>That’s where <strong>Azure Load Balancer</strong> steps in. It’s Azure’s way of saying, “Don’t worry, I got this” when traffic starts rolling in.</p>
<h3 id="heading-so-what-is-azure-load-balancer">🏢 So, What Is Azure Load Balancer?</h3>
<p>Azure Load Balancer is a <strong>traffic director</strong>. It takes incoming traffic from the internet (or even internal sources within your network) and intelligently spreads it across multiple backend machines – usually VMs.</p>
<p>It's like having a well-trained receptionist who routes every customer to the next available agent, so no one waits too long and no one gets overwhelmed 😃.</p>
<p>And the best part? This entire process happens in the background – fast, silent, and seamless. Users visiting your app have no idea a traffic manager is working behind the scenes. They just see a fast, responsive experience.</p>
<h3 id="heading-the-frontend-ip-your-apps-public-face">🌐 The Frontend IP – Your App’s Public Face</h3>
<p>Every Azure Load Balancer is tied to a <strong>Frontend IP</strong>, which is basically the public IP address of your application – the one users connect to when they open <code>www.yourapp.com</code>.</p>
<p>This IP acts as the entry point. All user traffic comes through it first. But the Load Balancer doesn’t actually run your app. Instead, it accepts the traffic and forwards it to one of the VMs in the backend pool (we’ll get to that shortly).</p>
<p>You can configure this Frontend IP to be either public (accessible over the internet) or private (used for internal traffic within your cloud network – say, between microservices or internal tools).</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747055268951/5afbb738-d00d-4f49-9709-2fa1fe7cffdd.png" alt="Frontend IP address illustration" class="image--center mx-auto" width="603" height="245" loading="lazy"></p>
<h3 id="heading-backend-pool-where-the-magic-happens">🗂️ Backend Pool – Where the Magic Happens</h3>
<p>Behind every Azure Load Balancer is a <strong>backend pool</strong> – a group of VMs (or VM Scale Set instances) where your actual app is running. These are the real workers, doing all the heavy lifting.</p>
<p>When traffic hits the Frontend IP, the Load Balancer takes that request and hands it off to one of the VMs in the backend pool.</p>
<p>But it doesn’t just randomly pick one. It checks a few things first – like whether the VM is healthy, whether it's already busy, and what rules you’ve set.</p>
<p>Each VM in the pool typically runs the same app or service. This means any of them can handle any incoming request, which is what makes load balancing possible in the first place.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747055337014/e831056d-7c0c-49d9-b05a-6d3dbe3edc76.png" alt="Backend pool illustration" class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
<h3 id="heading-health-probes-keeping-tabs-on-the-vms">🩺 Health Probes – Keeping Tabs on the VMs</h3>
<p>Now, how does the Load Balancer know which VM is healthy or not? This is where <strong>health probes</strong> come in. Think of them as regular check-ups.</p>
<p>You configure the Load Balancer to periodically "ping" each VM – maybe by hitting a specific URL (like <code>/health</code>) or a certain port (like 80 for HTTP). If a VM doesn’t respond correctly, Azure marks it as unhealthy and temporarily removes it from the rotation.</p>
<p>This ensures users never get routed to a broken or unresponsive instance of your app. And once the VM becomes healthy again, it's automatically added back to the pool.</p>
<h3 id="heading-load-balancing-rules-who-gets-what">⚖️ Load Balancing Rules – Who Gets What?</h3>
<p>Next, we have <strong>Load Balancing Rules</strong>. These are the instructions that tell Azure Load Balancer exactly how to behave.</p>
<p>You can define rules like:</p>
<ul>
<li><p>“Forward all HTTP (port 80) traffic to backend pool VMs on port 80”</p>
</li>
<li><p>“Forward HTTPS (port 443) traffic to VMs on port 443”</p>
</li>
<li><p>“Only route traffic to healthy VMs”</p>
</li>
</ul>
<p>These rules make Azure Load Balancer highly customizable. You get to decide how traffic flows, which protocols to support, and how to handle backend ports. It's like customizing the rules of a relay race – who gets the baton and when.</p>
<h3 id="heading-real-world-example-sneaker-sale-rush">👟 Real-World Example: Sneaker Sale Rush</h3>
<p>Imagine you're running an online sneaker store at <code>www.sneakerblast.com</code>. You’re launching a flash sale, and thousands of users are hitting your website all at once.</p>
<p>Thanks to your Azure Load Balancer, here’s what happens:</p>
<ol>
<li><p>All those users land on your Frontend IP, the public face of your site.</p>
</li>
<li><p>The Load Balancer accepts the traffic and checks the health probes of all VMs in the backend pool.</p>
</li>
<li><p>Based on its rules, it forwards each user to a healthy, available VM.</p>
</li>
<li><p>One VM might serve a user in Lagos, another in Nairobi, another in Accra – all seamlessly.</p>
</li>
</ol>
<p>If one VM crashes or lags? The Load Balancer detects it instantly and stops routing traffic to it until it’s back online.</p>
<p>That’s smooth traffic management without any manual effort.</p>
<h2 id="heading-azure-application-gateway-smart-routing-for-modern-apps">🍴 Azure Application Gateway – Smart Routing for Modern Apps</h2>
<p>So far, we’ve seen how Azure Load Balancer helps you split traffic across multiple VMs running a single service – like a monolithic app or a web frontend.</p>
<p>Let’s say you have a web application deployed on a VM. It listens on port 80, and you’ve scaled it into 3 instances. The Azure Load Balancer takes requests from the internet and spreads them across all 3 instances of the same service. Easy, right?</p>
<p>You can even link the Load Balancer’s public IP address to your domain – like <code>mydomain.com</code> – so users can visit your site normally.</p>
<h3 id="heading-but-what-if-you-have-multiple-services">🧠 But What If You Have <em>Multiple</em> Services?</h3>
<p>Now imagine you’ve gone beyond just one app. You’re building something more modern, like a set of microservices.</p>
<p>You now have:</p>
<ul>
<li><p>A payment service listening on port 5000</p>
</li>
<li><p>An authentication service on port 6000</p>
</li>
<li><p>A purchase service on port 7000</p>
</li>
</ul>
<p>All deployed across the same VMs (or Virtual Machine Scale Set), just on different ports.</p>
<p>Here’s the problem: an Azure Load Balancer is designed to route traffic to <em>one</em> backend pool – basically one service – on one port. If you tie it to <code>mydomain.com</code>, it can only send traffic to one of your microservices. 😬</p>
<p>So… what do you do?</p>
<p>You might think: “Let me just create a separate Load Balancer for each service!” 🤕</p>
<p>But that means:</p>
<ul>
<li><p>You’ll have to pay for multiple load balancers</p>
</li>
<li><p>You’ll end up managing 3–5 public IP addresses</p>
</li>
<li><p>You might even need to buy multiple domains like <code>mypayment.com</code>, <code>myauth.com</code>, and so on to route users properly</p>
</li>
</ul>
<p>Yikes. That’s impractical, messy, <em>and</em> expensive 😖💸</p>
<h3 id="heading-enter-azure-application-gateway">🎉 Enter Azure Application Gateway</h3>
<p><strong>Azure Application Gateway</strong> solves this problem beautifully. It’s designed to route traffic intelligently – not just to one service, but to multiple services using just one gateway.</p>
<p>It works like this:</p>
<ol>
<li><p>You create one public-facing frontend IP (like <code>52.160.100.5</code>)</p>
</li>
<li><p>You link that IP address to your main domain, for example <code>mydomain.com</code></p>
</li>
<li><p>Then, you define multiple backend pools – one for each service:</p>
<ul>
<li><p>Payment service (port 5000)</p>
</li>
<li><p>Auth service (port 6000)</p>
</li>
<li><p>Purchase service (port 7000)</p>
</li>
</ul>
</li>
<li><p>Next, you set up routing rules that decide how to forward each request.</p>
</li>
</ol>
<h3 id="heading-two-ways-to-route-with-application-gateway">✨ Two Ways to Route with Application Gateway</h3>
<p>You can configure <strong>smart routing</strong> based on:</p>
<ul>
<li><p><strong>URL paths</strong>:</p>
<ul>
<li><p><code>mydomain.com/payment</code> → Payment service</p>
</li>
<li><p><code>mydomain.com/auth</code> → Auth service</p>
</li>
</ul>
</li>
<li><p><strong>Subdomains</strong> (host headers):</p>
<ul>
<li><p><code>payment.mydomain.com</code> → Payment service</p>
</li>
<li><p><code>auth.mydomain.com</code> → Auth service</p>
</li>
</ul>
</li>
</ul>
<p>This way, all your services share one public IP and one domain – super clean, super efficient 🙌🏾</p>
<h3 id="heading-real-life-scenario-lets-break-it-down">🤓 Real-Life Scenario (Let’s Break It Down)</h3>
<p>Let’s say you’re building a startup platform that has three key microservices:</p>
<ul>
<li><p><strong>Payment service</strong> that handles transactions</p>
</li>
<li><p><strong>Authentication service</strong> that handles login and user identity</p>
</li>
<li><p><strong>Purchase service</strong> that manages product ordering</p>
</li>
</ul>
<p>Each service is containerized and deployed on the same VM (or across several VMs using a VM Scale Set). But – and this is key – they all listen on <strong>different ports</strong> inside the VMs:</p>
<ul>
<li><p>Payment → port 3000</p>
</li>
<li><p>Auth → port 6000</p>
</li>
<li><p>Purchase → port 7000</p>
</li>
</ul>
<p>Now, without a smart routing solution, you’d be stuck trying to expose just one of these services using a standard Azure Load Balancer. But you need all three to be accessible from the internet – and you don’t want to pay for or manage 3 different Load Balancers 😅</p>
<p>So, what do you do?</p>
<h3 id="heading-using-azure-application-gateway-to-route-traffic-intelligently">🧠 Using Azure Application Gateway to Route Traffic Intelligently</h3>
<p>Here's how you can fix this using <strong>one</strong> Application Gateway:</p>
<ol>
<li><p>Deploy your microservices inside each VM:</p>
<ul>
<li><p>Each service runs on a specific port</p>
</li>
<li><p>All VMs in your scale set are identical (they contain all three services)</p>
</li>
</ul>
</li>
<li><p>Create backend pools in Application Gateway:</p>
<ul>
<li><p>A backend pool for the payment service (pointing to port 3000 on all VMs)</p>
</li>
<li><p>One for the auth service (port 6000)</p>
</li>
<li><p>Another for the purchase service (port 7000)</p>
</li>
</ul>
</li>
<li><p>Create routing rules:</p>
<ul>
<li><p>Option A (Path-based routing):</p>
<ul>
<li><p>Requests to <code>mydomain.com/payment</code> → go to the payment backend pool</p>
</li>
<li><p>Requests to <code>mydomain.com/auth</code> → go to the auth backend pool</p>
</li>
<li><p>Requests to <code>mydomain.com/purchase</code> → go to the purchase backend pool</p>
</li>
</ul>
</li>
<li><p>Option B (Subdomain-based routing):</p>
<ul>
<li><p><code>payment.mydomain.com</code> → payment service</p>
</li>
<li><p><code>auth.mydomain.com</code> → auth service</p>
</li>
<li><p><code>purchase.mydomain.com</code> → purchase service</p>
</li>
</ul>
</li>
</ul>
</li>
</ol>
<p>You just tell the Application Gateway: “Hey, if a request comes in for this URL or subdomain, send it to this port on these VMs.” And it does just that – consistently and intelligently 🔁</p>
<h3 id="heading-so-whats-really-happening">📦 So, What’s Really Happening?</h3>
<p>Imagine a user visits <code>mydomain.com/auth</code>. Here’s what goes on behind the scenes:</p>
<ol>
<li><p>The DNS translates <code>mydomain.com</code> to your Application Gateway’s public IP</p>
</li>
<li><p>The Gateway receives the request</p>
</li>
<li><p>It checks your routing rules</p>
</li>
<li><p>It sees that <code>/auth</code> should go to the backend pool for port 6000</p>
</li>
<li><p>It forwards the request to one of the VMs running the auth service</p>
</li>
<li><p>The response goes back to the user – fast and seamless ✨</p>
</li>
</ol>
<p>This happens in milliseconds, for every request. And because the Application Gateway is aware of multiple ports and services, it can handle routing logic that a regular Load Balancer just can’t do.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747056436345/7ea97231-d2ee-4f63-aff1-50595e7c06e0.png" alt="Application Gateway Illustration" class="image--center mx-auto" width="2048" height="1255" loading="lazy"></p>
<h2 id="heading-azure-load-balancer-vs-azure-application-gateway">🔍 Azure Load Balancer vs Azure Application Gateway</h2>
<p>By now, you've seen how both tools help route traffic in Azure – but they solve different problems.</p>
<p>Let’s break down how they compare, and when you should use one over the other 👇🏾</p>
<h3 id="heading-1-routing-logic">🛣️ 1. <strong>Routing Logic</strong></h3>
<p><strong>Azure Load Balancer</strong><br>It simply distributes incoming traffic evenly across a pool of VMs. It doesn’t care <em>what</em> the request is – it just balances the load.  </p>
<p>Imagine a delivery guy who doesn't ask questions – he just drops each package at the next available house.  </p>
<p>That’s what Azure Load Balancer does: it sends traffic to one of your servers without looking inside the request.</p>
<p><strong>Azure Application Gateway</strong><br>This is the smart one. It looks at <em>what’s inside</em> each request (like the URL path or domain) and makes intelligent decisions.</p>
<p>Just like a smarter delivery guy who looks at the address and decides where to go: "Oh! This one is for the payment office, not the main office."  </p>
<p>That’s what Application Gateway does: it reads the request (like the URL or domain name) and sends it to the right place according to the routing rules.</p>
<h3 id="heading-2-protocols-handled">🌐 2. <strong>Protocols Handled</strong></h3>
<p><strong>Load Balancer</strong><br>Works at the transport layer (Layer 4 in the OSI model). It deals with TCP/UDP traffic – raw network traffic, like HTTP, video streaming, games, and so on.</p>
<p><strong>Application Gateway</strong><br>Works at the application layer (Layer 7). It handles web traffic only – like websites and apps (HTTP/HTTPS) – and it can actually read what's being asked, like:</p>
<ul>
<li><p>“Go to /login”</p>
</li>
<li><p>“Go to <a target="_blank" href="http://payment.mydomain.com">payment.mydomain.com</a>”.</p>
</li>
</ul>
<p>TL;DR: Load Balancer just pushes packets. App Gateway actually <em>reads</em> your web requests.</p>
<h3 id="heading-3-use-case-scenarios">🔁 3. <strong>Use Case Scenarios</strong></h3>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Situation</td><td>Best Choice</td></tr>
</thead>
<tbody>
<tr>
<td>You have one big app and just want to spread users across servers</td><td>✅ Load Balancer</td></tr>
<tr>
<td>You have multiple services (like login, payment, and so on) and need to send users to the right one</td><td>✅ Application Gateway</td></tr>
<tr>
<td>You want to use subdomains (like <a target="_blank" href="http://login.mysite.com">login.mysite.com</a>)</td><td>✅ Application Gateway</td></tr>
<tr>
<td>You want to secure your website with HTTPS and Web Application Firewall (WAF)</td><td>✅ Application Gateway</td></tr>
<tr>
<td>You want the simplest setup and lowest cost</td><td>✅ Load Balancer</td></tr>
</tbody>
</table>
</div><h3 id="heading-4-ssl-termination-amp-security-features">🔐 4. <strong>SSL Termination &amp; Security Features</strong></h3>
<p><strong>Load Balancer</strong> doesn’t handle security stuff. You’ll need to secure each server yourself (for example, set up HTTPS on each one).</p>
<p><strong>Application Gateway</strong> can secure everything in one place – you upload your SSL certificate once and it takes care of HTTPS for all services.</p>
<p>It can also protect you from hackers and bad traffic with something called <strong>WAF (Web Application Firewall)</strong>, which protects your app from threats like SQL injection, XSS, and so on (you need to set this up manually).</p>
<h3 id="heading-5-pricing-and-complexity">💰 5. <strong>Pricing and Complexity</strong></h3>
<p><strong>Load Balancer</strong> is cheaper and easier to set up. Great when you don’t need anything fancy.</p>
<p><strong>Application Gateway</strong> costs more, but gives you more control and less headache when working with complex apps and microservices.</p>
<p>Trying to use Load Balancer for multiple services? You’ll need to create one Load Balancer per service, which becomes costly and impractical.</p>
<h3 id="heading-summary-table">🧠 Summary Table</h3>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Feature</td><td>Load Balancer</td><td>Application Gateway</td></tr>
</thead>
<tbody>
<tr>
<td>Can it understand the request?</td><td>❌ No</td><td>✅ Yes</td></tr>
<tr>
<td>Can it route based on URL or subdomain?</td><td>❌ No</td><td>✅ Yes</td></tr>
<tr>
<td>Can it handle secure HTTPS traffic?</td><td>❌ No</td><td>✅ Yes</td></tr>
<tr>
<td>Is it good for simple apps?</td><td>✅ Yes</td><td>✅ Yes</td></tr>
<tr>
<td>Is it good for complex apps with many services?</td><td>❌ No</td><td>✅ Yes</td></tr>
<tr>
<td>Cost</td><td>💲 Lower</td><td>💰 Higher</td></tr>
</tbody>
</table>
</div><h2 id="heading-use-cases-when-to-use-each-one">🧭 Use Cases: When to Use Each One</h2>
<p>There’s no one-size-fits-all when it comes to hosting apps in the cloud. The right setup depends on what you’re building, how much traffic you expect, and how complex your app is.</p>
<p>Let’s walk through 4 different use-case scenarios, starting from the most basic setup all the way to a fully auto-scaled and smartly routed architecture.</p>
<h3 id="heading-1-single-vm-instance-for-small-projects-or-internal-tools">1️⃣ <strong>Single VM Instance – For Small Projects or Internal Tools</strong></h3>
<p><strong>Use this when:</strong><br>You're just getting started. You’ve built a small app – maybe a portfolio, a blog, or a side project – and you want to make it live, OR You’re a startup that just launched.</p>
<p><strong>How it works:</strong><br>You spin up one Azure VM, install your app on it, and open the port it listens on (for example, port 80 for a web server). You can then attach a public IP to the VM and bind it to a custom domain like <code>myawesomeapp.com</code>.</p>
<p><strong>Real-life examples:</strong></p>
<ul>
<li><p>A developer hosting a portfolio website or blog</p>
</li>
<li><p>A startup testing a new product with only a few users</p>
</li>
<li><p>An internal company tool for a small team</p>
</li>
</ul>
<p><strong>Pros:</strong></p>
<ul>
<li><p>Super simple setup</p>
</li>
<li><p>Low cost</p>
</li>
<li><p>Full control of your environment</p>
</li>
</ul>
<p><strong>Cons:</strong></p>
<ul>
<li><p>If the VM goes down, your app goes down</p>
</li>
<li><p>No auto-scaling – performance may drop with traffic spikes (the only way to adapt to increased CPU/memory usage due to traffic inflow is via manually scaling the VM vertically)</p>
</li>
<li><p>You manually maintain and monitor everything</p>
</li>
</ul>
<h3 id="heading-2-manual-horizontal-scaling-for-apps-with-medium-predictable-traffic">2️⃣ <strong>Manual Horizontal Scaling – For Apps With Medium, Predictable Traffic</strong></h3>
<p><strong>Use this when:</strong><br>Your app is growing – maybe you have a few thousand users now, and performance matters. You want more than one server so your app doesn’t crash during busy hours.</p>
<p><strong>How it works:</strong><br>You manually create 2 or 3 Azure VMs with the same app setup. You then add a Load Balancer in front to split traffic evenly across them.</p>
<p><strong>Real-life examples:</strong></p>
<ul>
<li><p>A business with a customer portal</p>
</li>
<li><p>A school website that handles regular logins, lecture video streaming, and so on during class hours</p>
</li>
<li><p>An app that gets traffic mostly during the day (predictable load)</p>
</li>
</ul>
<p><strong>Pros:</strong></p>
<ul>
<li><p>Better performance and availability</p>
</li>
<li><p>Load is shared across multiple VMs</p>
</li>
<li><p>You can scale manually when needed</p>
</li>
</ul>
<p><strong>Cons:</strong></p>
<ul>
<li><p>You must manually add or remove VMs – which takes effort</p>
</li>
<li><p>Still need to monitor performance manually</p>
</li>
<li><p>No built-in automation or auto-healing</p>
</li>
</ul>
<h3 id="heading-3-auto-scaling-with-vm-scale-sets-azure-load-balancer-for-apps-with-spiky-or-unpredictable-traffic">3️⃣ <strong>Auto-Scaling with VM Scale Sets + Azure Load Balancer – For Apps With Spiky or Unpredictable Traffic</strong></h3>
<p><strong>Use this when:</strong><br>You’re building something more serious – traffic comes in waves (for example, a fitness/coach booking app), and you don’t want to sit around scaling VMs all day. You want Azure to automatically scale your infrastructure for you.</p>
<p><strong>How it works:</strong><br>You set up a Virtual Machine Scale Set (VMSS) that can automatically create more VMs when needed (like during high traffic), and remove them when things are calm — saving money. A Load Balancer distributes traffic across all those VMs.</p>
<p><strong>Real-life examples:</strong></p>
<ul>
<li><p>A media platform where people upload videos or photos</p>
</li>
<li><p>A shopping site that gets surges during promotions, for example Black Fridays</p>
</li>
<li><p>A booking platform with peak traffic in evenings/weekends</p>
</li>
</ul>
<p><strong>Pros:</strong></p>
<ul>
<li><p>Automatic scaling – saves time and money</p>
</li>
<li><p>High availability: VMs can be replaced if one fails</p>
</li>
<li><p>Easy to grow as your user base grows</p>
</li>
</ul>
<p><strong>Cons:</strong></p>
<ul>
<li><p>Works best if your app is monolithic (one big service)</p>
</li>
<li><p>No support for routing traffic to specific services – just spreads traffic across VMs</p>
</li>
<li><p>Load Balancer can’t look at URL paths or subdomains</p>
</li>
</ul>
<h3 id="heading-4-vm-scale-set-azure-application-gateway-for-microservices-or-complex-web-apps">4️⃣ <strong>VM Scale Set + Azure Application Gateway – For Microservices or Complex Web Apps</strong></h3>
<p><strong>Use this when:</strong><br>You have a modern, multi-service app – maybe built with microservices. Each service (like payments, authentication, search, and so on) lives on a different port or even in a container.</p>
<p>You want to route traffic smartly – like <code>/login</code> goes to the auth service, <code>/pay</code> to payments, and <code>/search</code> to the search service – all on the same domain.</p>
<p><strong>How it works:</strong><br>You still use a VM Scale Set for auto-scaling, but instead of a basic Load Balancer, you add an Application Gateway. It can inspect each request and send it to the right service based on things like:</p>
<ul>
<li><p>URL path (for example, <code>/payments</code>, <code>/orders</code>)</p>
</li>
<li><p>Subdomain (for example, <code>payments.mydomain.com</code>, <code>auth.mydomain.com</code>)</p>
</li>
</ul>
<p><strong>Real-life examples:</strong></p>
<ul>
<li><p>A full-blown SaaS product with multiple services</p>
</li>
<li><p>An e-commerce site with checkout, account, orders, and admin dashboards</p>
</li>
<li><p>A business migrating from a monolith to a microservices setup</p>
</li>
</ul>
<p><strong>Pros:</strong></p>
<ul>
<li><p>Smart routing based on path or subdomain</p>
</li>
<li><p>Everything runs under one public IP and one domain</p>
</li>
<li><p>Secure HTTPS handling + optional Web Application Firewall (WAF)</p>
</li>
<li><p>Auto-scaling and high availability</p>
</li>
</ul>
<p><strong>Cons:</strong></p>
<ul>
<li><p>More complex setup</p>
</li>
<li><p>Slightly higher cost due to Application Gateway</p>
</li>
<li><p>Needs planning around port numbers and backend pools</p>
</li>
</ul>
<h3 id="heading-quick-summary-table">🧠 Quick Summary Table</h3>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Setup</td><td>Best For</td><td>Scaling</td><td>Routing Logic</td><td>Cost</td><td>Ease</td></tr>
</thead>
<tbody>
<tr>
<td>☁️ Single VM</td><td>Small sites, personal apps</td><td>❌ (Manual)</td><td>❌ One app only</td><td>💲 (Lowest)</td><td>⭐⭐⭐⭐</td></tr>
<tr>
<td>🧱 Manual Horizontal Scaling + Load Balancer</td><td>Mid-size apps, predictable traffic</td><td>✅ (Manual)</td><td>❌ One app only</td><td>💲💲💲 (due to multiple VMs running at once without down-scaling — even with no traffic)</td><td>⭐⭐ (due to manual scaling)</td></tr>
<tr>
<td>🔁 VMSS + Load Balancer</td><td>Busy apps, spiky traffic</td><td>✅ (Auto)</td><td>❌ One app only</td><td>💲💲</td><td>⭐⭐⭐</td></tr>
<tr>
<td>🍴 VMSS + App Gateway</td><td>Microservices, modern apps</td><td>✅ (Auto)</td><td>✅ Smart routing (involving multiple microservices)</td><td>💲💲💲💲(Highest)</td><td>⭐⭐</td></tr>
</tbody>
</table>
</div><h2 id="heading-conclusion">✅ Conclusion</h2>
<p>By now, you’ve gone from simply hearing the words “load balancer” or “scale set” to understanding exactly how they work, when to use them, and what problems they solve. Whether you’re just launching a small app or scaling up a high-traffic service, Azure gives you flexible, powerful tools to grow with confidence.</p>
<p>We started from the very beginning – a single virtual machine. It’s simple and great for small apps, but it quickly becomes a bottleneck as traffic grows.</p>
<p>That’s where scaling comes in. We explored:</p>
<ul>
<li><p>🧱 <strong>Vertical scaling</strong> – Upgrading the same VM (quick fix, but limited)</p>
</li>
<li><p>🧩 <strong>Horizontal scaling</strong> – Adding more VMs to handle traffic better</p>
</li>
</ul>
<p>Then we introduced Azure Virtual Machine Scale Sets (VMSS) – which bring auto-scaling to life. No more manual intervention – Azure can scale your servers up and down based on demand.</p>
<p>But where things really get smart is with load balancers:</p>
<ul>
<li><p>📦 <strong>Azure Load Balancer</strong> helps spread traffic across your VMs — great for single-service apps</p>
</li>
<li><p>🍴 <strong>Azure Application Gateway</strong> takes it further by routing requests based on URL paths or subdomains — perfect for multi-service or microservice apps</p>
</li>
</ul>
<h3 id="heading-tldr-what-should-you-use">🎯 TL;DR – What Should You Use?</h3>
<ul>
<li><p><strong>Single VM</strong>: For side projects, portfolios, or internal tools</p>
</li>
<li><p><strong>Manual scaling + Load Balancer</strong>: For medium apps with predictable load</p>
</li>
<li><p><strong>VMSS + Load Balancer</strong>: For monolithic apps with auto-scaling needs</p>
</li>
<li><p><strong>VMSS + Application Gateway</strong>: Also includes auto-scaling but for microservices or smart routing needs</p>
</li>
</ul>
<h3 id="heading-final-thoughts">💡 Final Thoughts</h3>
<p>Cloud apps grow – fast. And with growth comes complexity. But with the right Azure setup, you can stay one step ahead of your traffic, serve users better, and keep costs under control.</p>
<p>Remember: you don’t need to start big. Start small, understand your app's traffic patterns, and scale only when you need to. Tools like Azure VM Scale Sets, Load Balancer, and Application Gateway give you the control and power to build scalable, modern applications without over-engineering.</p>
<p>Thanks for sticking with me through this deep dive. I hope this made things clearer, simpler, and maybe even a little fun 😊</p>
<h2 id="heading-study-further"><strong>Study Further 📚</strong></h2>
<p>If you would like to learn more about Azure Virtual Machines, Scale Sets, Load Balancer, and Application Gateway, you can check out the courses below:</p>
<ul>
<li><p><a target="_blank" href="https://www.coursera.org/specializations/microsoft-azure-fundamentals-az900-exam-prep">Microsoft Azure Fundamentals AZ-900 Exam Prep Specialization</a> — Microsoft, Coursera</p>
</li>
<li><p><a target="_blank" href="https://youtu.be/QOv_-xBXkpo?si=kSijmQdev5cQbRKl">Azure Virtual Machine Tutorial | Creating A Virtual Machine In Azure | Azure Training | Simplilearn</a> — YouTube</p>
</li>
<li><p><a target="_blank" href="https://youtu.be/wN4lRWHUHA0?si=kWBGXhXZTnVgzuEj">Virtual machine scale sets</a> — YouTube</p>
</li>
<li><p><a target="_blank" href="https://youtu.be/VqBGjddK5VY?si=diLGQfuW5i0lxbse">Azure Load Balancer | Azure Load Balancer Tutorial | All About Load Balancer | Edureka</a> — YouTube</p>
</li>
<li><p><a target="_blank" href="https://youtu.be/V9EP4jAg4QM?si=t7EqQjw1eNHqOtjK">Azure Application Gateway Deep dive | Step by step explained</a> — YouTube</p>
</li>
</ul>
<h2 id="heading-about-the-author"><strong>About the Author 👨‍💻</strong></h2>
<p>Hi, I’m Prince! I’m a DevOps engineer and Cloud architect passionate about building, deploying, and managing scalable applications and sharing knowledge with the tech community.</p>
<p>If you enjoyed this article, you can learn more about me by exploring more of my blogs and projects on my <a target="_blank" href="https://www.linkedin.com/in/prince-onukwili-a82143233/">LinkedIn profile.</a> You can find my <a target="_blank" href="https://www.linkedin.com/in/prince-onukwili-a82143233/details/publications/">LinkedIn articles here</a>. You can also <a target="_blank" href="https://prince-onuk.vercel.app/achievements#articles">visit my website</a> to read more of my articles as well. Let’s connect and grow together! 😊</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Deploy a Restful Web Service on Microsoft Azure App Service ]]>
                </title>
                <description>
                    <![CDATA[ Hey there! 👋, How’s it going? I hope you're doing well. Whether you're a seasoned coder, a curious learner, or just someone browsing through, welcome to my little corner of the internet. In this tutorial, we’ll dive into how you can deploy a web ser... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/deploy-a-restful-web-service-on-microsoft-azure-app-service/</link>
                <guid isPermaLink="false">67e6c180423cd4f90a6350b5</guid>
                
                    <category>
                        <![CDATA[ Azure ]]>
                    </category>
                
                    <category>
                        <![CDATA[ azure-devops ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Cloud Computing ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Cloud ]]>
                    </category>
                
                    <category>
                        <![CDATA[ REST API ]]>
                    </category>
                
                    <category>
                        <![CDATA[ deployment ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Azure App Service ]]>
                    </category>
                
                    <category>
                        <![CDATA[ azure-app-services ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Alaran Ayobami ]]>
                </dc:creator>
                <pubDate>Fri, 28 Mar 2025 15:34:24 +0000</pubDate>
                <media:content url="https://cdn.hashnode.com/res/hashnode/image/upload/v1743176028047/61eba7a3-5505-4152-9df5-59a1cb8c61ac.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Hey there! 👋, How’s it going?</p>
<p>I hope you're doing well. Whether you're a seasoned coder, a curious learner, or just someone browsing through, welcome to my little corner of the internet.</p>
<p>In this tutorial, we’ll dive into how you can deploy a web service on Microsoft Azure app service. It’s a topic I’ve been excited to explore, and I hope you’ll find it insightful and helpful. So grab a coffee, sit back, and let’s get started.</p>
<h3 id="heading-prerequisites">Prerequisites</h3>
<ul>
<li><p>Basic understanding of RESTful web services</p>
</li>
<li><p>Programming knowledge</p>
</li>
<li><p>Docker basics</p>
</li>
<li><p>Docker Hub account</p>
</li>
<li><p>Command Line Interface (CLI) skills</p>
</li>
</ul>
<h3 id="heading-what-well-cover">What we’ll cover:</h3>
<ul>
<li><p><a class="post-section-overview" href="#heading-key-terminologies">Key Terminologies</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-install-docker-and-docker-compose">How to Install Docker and Docker Compose</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-create-a-simple-get-client-info-web-service">How to Create a Simple Get Client Info Web Service</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-build-the-apps-docker-image">How to Build the App’s Docker Image</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-run-the-app-in-the-container">How to Run the App in the Container</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-create-an-azure-resource-group-on-azure-portal">How to Create an Azure Resource Group on Azure Portal.</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-deploy-to-azure-app-service">How to Deploy to Azure App Service</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-conclusion">Conclusion</a></p>
</li>
</ul>
<p>Before we actually get started, I’d like to go over some key terminologies that I'll be using throughout this tutorial. Understanding these terms will make it easier to follow along and get the most out of what we're discussing. Let’s dive in!</p>
<h2 id="heading-key-terminologies">Key Terminologies</h2>
<h3 id="heading-1-docker"><strong>1. Docker</strong></h3>
<p>Docker is an open-source platform that simplifies application development, shipping, and deployment by using containers. With Docker, there are three key things you can do:</p>
<ul>
<li><p>build once and run anywhere</p>
</li>
<li><p>keep environment consistent, and</p>
</li>
<li><p>easily scale your application with container orchestration tools like Kubernetes.</p>
</li>
</ul>
<h3 id="heading-2-docker-hub"><strong>2. Docker Hub</strong></h3>
<p>Docker Hub is a cloud-based repository where developers can store, share, and manage Docker images. You can think of it as the GitHub for Docker images 😉.</p>
<h3 id="heading-3-docker-image"><strong>3. Docker Image</strong></h3>
<p>A Docker image is a lightweight<strong>,</strong> standalone, and executable package that includes everything needed to run a piece of software. You can also think of it as a blueprint for creating and running a container.</p>
<p>Once built, an image is immutable, meaning it cannot change after creation. Instead, you create a new version when updates are needed. This means that you’ll need to rebuild if you update the code that’s being run in the container.</p>
<h3 id="heading-4-container"><strong>4. Container</strong></h3>
<p>A container is a running instance of a Docker image. It provides an isolated environment where an application runs with all its dependencies, without interfering with the host system or other containers.</p>
<p>Wait, what?! <strong>😕</strong> Well, simply put, a container is like a tiny virtual machine that runs the built Docker image. But unlike traditional VMs, it has no init process (PID 1), meaning it always runs on a host system rather than being fully independent. By now, you should be getting the idea: no image, no container. A container depends on an image to exist. You have to cook before you serve, right? 🍽️</p>
<h3 id="heading-5-azure-resource-group"><strong>5. Azure Resource Group</strong></h3>
<p>An Azure resource group refers to a store or folder containing all related resources for an application you want to deploy to production using MS Azure Cloud. For example, if I want to deploy an eCommerce web app with MS Azure, I could create a resource group called EcommWebAppRG. I’d use this to create all the resources I needed for the web app to go live and be accessible – like VMs, DBs, caches, and other services.</p>
<p>Alrighty, now that all the terms are out of the way, lets get started with the tutorial so you can learn how to deploy a web service on Azure App Service.</p>
<p>Since we are deploying an app, let’s start by creating simple REST API app. I’ll be using Golang for the API development, but you can use any programming language/framework of your choice. If you’d like to follow along with the app for this tutorial, I’ve provided the source code <a target="_blank" href="https://github.com/Ayobami6/client_info_webservice">here</a>.</p>
<h2 id="heading-how-to-install-docker-and-docker-compose">How to Install Docker and Docker Compose</h2>
<p>To install Docker and Docker compose on your PC, for Mac and Windows you’ll need to download Docker desktop for your Operating System <a target="_blank" href="https://hub.docker.com/welcome">here</a>.</p>
<p>For Linux, you can run the following command:</p>
<pre><code class="lang-bash">sudo apt update <span class="hljs-comment"># update apt registry</span>
sudo apt install docker.io <span class="hljs-comment"># for docker engine</span>
sudo apt install docker-compose-plugin
</code></pre>
<p>After downloading the Docker desktop for your application, open your terminal and enter the following command to verify that Docker and Docker Compose have been successfully installed on your machine:</p>
<pre><code class="lang-bash">docker-compose -v <span class="hljs-comment"># this should show the version of docker compose cli you have on your PC</span>
</code></pre>
<p>My Docker Compose version is:</p>
<pre><code class="lang-bash">Docker Compose version v2.31.0-desktop.2
</code></pre>
<pre><code class="lang-bash">docker -v
</code></pre>
<p>You should see something similar if Docker has successfully been installed on your machine:</p>
<pre><code class="lang-bash">Docker version 27.4.0, build bde2b89
</code></pre>
<h2 id="heading-how-to-create-a-simple-get-client-info-web-service">How to Create a Simple Get Client Info Web Service</h2>
<p>Alright, I’ll use this handy tool called <code>sparky_generate</code> to generate the app code template. <code>sparky_generate</code> is a command line tool used to generate boilerplate code for backend development using various backend languages and frameworks.</p>
<p>Use this command to install and setup the tool on your Mac or Linux machine. If you are on Windows, you can use WSL.</p>
<pre><code class="lang-bash">wget https://raw.githubusercontent.com/Ayobami6/sparky_generate/refs/heads/main/install.sh
</code></pre>
<pre><code class="lang-bash">chmod 711 install.sh
./install.sh <span class="hljs-comment"># run the install command like so</span>
</code></pre>
<pre><code class="lang-bash">sparky <span class="hljs-comment"># run the sparky command like so</span>
</code></pre>
<p>You should see something similar to the below. Select whatever framework you want to use for your backend service.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1741520002226/b696a376-527b-412a-a8c7-967aca35217a.png" alt="Choose a project type in sparky" class="image--center mx-auto" width="1458" height="1408" loading="lazy"></p>
<p>I will select Go, because I’m using Go for this tutorial. You should have your project template ready once you’ve selected your framework. I won’t go through how to code the web service since it’s out of scope for this tutorial. The goal here is to deploy on Azure using Azure App Service.</p>
<h2 id="heading-how-to-build-the-apps-docker-image">How to Build the App’s Docker Image</h2>
<p>To build the Docker image for our app, we first need to create a Docker file that will include all the steps needed to build the image.</p>
<pre><code class="lang-bash">touch Dockerfile
</code></pre>
<p>We will be using a multistage Docker build to reduce the size of our Docker image. We need something as light as possible.</p>
<p>The multistage Docker build helps reduce size because we use different stages for different concerns. This helps ensure that only what’s needed runs the application in the final stage. For example, we might need certain artifacts to build the application, but we don’t need them to run the application. This is why we have the builder and runner stages in the Docker file below.</p>
<p>Our first stage (build) is concerned with building and bundling the application. The second stage (runner) is just used to run the executable we built in the first stage. So basically all files, modules, and so on used in the build process will be discarded in the runner since they’ve already served their purposes.</p>
<pre><code class="lang-dockerfile"><span class="hljs-comment"># using the first stage as build</span>
<span class="hljs-keyword">FROM</span> golang:<span class="hljs-number">1.23</span>-alpine AS build <span class="hljs-comment"># using alpine base image to reduce size</span>

<span class="hljs-comment"># install git on the machine</span>
<span class="hljs-keyword">RUN</span><span class="bash"> apk add --no-cache git</span>

<span class="hljs-comment"># setting the current work directory on the vm to be /app</span>
<span class="hljs-keyword">WORKDIR</span><span class="bash"> /app</span>

<span class="hljs-comment"># Copying all go dependency files to the working directory</span>
<span class="hljs-keyword">COPY</span><span class="bash"> go.mod go.sum ./</span>

<span class="hljs-comment"># Install go dependencies</span>
<span class="hljs-keyword">RUN</span><span class="bash"> go mod download</span>

<span class="hljs-comment"># copy all remaining files to the working directory</span>
<span class="hljs-keyword">COPY</span><span class="bash"> . .</span>
<span class="hljs-comment"># build the execuatable</span>

<span class="hljs-comment"># build the go program</span>
<span class="hljs-keyword">RUN</span><span class="bash"> go build -o api cmd/main.go</span>

<span class="hljs-comment"># stage 2 AKA the runner</span>
<span class="hljs-keyword">FROM</span> alpine:<span class="hljs-number">3.18</span>

<span class="hljs-keyword">RUN</span><span class="bash">  apk add --no-cache ca-certificates</span>

<span class="hljs-comment"># copy the go executable to the working directory</span>
<span class="hljs-keyword">COPY</span><span class="bash"> --from=build /app/api .</span>

<span class="hljs-comment"># expose the service running port</span>
<span class="hljs-keyword">EXPOSE</span> <span class="hljs-number">6080</span>
</code></pre>
<p>This Dockerfile outlines all the steps for building a Docker image for our app. Lets go through all these steps line by line. Because we are using a multistage build here, our stages are <code>build</code> and <code>runner</code>.</p>
<ul>
<li><p>The first stage build starts from the first <code>FROM golang:1.23-alpine AS build</code>. It initializes a stage with all the steps in the stage. It states that the base image to be used for all the steps in this stage should use a pre-existing golang:1.23 image using an Alpine Linux distro to run all the steps in the stage.</p>
</li>
<li><p>Next, we have <code>RUN</code>, which is used to run the command <code>apk add git</code>, followed by setting the working directory to the /app folder.</p>
</li>
<li><p>Then we have the <code>COPY</code> command that copies all the Go dependencies that will run the Go program.</p>
</li>
<li><p>Following that is <code>RUN go mod download</code> which is used to install all the dependencies.</p>
</li>
<li><p>We then have the command <code>COPY . .</code> to copy all the files to the working directory /app of the image</p>
</li>
<li><p>Then the last step in the build stage, <code>RUN go build -o api cmd/main.go</code>, builds the app code main.go to an executable API. The second stage “runner“ uses an <code>alpine:3.18</code> base image, and also uses the <code>RUN</code> directive to add ca-certificates to the Alpine base image. The <code>COPY</code> is used here to copy just the built executable file from the builder image to the runner image.</p>
</li>
<li><p>We then expose port 6080 so our built container can accept an HTTP connection from port 6080.</p>
</li>
</ul>
<p>Now, let’s write our <code>docker-compose.yml</code> file to define and run our containerized service::</p>
<pre><code class="lang-yaml"><span class="hljs-attr">services:</span>

  <span class="hljs-attr">client_info_app:</span>
    <span class="hljs-attr">build:</span> 
      <span class="hljs-attr">context:</span> <span class="hljs-string">.</span>
      <span class="hljs-attr">dockerfile:</span> <span class="hljs-string">Dockerfile</span>
    <span class="hljs-attr">container_name:</span> <span class="hljs-string">info_app</span>

    <span class="hljs-attr">ports:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-string">"6080:6080"</span>

    <span class="hljs-attr">command:</span> <span class="hljs-string">"./api"</span>
</code></pre>
<h3 id="heading-understanding-the-yaml-structure">Understanding the YAML Structure</h3>
<p>YAML follows a key-value structure similar to a dictionary or hashmap. In our file, the top-level key is <code>services</code>, which acts as the parent key. Within <code>services</code>, we define individual service configurations.</p>
<p>In this case, we have a single service named <code>client_info_app</code>, which contains the necessary properties for Docker to build and run it.</p>
<ul>
<li><p><code>build</code>: This specifies how to build the Docker image for the service. The <code>context: .</code> tells Docker to look for the <code>Dockerfile</code> in the same directory as the <code>docker-compose.yml</code> file.</p>
</li>
<li><p><code>container_name</code>: This assigns a custom name (<code>info_app</code>) to the running container, making it easier to reference.</p>
</li>
<li><p><code>ports</code>: Defines the port mappings between the host and the container. The <code>-</code> before <code>"6080:6080"</code> indicates that multiple mappings could be listed. Here, port <code>6080</code> on the host is mapped to port <code>6080</code> inside the container.</p>
</li>
<li><p><code>command</code>: Specifies the command to execute inside the container once it starts. In this case, it runs <code>./api</code>.</p>
</li>
</ul>
<p>This structure allows us to define and configure multiple services within the <code>services</code> key if needed, but for now, we are only defining <code>client_info_app</code>.</p>
<h2 id="heading-how-to-run-the-app-in-the-container">How to Run the App in the Container</h2>
<p>You can use this command to start the container:</p>
<pre><code class="lang-bash">docker-compose up client_info_app
</code></pre>
<p>The above command will first build the image if it doesn’t exist. Then it runs it, because remember: <strong>no image, no container.</strong></p>
<p>If all looks good, you should have something similar to this, depending on your application framework:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1741708248802/0c0e25a0-fa8c-4eea-adaa-5f4986b5fda6.png" alt="Go running webserver" class="image--center mx-auto" width="2424" height="658" loading="lazy"></p>
<p>You should also verify that your Docker image has been built as well. To do that, run the following:</p>
<pre><code class="lang-bash">docker images
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1741708480967/dbb033eb-d336-4f22-934b-8d50333b6344.png" alt="Verify that Docker is successfully built" class="image--center mx-auto" width="2386" height="122" loading="lazy"></p>
<p>Voilà! You now have your Docker image built and ready for deployment on Azure App Service.</p>
<p>Let’s go on to the Azure Portal to deploy the app.</p>
<p><strong>Note:</strong> if you don’t have an active Azure Subscription, that’s fine – you can still follow along. If you want to get a trial account, you can <a target="_blank" href="https://azure.microsoft.com/en-us/pricing/purchase-options/azure-account">get one here</a>.</p>
<h2 id="heading-how-to-create-an-azure-resource-group-on-azure-portal">How to Create an Azure Resource Group on Azure Portal.</h2>
<p>As a reminder, an Azure resource group refers to a store or folder containing all related resources for an application you want to deploy to production using MS Azure Cloud. Now let’s go about creating one.</p>
<p>When you login to the Azure portal, you should see some like this, the dashboard:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1741709173044/1ab78dd4-97ac-43da-8599-d7b1d790eb13.png" alt="Azure dashboard" class="image--center mx-auto" width="2398" height="1464" loading="lazy"></p>
<p>Search for Resource group using the search bar:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1741709263175/7946270b-11c6-4fef-9abc-996b1efc6f52.png" alt="Search for resource group" class="image--center mx-auto" width="2398" height="1464" loading="lazy"></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1741709619363/5cfce825-0af6-4d64-ae4e-e929ba03d919.png" alt="Resource group control pane" class="image--center mx-auto" width="2398" height="1464" loading="lazy"></p>
<p>Click on Create to create a new resource group:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1741709715096/e519fe55-0ac3-4e9f-8b98-3f34cecfcd43.png" alt="Create a resource group" class="image--center mx-auto" width="2398" height="1464" loading="lazy"></p>
<p>Give your resource group a name and select a region for it. Here I will use the default East US 2, but you can use any you want. Then click on Review + create.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1741770354937/253c33d2-d7b2-44b5-84df-9cb4977aec3b.png" alt="Review resource group creation" class="image--center mx-auto" width="2398" height="1464" loading="lazy"></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1741770386424/0a97c949-5c31-466b-be7f-a43f0783e125.png" alt="Resource group overview" class="image--center mx-auto" width="2398" height="1464" loading="lazy"></p>
<p>You should see something like the above after creating the resource group.</p>
<h2 id="heading-how-to-deploy-to-azure-app-service">How to Deploy to Azure App Service</h2>
<p>Ok now that we’ve created the resource group, let’s go ahead and create the Azure App Service. To do this, navigate back to the dashboard and click on Create a resource.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1741772709338/2c353749-7e0a-42b0-894e-25b1f08cad15.png" alt="Azure dashboard" class="image--center mx-auto" width="2398" height="1464" loading="lazy"></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1741773327784/536358ff-241b-4ea1-876d-575abf12a27b.png" alt="Azure resources view" class="image--center mx-auto" width="2398" height="1464" loading="lazy"></p>
<p>You can search for Web App if you don’t see it in the list there. Then click on the Create Web App option:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1741855971071/8c120d54-1df1-41f3-85b2-c03d9fd709f1.png" alt="Create a web app" class="image--center mx-auto" width="2398" height="1464" loading="lazy"></p>
<p>Here, select the resource group you created earlier, give the app a name, then select Container for the Publish option.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1741882867790/bed19e70-726d-4696-b88f-754e36511f0a.png" alt="Web app creation configuration" class="image--center mx-auto" width="2384" height="1476" loading="lazy"></p>
<p>Before you click on Create, go back to your dev workspace (VS Code or whatever IDE you are using) to push your Docker image to Docker Hub so you can add it there before proceeding to the next steps.</p>
<p>But why do you need to push to Docker Hub? Well, first of all, for accessibility – so we can easily share it with others or have other services access it (which is what we need here).</p>
<p>Remember how I compared Docker Hub with Github earlier? Docker Hub helps you host your Docker image on the internet and make it available for others or for various services on the internet to access if you make it public. Otherwise it’s limited to only authorized services.</p>
<p>To push the Docker image to Docker Hub, you first need to tag the Docker image with your Docker Hub username. Go to Docker <a target="_blank" href="https://hub.docker.com/">Docker Hub</a> to register and get your username if you don’t have one.</p>
<p>Run the following:</p>
<pre><code class="lang-bash">docker tag client_info_webservice-client_info_app:latest ayobami6/client_info_webservice-client_info_app:latest
<span class="hljs-comment"># this adds the latest tag to your docker image</span>
</code></pre>
<p>This shows that you successfully tagged your image with the latest tag.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1741941521765/f624e0d1-2380-41cc-8bbf-f05e55d0b0ad.png" alt="Tagged Docker images" class="image--center mx-auto" width="2340" height="78" loading="lazy"></p>
<p>Before you actually push the image to Docker Hub, go ahead and login to it with the Docker CLI.</p>
<pre><code class="lang-bash">docker login <span class="hljs-comment"># this will prompt for browser authetication, for the prompt and login your account with your usernam and password</span>
</code></pre>
<p>Push the image to Docker Hub like this:</p>
<pre><code class="lang-bash">docker push ayobami6/client_info_webservice-client_info_app:latest
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1741941723747/5947d1eb-82fe-4bf3-a0d7-e20bbc9d7de4.png" alt="Push Docker image to Docker Hub" class="image--center mx-auto" width="2358" height="130" loading="lazy"></p>
<p>You should see something like the below once you enter the push command on Docker Hub.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1741941947561/7050ed8b-b7bf-4e07-91a6-765549b5d715.png" alt="Verify Docker image on Docker Hub" class="image--center mx-auto" width="2146" height="544" loading="lazy"></p>
<p>Alright, now that you have the Docker image on Docker Hub, you can go ahead and deploy it using Microsoft Azure App Service.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1741944017329/32080357-e214-4864-b5cb-0fc8ad77a71f.png" alt="Create web container selection for publish" class="image--right mx-auto mr-0" width="2448" height="1722" loading="lazy"></p>
<p>Click on the container on the top menu bar to configure the container settings.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1741944418747/6f9092e9-e6fc-4098-86d0-ba79eda37a58.png" alt="Container section of Azure web app" class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
<p>Here, select Other container registries.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1741944507676/d4c3d17e-e3fa-4c43-99b5-b768fd900309.png" alt="Other registry selection for Azure web app" class="image--center mx-auto" width="2418" height="1634" loading="lazy"></p>
<p>Select public, because your pushed image is public (meaning it’s publicly accessible over the internet).</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1743071959687/48cc5a78-4b72-4c8f-9ffb-d32c065e1a63.jpeg" alt="Docker image access type selection" class="image--center mx-auto" width="1080" height="729" loading="lazy"></p>
<p>Add your Docker image and tag. You can get this when you run the command <code>docker images</code>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1743072606918/d17f7a31-bee3-41b9-a685-d7de0c0f6b39.jpeg" alt="Image and tag selection" class="image--center mx-auto" width="1080" height="729" loading="lazy"></p>
<pre><code class="lang-bash">λ MACs-MacBook-Pro ~ → docker images
REPOSITORY                                        TAG         IMAGE ID       CREATED         SIZE
ayobami6/client_info_webservice-client_info_app   latest      a14f2a5b3bd4   2 weeks ago     30.8MB
postgres                                          13-alpine   236985828131   4 weeks ago     383MB
glint_pm_frontend-nextjs                          latest      424233ceaa4b   4 weeks ago     1.72GB
flask_app-flask_app                               latest      ff6ecfc4ba5a   5 weeks ago     203MB
nginx                                             latest      124b44bfc9cc   7 weeks ago     279MB
encoredotdev/postgres                             15          58b55b0e1fc7   10 months ago   878MB
λ MACs-MacBook-Pro ~ →
</code></pre>
<p>Copy the repository name and tag – in my case I have <code>ayobami6/client_info_webservice-client_info_app</code> and tag <code>latest</code> → <code>ayobami6/client_info_webservice-client_info_app:latest</code>.</p>
<p>Then add your startup command. If you are not using Go for the development like I am, your startup command will be different – so just use the command you added to your Docker compose command key, like so <code>command: "./api"</code>. Copy just the value (mine is .<code>/api</code>) don’t add the double quotes, and add it to the startup command.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1743072910308/a208c0a1-718b-4725-99b5-47bf33691fca.jpeg" alt="Add startup command to the web app container configuration" class="image--center mx-auto" width="1080" height="729" loading="lazy"></p>
<p>This start up command is the command that will start the application from the container and get the container running.</p>
<p>Click on review and create to create the service.</p>
<p>Once the deployment is complete you’ll be redirected here:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1741944994364/31e051a6-2da1-46fa-a748-c2bdd20528be.png" alt="Web app overview" class="image--center mx-auto" width="2880" height="1634" loading="lazy"></p>
<p>Congratulations! You’ve successfully deployed your web service to Azure App Service. You can visit your app using the default domain from the overview. Mine is <a target="_blank" href="http://clientinfoapp-hdgcdmgjdyd5ecfy.canadacentral-01.azurewebsites.net">here</a>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1741945313388/19c73507-0b48-49ef-9885-515784cb0f9b.png" alt="Deployed service test on Postman" class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1741945461019/30a668c7-0552-4905-bbb0-c9db0b587387.png" alt="Deployed service test on web browser" class="image--center mx-auto" width="1674" height="1514" loading="lazy"></p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>Deploying a RESTful web service on Microsoft Azure App Service is a powerful way to leverage cloud technology for scalable and efficient application hosting.</p>
<p>Understanding key terms like Docker, Docker Hub, and Azure Resource Groups will help you streamline the deployment process.</p>
<p>This guide walked you through creating a simple web service, building a Docker image, and deploying it on Azure. By following these steps, you can confidently deploy your applications, ensuring they are accessible and performant.</p>
<p>Thank you for following along, and I hope this tutorial has been insightful and helpful in your cloud deployment journey. If you found it useful, feel free to share it with others who might benefit from it. Happy coding and deploying!</p>
<p>Stay tuned for more insightful content, and let's continue learning and growing together. Cheers to building smarter, more efficient solutions with Azure.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Host Local LLMs in a Docker Container on Azure ]]>
                </title>
                <description>
                    <![CDATA[ Have you ever run into a situation where you want to test some local AI models, but your computer doesn't have enough specs to run them? Or maybe you just don't like bloating your computer with a ton of AI models? You're not alone in this. I’ve faced... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/host-llms-locally-in-docker-on-azure/</link>
                <guid isPermaLink="false">67e42705cb510eea06095d36</guid>
                
                    <category>
                        <![CDATA[ Docker ]]>
                    </category>
                
                    <category>
                        <![CDATA[ AI ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Azure ]]>
                    </category>
                
                    <category>
                        <![CDATA[ llm ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Shrijal Acharya ]]>
                </dc:creator>
                <pubDate>Wed, 26 Mar 2025 16:10:45 +0000</pubDate>
                <media:content url="https://cdn.hashnode.com/res/hashnode/image/upload/v1743005422195/56c65ac2-7a0d-4bd6-b969-a4c02eb3c42e.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Have you ever run into a situation where you want to test some local AI models, but your computer doesn't have enough specs to run them? Or maybe you just don't like bloating your computer with a ton of AI models?</p>
<p>You're not alone in this. I’ve faced this exact issue, and I was able to solve it with the help of a spare VM. So the only thing you'll need is a spare PC somewhere that you can access.</p>
<p>Here, I'm using Azure, but the process should be fairly simple for other cloud providers as well. Even if you have a homelab with your old PC or something that you can SSH into, the only thing you'll have to change is the commands that deal with Azure. Everything else should work just fine.</p>
<p>And the best part? We will be doing everything inside a Docker container. So if you ever want to remove all the AI models, just remove the container, and you're all set. Even your VM is not going to install anything locally, pure Docker! 👌</p>
<p>In this article, I will show you how to host local LLMs with Ollama in a Docker container on an Azure Virtual Machine.</p>
<p><strong>What you will learn: 👀</strong></p>
<ul>
<li><p>How to use Ollama to run multiple LLMs on a single machine.</p>
</li>
<li><p>How to set up <code>ollama</code> and <code>ollama-webui</code> containers with <code>docker-compose</code>.</p>
</li>
<li><p>How to create a VM on Azure and configure everything using the Azure CLI.</p>
</li>
<li><p>How to restrict Azure VM access to your public IP using Azure CLI.</p>
</li>
</ul>
<p>By the end of the article, you will have a fully functional Azure VM capable of running all your chosen AI models (dependent on its specs, of course).</p>
<h2 id="heading-table-of-contents">Table of Contents</h2>
<ul>
<li><p><a class="post-section-overview" href="#heading-how-to-set-up-the-environment">How to Set Up the Environment</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-set-up-the-azure-virtual-machine">How to Set Up the Azure Virtual Machine</a></p>
<ul>
<li><p><a class="post-section-overview" href="#heading-create-a-resource-group">Create a Resource Group</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-create-the-virtual-machine">Create the Virtual Machine</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-get-the-virtual-machine-public-ip">Get the Virtual Machine Public IP</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-configure-the-vm-network-to-allow-access-only-from-the-users-ip">Configure the VM Network to Allow Access Only from the User's IP</a></p>
</li>
</ul>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-set-up-the-vm-for-running-ai-models">How to Set Up the VM for Running AI Models</a></p>
<ul>
<li><p><a class="post-section-overview" href="#heading-set-up-the-virtual-machine">Set Up the Virtual Machine</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-set-up-docker-compose">Set Up Docker Compose</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-deploy-the-containers">Deploy the Containers</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-run-the-llms-locally-inside-the-docker-container">Run the LLMs Locally Inside the Docker Container</a></p>
</li>
</ul>
</li>
<li><p><a class="post-section-overview" href="#heading-wrapping-up">Wrapping Up</a></p>
</li>
</ul>
<h2 id="heading-how-to-set-up-the-environment">How to Set Up the Environment</h2>
<p>💁 You will mostly be writing Bash, so make sure that you know some basics of shell scripting before moving forward.</p>
<p>Create a folder to keep all your source code for the project:</p>
<pre><code class="lang-bash">mkdir run-local-ai-models-docker-azure \
    &amp;&amp; <span class="hljs-built_in">cd</span> run-local-ai-models-docker-azure
mkdir azure scripts
</code></pre>
<p>Here, the <code>azure</code> directory will hold all the scripts required to work with the Azure VM, and the <code>scripts</code> directory will hold everything needed to set up the VM to run the LLMs.</p>
<p>Create a new <code>.env</code> file in the root of the project with the following environment variables. Make sure you change the size, name, location and the models as you like.</p>
<pre><code class="lang-plaintext">RESOURCE_GROUP="ollama-vm-rg"
LOCATION="eastus"
VM_NAME="ollama-vm"
VM_SIZE="Standard_D2s_v3"
USERNAME="&lt;your-username&gt;"

# This will be used as a backup when we can't fetch the IP
# from the 'api.ipify.org'
IP_ADDRESS="&lt;your-ip-address&gt;"

# Change it to whatever models you like.
OLLAMA_DEFAULT_MODEL="qwen2.5-coder:3b"

# Make sure to use "," when separating multiple models.
OLLAMA_ADDITIONAL_MODELS="deepseek-r1:1.5b,tinyllama:1.1b"

WEBUI_PORT=3000
OLLAMA_PORT=11434
</code></pre>
<p>And finally, you need to have Azure CLI installed. Follow the installation instructions shown <a target="_blank" href="https://learn.microsoft.com/en-us/cli/azure">here</a> to install it locally on your machine.</p>
<p>Once, you have it installed, authenticate the CLI with your Azure account using the following command:</p>
<pre><code class="lang-bash">az login
</code></pre>
<p>Once you are logged in, the setup is complete, and you can start coding the project. 🎉</p>
<h2 id="heading-how-to-set-up-the-azure-virtual-machine">How to Set Up the Azure Virtual Machine</h2>
<p>In this section, I'll show you how to set up your Azure VM using the Azure CLI <code>az</code>. You'll do everything from making a separate resource group to setting up the network to only allow access from your IP address, and finally, creating the VM.</p>
<p>When creating a new file for this section, make sure you do it in the <code>azure</code> directory.</p>
<h3 id="heading-create-a-resource-group">Create a Resource Group</h3>
<p>First, begin by creating a new resource group for your Virtual Machine. But what’s a resource group? Basically, a resource group is like a container that holds related resources, such as the VM, storage, NSGs and all. It helps organize these resources quickly, making it easier to deploy, update, and delete them all at once. In short, just think of it as a way to group related stuff together.</p>
<p>Create a new file called <code>create-resource-group.sh</code> and add the following lines of code:</p>
<pre><code class="lang-bash"><span class="hljs-meta">#!/usr/bin/env bash</span>
<span class="hljs-built_in">set</span> -e

SCRIPT_DIR=<span class="hljs-string">"<span class="hljs-subst">$( cd <span class="hljs-string">"<span class="hljs-subst">$( dirname <span class="hljs-string">"<span class="hljs-variable">${BASH_SOURCE[0]}</span>"</span> )</span>"</span> &amp;&amp; pwd )</span>"</span>
PROJECT_ROOT=<span class="hljs-string">"<span class="hljs-subst">$(dirname <span class="hljs-string">"<span class="hljs-variable">$SCRIPT_DIR</span>"</span>)</span>"</span>

<span class="hljs-built_in">source</span> <span class="hljs-string">"<span class="hljs-variable">$PROJECT_ROOT</span>/.env"</span>

<span class="hljs-built_in">echo</span> <span class="hljs-string">"Creating resource group '<span class="hljs-variable">$RESOURCE_GROUP</span>' in location '<span class="hljs-variable">$LOCATION</span>'..."</span>
az group create --name <span class="hljs-variable">$RESOURCE_GROUP</span> --location <span class="hljs-variable">$LOCATION</span>

<span class="hljs-built_in">echo</span> <span class="hljs-string">"Resource group created successfully."</span>
</code></pre>
<p>Notice the <code>set -e</code> command. By adding this, its telling the script to stop if any step causes an error. Without this, the script would keep running even if a step fails, which would lead to errors. Remember this command, as it is in all the scripts you’ll write.</p>
<p>Next, it sources the <code>.env</code> file to access the environment variables. After that, it runs the <code>az</code> command to create a resource group with the given name and location.</p>
<p>Now, run the following command:</p>
<pre><code class="lang-bash">bash create-resource-group.sh
</code></pre>
<p>To check if it worked, go to your Azure account and look under the Resource groups section for your new resource group.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1742103607596/a4545962-a77f-466f-9866-83345359dfa2.png" alt="Newly creted resource group on Azure." class="image--center mx-auto" width="1590" height="517" loading="lazy"></p>
<p>If you see your resource group on the list, you’re good to go.</p>
<h3 id="heading-create-the-virtual-machine">Create the Virtual Machine</h3>
<p>Now that the resource group is created, you can now move forward to creating the virtual machine itself. This script is also going to be fairly similar to the earlier one.</p>
<p>Create a new file called <code>create-vm.sh</code> and add the following lines of code:</p>
<pre><code class="lang-bash"><span class="hljs-meta">#!/usr/bin/env bash</span>
<span class="hljs-built_in">set</span> -e

SCRIPT_DIR=<span class="hljs-string">"<span class="hljs-subst">$( cd <span class="hljs-string">"<span class="hljs-subst">$( dirname <span class="hljs-string">"<span class="hljs-variable">${BASH_SOURCE[0]}</span>"</span> )</span>"</span> &amp;&amp; pwd )</span>"</span>
PROJECT_ROOT=<span class="hljs-string">"<span class="hljs-subst">$(dirname <span class="hljs-string">"<span class="hljs-variable">$SCRIPT_DIR</span>"</span>)</span>"</span>

<span class="hljs-built_in">source</span> <span class="hljs-string">"<span class="hljs-variable">$PROJECT_ROOT</span>/.env"</span>

VM_EXISTS=$(az vm show --resource-group <span class="hljs-variable">$RESOURCE_GROUP</span> --name <span class="hljs-variable">$VM_NAME</span> --query <span class="hljs-string">"name"</span> -o tsv 2&gt;/dev/null || <span class="hljs-built_in">echo</span> <span class="hljs-string">""</span>)

<span class="hljs-keyword">if</span> [ -n <span class="hljs-string">"<span class="hljs-variable">$VM_EXISTS</span>"</span> ]; <span class="hljs-keyword">then</span>
    <span class="hljs-built_in">echo</span> <span class="hljs-string">"VM '<span class="hljs-variable">$VM_NAME</span>' already exists in resource group '<span class="hljs-variable">$RESOURCE_GROUP</span>'."</span>
    <span class="hljs-built_in">echo</span> <span class="hljs-string">"Please choose a different VM name or use the existing VM."</span>
    <span class="hljs-built_in">exit</span> 1
<span class="hljs-keyword">fi</span>

<span class="hljs-built_in">echo</span> <span class="hljs-string">"Creating VM '<span class="hljs-variable">$VM_NAME</span>'..."</span>
az vm create \
  --resource-group <span class="hljs-variable">$RESOURCE_GROUP</span> \
  --name <span class="hljs-variable">$VM_NAME</span> \
  --image Ubuntu2204 \
  --admin-username <span class="hljs-variable">$USERNAME</span> \
  --generate-ssh-keys \
  --size <span class="hljs-variable">$VM_SIZE</span> \
  --public-ip-sku Standard

<span class="hljs-comment"># The above command generates the ssh key as "id_rsa", if you already</span>
<span class="hljs-comment"># have a key called id_rsa in the ~/.ssh directory, make sure to name it to something else</span>
ssh-add ~/.ssh/id_rsa

<span class="hljs-built_in">echo</span> <span class="hljs-string">"VM created successfully."</span>
</code></pre>
<p>First, it checks if a VM with the same name is already in the resource group. If it isn't, then it creates a new VM there, providing details like size, image, username, and asking it to generate an SSH key which it will use to log in to the VM.</p>
<p>I chose Ubuntu because, in another section where you’ll set up Docker, I’ve used Debian steps. If you want to use a different distro, make sure to update that script, too.</p>
<p>Now, run the following command:</p>
<pre><code class="lang-bash">bash create-vm.sh
</code></pre>
<p>After running the command, under the VM section, you should see your newly created VM.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1742106067836/092e5fe1-505a-4d5d-bd6f-59aa707afe55.png" alt="List of Virtual Machines on Azure." class="image--center mx-auto" width="1539" height="517" loading="lazy"></p>
<p>There you have it, the VM is up and running. You could manually go into the VM and set it up, but I will show you how to automate all of these steps as well, because we are devs, remember? 😉</p>
<h3 id="heading-get-the-virtual-machine-public-ip">Get the Virtual Machine Public IP</h3>
<p>So, now that you have the VM created perfectly, it’s time to fetch the public IP of the VM so you can then use SSH to login.</p>
<p>Create a new file called <code>get-vm-details.sh</code> and add the following lines of code:</p>
<pre><code class="lang-bash"><span class="hljs-meta">#!/usr/bin/env bash</span>
<span class="hljs-built_in">set</span> -e

SCRIPT_DIR=<span class="hljs-string">"<span class="hljs-subst">$( cd <span class="hljs-string">"<span class="hljs-subst">$( dirname <span class="hljs-string">"<span class="hljs-variable">${BASH_SOURCE[0]}</span>"</span> )</span>"</span> &amp;&amp; pwd )</span>"</span>
PROJECT_ROOT=<span class="hljs-string">"<span class="hljs-subst">$(dirname <span class="hljs-string">"<span class="hljs-variable">$SCRIPT_DIR</span>"</span>)</span>"</span>

<span class="hljs-built_in">source</span> <span class="hljs-string">"<span class="hljs-variable">$PROJECT_ROOT</span>/.env"</span>

<span class="hljs-built_in">echo</span> <span class="hljs-string">"Getting VM details..."</span>

PUBLIC_IP=$(az vm show --resource-group <span class="hljs-variable">$RESOURCE_GROUP</span> --name <span class="hljs-variable">$VM_NAME</span> --show-details --query publicIps -o tsv)

<span class="hljs-keyword">if</span> [ -z <span class="hljs-string">"<span class="hljs-variable">$PUBLIC_IP</span>"</span> ]; <span class="hljs-keyword">then</span>
    <span class="hljs-built_in">echo</span> <span class="hljs-string">"Error: Could not retrieve public IP for VM '<span class="hljs-variable">$VM_NAME</span>'"</span>
    <span class="hljs-built_in">exit</span> 1
<span class="hljs-keyword">fi</span>

<span class="hljs-built_in">echo</span> <span class="hljs-string">"VM Public IP: <span class="hljs-variable">$PUBLIC_IP</span>"</span>
<span class="hljs-built_in">echo</span> <span class="hljs-string">"Ollama API endpoint: http://<span class="hljs-variable">$PUBLIC_IP</span>:<span class="hljs-variable">$OLLAMA_PORT</span>"</span>
<span class="hljs-built_in">echo</span> <span class="hljs-string">"Web UI: http://<span class="hljs-variable">$PUBLIC_IP</span>:<span class="hljs-variable">$WEBUI_PORT</span>"</span>

<span class="hljs-built_in">echo</span> <span class="hljs-string">"PUBLIC_IP=<span class="hljs-variable">$PUBLIC_IP</span>"</span> &gt; <span class="hljs-string">"<span class="hljs-variable">$PROJECT_ROOT</span>/.vm_details.env"</span>

<span class="hljs-built_in">echo</span> <span class="hljs-string">"VM details retrieved successfully."</span>
</code></pre>
<p>All it is doing is sourcing the <code>.env</code> and then using the <code>az</code> command to fetch the public IP of the VM and store it in a separate file called <code>.vm_details.env</code>. This way, in other scripts, it doesn't need to fetch the public IP repeatedly and can simply source the file to access it.</p>
<p>Now, run the following command:</p>
<pre><code class="lang-bash">bash get-vm-details.sh
</code></pre>
<h3 id="heading-configure-the-vm-network-to-allow-access-only-from-the-users-ip">Configure the VM Network to Allow Access Only from the User's IP</h3>
<p>Now that you have the VM working, there's a slight security issue with it. If you check your VM network settings, you'll see that there is no IP restriction. This means anyone can easily try to SSH into your VM.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1742110598028/2789344f-ec3f-4fb4-99c5-a25452dd7154.png" alt="Azure VM default network settings for SSH" class="image--center mx-auto" width="1519" height="255" loading="lazy"></p>
<p>Allowing access from any source IP address is definitely not a good idea. You need to configure this to allow access only from your public IP, and also need to configure the port for <code>ollama</code> and <code>ollama-webui</code>.</p>
<p>Create a new file called <code>configure-network.sh</code> and add the following lines of code:</p>
<pre><code class="lang-bash"><span class="hljs-meta">#!/usr/bin/env bash</span>
<span class="hljs-built_in">set</span> -e

SCRIPT_DIR=<span class="hljs-string">"<span class="hljs-subst">$( cd <span class="hljs-string">"<span class="hljs-subst">$( dirname <span class="hljs-string">"<span class="hljs-variable">${BASH_SOURCE[0]}</span>"</span> )</span>"</span> &amp;&amp; pwd )</span>"</span>
PROJECT_ROOT=<span class="hljs-string">"<span class="hljs-subst">$(dirname <span class="hljs-string">"<span class="hljs-variable">$SCRIPT_DIR</span>"</span>)</span>"</span>

<span class="hljs-built_in">source</span> <span class="hljs-string">"<span class="hljs-variable">$PROJECT_ROOT</span>/.env"</span>

<span class="hljs-built_in">echo</span> <span class="hljs-string">"Configuring network security..."</span>

<span class="hljs-comment"># Get current public IP address with fallback to .env one.</span>
<span class="hljs-built_in">echo</span> <span class="hljs-string">"Retrieving current public IP address..."</span>
IP_ADDRESS_CURRENT=$(curl -s https://api.ipify.org || <span class="hljs-built_in">echo</span> <span class="hljs-string">""</span>)
<span class="hljs-keyword">if</span> [ -z <span class="hljs-string">"<span class="hljs-variable">$IP_ADDRESS_CURRENT</span>"</span> ]; <span class="hljs-keyword">then</span>
    <span class="hljs-built_in">echo</span> <span class="hljs-string">"Warning: Could not retrieve IP from api.ipify.org, falling back to .env value"</span>
    IP_ADDRESS_CURRENT=<span class="hljs-variable">$IP_ADDRESS</span>
<span class="hljs-keyword">fi</span>

<span class="hljs-built_in">echo</span> <span class="hljs-string">"Using IP address: <span class="hljs-variable">$IP_ADDRESS_CURRENT</span>"</span>

NSG_NAME=$(az network nsg list --resource-group <span class="hljs-variable">$RESOURCE_GROUP</span> --query <span class="hljs-string">"[?contains(name, '<span class="hljs-variable">${VM_NAME}</span>')].name"</span> -o tsv)
<span class="hljs-keyword">if</span> [ -z <span class="hljs-string">"<span class="hljs-variable">$NSG_NAME</span>"</span> ]; <span class="hljs-keyword">then</span>
    <span class="hljs-built_in">echo</span> <span class="hljs-string">"Error: Could not find NSG for VM '<span class="hljs-variable">$VM_NAME</span>'"</span>
    <span class="hljs-built_in">exit</span> 1
<span class="hljs-keyword">fi</span>

<span class="hljs-function"><span class="hljs-title">create_or_update_nsg_rule</span></span>() {
    <span class="hljs-built_in">local</span> RULE_NAME=<span class="hljs-variable">$1</span>
    <span class="hljs-built_in">local</span> PORT=<span class="hljs-variable">$2</span>
    <span class="hljs-built_in">local</span> PRIORITY=<span class="hljs-variable">$3</span>

    RULE_EXISTS=$(az network nsg rule list --resource-group <span class="hljs-variable">$RESOURCE_GROUP</span> --nsg-name <span class="hljs-variable">$NSG_NAME</span> --query <span class="hljs-string">"[?name=='<span class="hljs-variable">$RULE_NAME</span>'].name"</span> -o tsv)

    <span class="hljs-keyword">if</span> [ -z <span class="hljs-string">"<span class="hljs-variable">$RULE_EXISTS</span>"</span> ]; <span class="hljs-keyword">then</span>
        <span class="hljs-built_in">echo</span> <span class="hljs-string">"Creating new rule: <span class="hljs-variable">$RULE_NAME</span> for port <span class="hljs-variable">$PORT</span>..."</span>
        az network nsg rule create --resource-group <span class="hljs-variable">$RESOURCE_GROUP</span> --nsg-name <span class="hljs-variable">$NSG_NAME</span> \
            --name <span class="hljs-string">"<span class="hljs-variable">$RULE_NAME</span>"</span> \
            --protocol tcp --direction inbound --priority <span class="hljs-variable">$PRIORITY</span> \
            --source-address-prefix <span class="hljs-variable">$IP_ADDRESS_CURRENT</span> --source-port-range <span class="hljs-string">"*"</span> \
            --destination-address-prefix <span class="hljs-string">"*"</span> --destination-port-range <span class="hljs-variable">$PORT</span> \
            --access allow
    <span class="hljs-keyword">else</span>
        <span class="hljs-built_in">echo</span> <span class="hljs-string">"Updating existing rule: <span class="hljs-variable">$RULE_NAME</span> with new IP address..."</span>
        az network nsg rule update --resource-group <span class="hljs-variable">$RESOURCE_GROUP</span> --nsg-name <span class="hljs-variable">$NSG_NAME</span> \
            --name <span class="hljs-string">"<span class="hljs-variable">$RULE_NAME</span>"</span> \
            --source-address-prefix <span class="hljs-variable">$IP_ADDRESS_CURRENT</span>
    <span class="hljs-keyword">fi</span>
}

<span class="hljs-comment"># Check if 'default-allow-ssh' exists</span>
SSH_RULE_EXISTS=$(az network nsg rule list --resource-group <span class="hljs-variable">$RESOURCE_GROUP</span> --nsg-name <span class="hljs-variable">$NSG_NAME</span> --query <span class="hljs-string">"[?name=='default-allow-ssh'].name"</span> -o tsv)
<span class="hljs-keyword">if</span> [ -n <span class="hljs-string">"<span class="hljs-variable">$SSH_RULE_EXISTS</span>"</span> ]; <span class="hljs-keyword">then</span>
    <span class="hljs-built_in">echo</span> <span class="hljs-string">"Updating existing SSH rule (default-allow-ssh) with restricted IP..."</span>
    az network nsg rule update --resource-group <span class="hljs-variable">$RESOURCE_GROUP</span> --nsg-name <span class="hljs-variable">$NSG_NAME</span> \
        --name <span class="hljs-string">"default-allow-ssh"</span> \
        --source-address-prefix <span class="hljs-variable">$IP_ADDRESS_CURRENT</span>
<span class="hljs-keyword">else</span>
    <span class="hljs-comment"># If no default SSH rule, create our own with a different priority</span>
    create_or_update_nsg_rule <span class="hljs-string">"SSH_Restricted"</span> 22 1010
<span class="hljs-keyword">fi</span>

<span class="hljs-comment"># Configure rules for Ollama and Web UI</span>
<span class="hljs-built_in">echo</span> <span class="hljs-string">"Opening ports for Ollama API and Web UI (restricted to your IP)..."</span>

create_or_update_nsg_rule <span class="hljs-string">"Port_<span class="hljs-variable">${OLLAMA_PORT}</span>_Restricted"</span> <span class="hljs-variable">$OLLAMA_PORT</span> 1001
create_or_update_nsg_rule <span class="hljs-string">"Port_<span class="hljs-variable">${WEBUI_PORT}</span>_Restricted"</span> <span class="hljs-variable">$WEBUI_PORT</span> 1002

<span class="hljs-built_in">echo</span> <span class="hljs-string">"Network security configured successfully."</span>
<span class="hljs-built_in">echo</span> <span class="hljs-string">"Note: If your IP address changes, you'll need to run this script again to update the rules."</span>
</code></pre>
<p>Don't be scared by this script. It might seem complex, but it's actually pretty straightforward. The first thing it does is try to get the user's IP address. It first attempts to fetch the user's IP from a service called <a target="_blank" href="https://api.ipify.org">api.ipify.org</a> (because public IPs can change frequently), which returns your current public IP. If there's an error, it falls back to using the IP address stored in the <code>.env</code> file.</p>
<p>Next, it tries to get the VM's NSG (Network Security Group) because it's needed when creating a new NSG rule. If there’s an error, there's no point in continuing with the script, so it exits with an error status.</p>
<p>There's also a function called <code>create_or_update_nsg_rule</code>, which is used to create a new NSG rule if it doesn't exist. If it does exist, it simply updates it to allow access only from the user's IP address.</p>
<p>Finally, it creates or updates the SSH rule depending on whether it exists. It also sets up the rules for <code>ollama</code> and <code>ollama-webui</code> so you can access the exposed port on your local machine to test the models with <code>ollama-webui</code>.</p>
<p>Now, run the following command:</p>
<pre><code class="lang-bash">bash configure-network.sh
</code></pre>
<p>After running this command, you can view the changed network settings. There should be two new rules for port <code>11434</code> and <code>3000</code>, and most importantly, you should see that the source IP is limited to your public IP.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1742113381994/24653c49-0476-4822-b646-ff7ee9fd2be6.png" alt="Azure VM configured network settings." class="image--center mx-auto" width="1460" height="290" loading="lazy"></p>
<p>Every configuration on the Azure side is now complete. All you need to do next is write a few more scripts to set up running AI models on your configured VM. ✌️</p>
<h2 id="heading-how-to-set-up-the-vm-for-running-ai-models">How to Set Up the VM for Running AI Models</h2>
<p>Now that all the configuration on the Azure side is complete, in this section, I will show you how you can configure everything on the VM side, from installing Docker to setting up containers, and deploying those containers in the Azure VM you just created.</p>
<p>When creating a new file for this section, ensure you do it in the <code>scripts</code> directory, except for the <code>docker-compose.yaml</code> file.</p>
<h3 id="heading-set-up-the-virtual-machine">Set Up the Virtual Machine</h3>
<p>Okay, so now that you have a VM up and running with some network settings configured, let’s set this thing up to install and set up Docker and start the service.</p>
<p>Create a new file called <code>setup-vm.sh</code> and add the following lines of code:</p>
<pre><code class="lang-bash"><span class="hljs-meta">#!/usr/bin/env bash</span>
<span class="hljs-built_in">set</span> -e

SCRIPT_DIR=<span class="hljs-string">"<span class="hljs-subst">$( cd <span class="hljs-string">"<span class="hljs-subst">$( dirname <span class="hljs-string">"<span class="hljs-variable">${BASH_SOURCE[0]}</span>"</span> )</span>"</span> &amp;&amp; pwd )</span>"</span>
PROJECT_ROOT=<span class="hljs-string">"<span class="hljs-subst">$(dirname <span class="hljs-string">"<span class="hljs-variable">$SCRIPT_DIR</span>"</span>)</span>"</span>

<span class="hljs-built_in">source</span> <span class="hljs-string">"<span class="hljs-variable">$PROJECT_ROOT</span>/.env"</span>
<span class="hljs-built_in">source</span> <span class="hljs-string">"<span class="hljs-variable">$PROJECT_ROOT</span>/.vm_details.env"</span>

<span class="hljs-built_in">echo</span> <span class="hljs-string">"Setting up VM with Docker and dependencies..."</span>

ssh <span class="hljs-variable">$USERNAME</span>@<span class="hljs-variable">$PUBLIC_IP</span> &lt;&lt; <span class="hljs-string">'EOF'</span>
  <span class="hljs-comment"># Install Docker Engine</span>
  <span class="hljs-built_in">echo</span> <span class="hljs-string">"Installing Docker..."</span>

  <span class="hljs-comment"># From Docker documentation for debian based distros</span>
  <span class="hljs-comment"># Add Docker's official GPG key:</span>
  sudo apt-get update
  sudo apt-get install ca-certificates curl
  sudo install -m 0755 -d /etc/apt/keyrings
  sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
  sudo chmod a+r /etc/apt/keyrings/docker.asc

  <span class="hljs-built_in">echo</span> \
    <span class="hljs-string">"deb [arch=<span class="hljs-subst">$(dpkg --print-architecture)</span> signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
    <span class="hljs-subst">$(. /etc/os-release &amp;&amp; echo <span class="hljs-string">"<span class="hljs-variable">${UBUNTU_CODENAME:-<span class="hljs-variable">$VERSION_CODENAME</span>}</span>"</span>)</span> stable"</span> | \
    sudo tee /etc/apt/sources.list.d/docker.list &gt; /dev/null
  sudo apt-get update

  sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
  <span class="hljs-comment"># End of docker debian installation instructions</span>

  sudo usermod -aG docker <span class="hljs-variable">$USER</span>

  sudo apt-get install -y docker-compose

  sudo systemctl start docker.service

  sudo docker volume create ollama_data

  <span class="hljs-comment"># Here we will place our docker-compose.yaml file</span>
  mkdir -p ~/ollama-project
EOF

<span class="hljs-built_in">echo</span> <span class="hljs-string">"VM setup completed successfully."</span>
</code></pre>
<p>And as I said earlier, in this example, I’m using Ubuntu, so I’m following Debian instructions to install Docker. If you are using a different distro, make sure to change the docker setup commands. Then it simply creates a Docker volume because you will want to persist the container state and not lose it every single time.</p>
<p>Now, run the following command:</p>
<pre><code class="lang-bash">bash setup-vm.sh
</code></pre>
<p>If everything goes well, you should have the Docker engine installed on your machine. You can verify it with the following command:</p>
<pre><code class="lang-bash">ssh &lt;YOUR_VM_USERNAME&gt;@&lt;YOUR_VM_PUBLIC_IP&gt; &lt;&lt; <span class="hljs-string">'EOF'</span>
    docker --version
EOF
</code></pre>
<h3 id="heading-set-up-docker-compose">Set Up Docker Compose</h3>
<p>Create a new file called <code>docker-compose.yaml</code> at the root of the project – not inside the <code>scripts</code> directory this time – and add the following lines of code:</p>
<pre><code class="lang-yaml"><span class="hljs-attr">version:</span> <span class="hljs-string">"3.9"</span>
<span class="hljs-attr">services:</span>
  <span class="hljs-attr">ollama:</span>
    <span class="hljs-attr">image:</span> <span class="hljs-string">ollama/ollama:latest</span>
    <span class="hljs-attr">container_name:</span> <span class="hljs-string">ollama</span>
    <span class="hljs-attr">ports:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-string">"11434:11434"</span>
    <span class="hljs-attr">volumes:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-string">~/ollama_data:/root/.ollama</span>
    <span class="hljs-attr">environment:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-string">OLLAMA_HOST=0.0.0.0</span>
    <span class="hljs-attr">restart:</span> <span class="hljs-string">unless-stopped</span>

  <span class="hljs-attr">ollama-webui:</span>
    <span class="hljs-attr">image:</span> <span class="hljs-string">ghcr.io/ollama-webui/ollama-webui:main</span>
    <span class="hljs-attr">container_name:</span> <span class="hljs-string">ollama-webui</span>
    <span class="hljs-attr">ports:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-string">"${WEBUI_PORT:-3000}:8080"</span>
    <span class="hljs-attr">environment:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-string">OLLAMA_API_BASE_URL=http://ollama:11434/api</span>
    <span class="hljs-attr">depends_on:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-string">ollama</span>
    <span class="hljs-attr">restart:</span> <span class="hljs-string">unless-stopped</span>
</code></pre>
<p>The Docker Compose file should be fairly straightforward to understand. It sets up two services, or rather two containers: <code>ollama</code> and <code>ollama-webui</code>. You need to expose the container port so that you can access it in the VM, whose port is already exposed during the VM network configuration, allowing you to access it on your local machine. Finally, it specifies the Docker volumes and a few environment variables, and that's it.</p>
<p>For the <code>ollama-webui</code> container, it’s necessary for the <code>ollama</code> service to be up and running first, so it depends on the <code>ollama</code> container. After all, what's the point of starting the UI if the service itself is not running, right?</p>
<h3 id="heading-deploy-the-containers">Deploy the Containers</h3>
<p>Now that Docker is installed on the VM, it's time to copy the <code>docker-compose.yaml</code> file into the VM and start the containers.</p>
<p>Create a new file called <code>deploy-containers.sh</code> and add the following lines of code:</p>
<pre><code class="lang-bash"><span class="hljs-meta">#!/usr/bin/env bash</span>
<span class="hljs-built_in">set</span> -e

SCRIPT_DIR=<span class="hljs-string">"<span class="hljs-subst">$( cd <span class="hljs-string">"<span class="hljs-subst">$( dirname <span class="hljs-string">"<span class="hljs-variable">${BASH_SOURCE[0]}</span>"</span> )</span>"</span> &amp;&amp; pwd )</span>"</span>
PROJECT_ROOT=<span class="hljs-string">"<span class="hljs-subst">$(dirname <span class="hljs-string">"<span class="hljs-variable">$SCRIPT_DIR</span>"</span>)</span>"</span>

<span class="hljs-built_in">source</span> <span class="hljs-string">"<span class="hljs-variable">$PROJECT_ROOT</span>/.env"</span>
<span class="hljs-built_in">source</span> <span class="hljs-string">"<span class="hljs-variable">$PROJECT_ROOT</span>/.vm_details.env"</span>

<span class="hljs-built_in">echo</span> <span class="hljs-string">"Deploying Docker containers to the VM..."</span>

scp <span class="hljs-string">"<span class="hljs-variable">$PROJECT_ROOT</span>/docker-compose.yaml"</span> <span class="hljs-variable">$USERNAME</span>@<span class="hljs-variable">$PUBLIC_IP</span>:~/ollama-project/

ssh <span class="hljs-variable">$USERNAME</span>@<span class="hljs-variable">$PUBLIC_IP</span> &lt;&lt; <span class="hljs-string">'EOF'</span>
  <span class="hljs-built_in">cd</span> ~/ollama-project
  <span class="hljs-built_in">export</span> WEBUI_PORT=3000
  sudo docker-compose up -d
  <span class="hljs-built_in">echo</span> <span class="hljs-string">"Docker containers started successfully."</span>
EOF

<span class="hljs-built_in">echo</span> <span class="hljs-string">"Deployment completed successfully."</span>
<span class="hljs-built_in">echo</span> <span class="hljs-string">"Web UI available at: http://<span class="hljs-variable">$PUBLIC_IP</span>:<span class="hljs-variable">$WEBUI_PORT</span>"</span>
</code></pre>
<p>It’s pretty simple here as well. First, it copies the <code>docker-compose</code> file into the <code>~/ollama-project</code> directory and then spins up the container in detached mode.</p>
<p>Now, the moment of truth. Run the following command, and if everything goes well, you should have two Docker containers running in your VM.</p>
<pre><code class="lang-bash">bash deploy-containers.sh
</code></pre>
<p>To see if it worked, run the following command to <code>ssh</code> into the VM and execute the <code>docker ps</code> command.</p>
<pre><code class="lang-bash">ssh &lt;YOUR_VM_USERNAME&gt;@&lt;YOUR_VM_PUBLIC_IP&gt; &lt;&lt; <span class="hljs-string">'EOF'</span>
    docker ps
EOF
</code></pre>
<p>Along with some SSH output, you should see something like this, and if both containers' statuses say <code>Up</code>, you're all good.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1742638797106/fcce6983-6adb-4e62-93af-99dd59887f72.png" alt="List of running Docker Containers." class="image--center mx-auto" width="1920" height="695" loading="lazy"></p>
<p>By now, you should be able to visit this URL (<code>http://&lt;VM_PUBLIC_IP&gt;:3000</code>) to view the Web UI running. But there are no AI models to chat with, so let's fix that.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1742639360587/3980f847-b76b-474f-9973-d0d5bbe2d36e.png" alt="A browser window showing the Ollama Web UI." class="image--center mx-auto" width="1003" height="134" loading="lazy"></p>
<h3 id="heading-run-the-llms-locally-inside-the-docker-container">Run the LLMs Locally Inside the Docker Container</h3>
<p>You’re almost there. All that is left is to install some models in Ollama. To install any model, all you need to do is <code>ollama run &lt;MODEL_NAME&gt;</code>. So, let’s do that inside a script that runs that command inside a Docker container, because remember you have Ollama running in a Docker container.</p>
<p>💡 <strong>GOOD TO KNOW:</strong> You can run any command inside a Docker container from outside using <code>docker exec &lt;CONTAINER_NAME&gt; &lt;COMMAND&gt;</code>. This is perfect for our situation because there's no need to be inside the Docker container. You just need to run one command, and that's all.</p>
<p>Create a new file called <code>run-models.sh</code> and add the following lines of code:</p>
<pre><code class="lang-bash"><span class="hljs-meta">#!/usr/bin/env bash</span>
<span class="hljs-built_in">set</span> -e

SCRIPT_DIR=<span class="hljs-string">"<span class="hljs-subst">$( cd <span class="hljs-string">"<span class="hljs-subst">$( dirname <span class="hljs-string">"<span class="hljs-variable">${BASH_SOURCE[0]}</span>"</span> )</span>"</span> &amp;&amp; pwd )</span>"</span>
PROJECT_ROOT=<span class="hljs-string">"<span class="hljs-subst">$(dirname <span class="hljs-string">"<span class="hljs-variable">$SCRIPT_DIR</span>"</span>)</span>"</span>

<span class="hljs-built_in">source</span> <span class="hljs-string">"<span class="hljs-variable">$PROJECT_ROOT</span>/.env"</span>
<span class="hljs-built_in">source</span> <span class="hljs-string">"<span class="hljs-variable">$PROJECT_ROOT</span>/.vm_details.env"</span>

<span class="hljs-keyword">if</span> [ -n <span class="hljs-string">"<span class="hljs-variable">$OLLAMA_DEFAULT_MODEL</span>"</span> ]; <span class="hljs-keyword">then</span>
  <span class="hljs-built_in">echo</span> <span class="hljs-string">"Running default model <span class="hljs-variable">$OLLAMA_DEFAULT_MODEL</span>..."</span>
  ssh <span class="hljs-variable">$USERNAME</span>@<span class="hljs-variable">$PUBLIC_IP</span> &lt;&lt; EOF
    sudo docker <span class="hljs-built_in">exec</span> ollama ollama run <span class="hljs-variable">$OLLAMA_DEFAULT_MODEL</span>
EOF
  <span class="hljs-built_in">echo</span> <span class="hljs-string">"Default model <span class="hljs-variable">$OLLAMA_DEFAULT_MODEL</span> run successfully."</span>
<span class="hljs-keyword">fi</span>

<span class="hljs-keyword">if</span> [ -n <span class="hljs-string">"<span class="hljs-variable">$OLLAMA_ADDITIONAL_MODELS</span>"</span> ]; <span class="hljs-keyword">then</span>
  <span class="hljs-built_in">echo</span> <span class="hljs-string">"additional models <span class="hljs-variable">$OLLAMA_ADDITIONAL_MODELS</span>..."</span>
  IFS=<span class="hljs-string">','</span> <span class="hljs-built_in">read</span> -ra MODELS &lt;&lt;&lt; <span class="hljs-string">"<span class="hljs-variable">$OLLAMA_ADDITIONAL_MODELS</span>"</span>

  <span class="hljs-keyword">for</span> MODEL <span class="hljs-keyword">in</span> <span class="hljs-string">"<span class="hljs-variable">${MODELS[@]}</span>"</span>; <span class="hljs-keyword">do</span>
    <span class="hljs-comment"># trim whitespace</span>
    MODEL=$(<span class="hljs-built_in">echo</span> <span class="hljs-string">"<span class="hljs-variable">$MODEL</span>"</span> | xargs)
    <span class="hljs-built_in">echo</span> <span class="hljs-string">"Running additional model <span class="hljs-variable">$MODEL</span>..."</span>
    ssh <span class="hljs-variable">$USERNAME</span>@<span class="hljs-variable">$PUBLIC_IP</span> &lt;&lt; EOF
      sudo docker <span class="hljs-built_in">exec</span> ollama ollama run <span class="hljs-variable">$MODEL</span>
EOF
    <span class="hljs-built_in">echo</span> <span class="hljs-string">"Additional model <span class="hljs-variable">$MODEL</span> run successfully."</span>
  <span class="hljs-keyword">done</span>
<span class="hljs-keyword">fi</span>

<span class="hljs-built_in">echo</span> <span class="hljs-string">"All models have been processed successfully."</span>
</code></pre>
<p>All this script does is first check if the default model is set up in the env with <code>OLLAMA_DEFAULT_MODEL</code>. If it is, the script runs it and also runs any other models separated by commas in the <code>OLLAMA_ADDITIONAL_MODELS</code> env variable.</p>
<p>Now, run the following command:</p>
<pre><code class="lang-bash">bash run-models.sh
</code></pre>
<p>If everything goes well and you see the final <code>echo</code> message, then hurray! 🎉 You’ve successfully set up running LLMs inside a Docker container in an Azure VM.</p>
<p>Go ahead and refresh the Web UI, and you should see all your LLMs appearing in the list of available models. Choose any one you like and start chatting! 🔥</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1742650146763/0d2e43b8-5653-4390-8f88-07a55d4966bc.png" alt="Response from an AI Model." class="image--center mx-auto" width="1920" height="1013" loading="lazy"></p>
<hr>
<h2 id="heading-wrapping-up">Wrapping Up</h2>
<p>That is it for this one. I hope you enjoyed it and, better yet, understood everything we did together. I build such stuff every other week and document them with blogs. Feel free to check out some of my previous tutorials on <a target="_blank" href="https://dev.to/shricodev">DEV</a> and <a target="_blank" href="https://www.freecodecamp.org/news/author/shricodev">freeCodeCamp</a>.</p>
<p>You can find the complete source code <a target="_blank" href="https://github.com/shricodev/local-ai-models-docker-azure">here</a>.</p>
<p>And hey, if you agree with the response from the above <code>qwen2.5-coder</code> model, here are my socials 😉:</p>
<ul>
<li><p><strong>GitHub:</strong> <a target="_blank" href="https://github.com/shricodev">github.com/shricodev</a></p>
</li>
<li><p><strong>Portfolio:</strong> <a target="_blank" href="https://www.techwithshrijal.com">techwithshrijal.com</a></p>
</li>
<li><p><strong>LinkedIn:</strong> <a target="_blank" href="https://www.linkedin.com/in/iamshrijal/">linkedin.com/in/iamshrijal</a></p>
</li>
</ul>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Pass the Azure AI Engineer Associate Certification (AI-102) ]]>
                </title>
                <description>
                    <![CDATA[ Are you ready to take your AI skills to the next level and earn the Azure AI Engineer Associate Certification (AI-102)? We just posted a comprehensive course on the freeCodeCamp.org YouTube channel that is designed to help you prepare for and pass th... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/pass-the-azure-ai-engineer-associate-certification-ai-102/</link>
                <guid isPermaLink="false">66e093d482502b33f0f6b7ce</guid>
                
                    <category>
                        <![CDATA[ Azure ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Certification ]]>
                    </category>
                
                    <category>
                        <![CDATA[ youtube ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Beau Carnes ]]>
                </dc:creator>
                <pubDate>Tue, 10 Sep 2024 18:45:40 +0000</pubDate>
                <media:content url="https://cdn.hashnode.com/res/hashnode/image/upload/v1725993924398/c2501267-b4ce-42cb-a73a-215d03a50aa0.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Are you ready to take your AI skills to the next level and earn the Azure AI Engineer Associate Certification (AI-102)? We just posted a comprehensive course on the freeCodeCamp.org YouTube channel that is designed to help you prepare for and pass this certification exam.</p>
<p>This course offers an in-depth exploration of Azure AI services, Azure AI Search, and Azure OpenAI, equipping you with the knowledge and skills needed to excel as a Microsoft Azure AI engineer. Andrew Brown of ExamPro developed this course.</p>
<h3 id="heading-course-overview">Course Overview</h3>
<p>The course is structured to guide you through the essential components of the Azure AI Engineer Associate Certification. It begins with an introduction and an exam guide breakdown, setting the stage for a deep dive into the technical and practical aspects of Azure AI.</p>
<p>Here are the key sections of the course:</p>
<ol>
<li><p><strong>Setup</strong>: Learn how to set up your development environment and get acquainted with OpenAI Studio and AI Studio.</p>
</li>
<li><p><strong>Gen AI Primer</strong>: Understand the differences between AI and Generative AI, foundational models, large language models, and the intricacies of transformer architecture, tokenization, embeddings, and attention mechanisms.</p>
</li>
<li><p><strong>ML and AI Concepts</strong>: Explore supervised and unsupervised learning, neural networks, deep learning, and the tools like Jupyter Notebooks that facilitate AI development.</p>
</li>
<li><p><strong>Responsible AI</strong>: Learn about the principles of responsible AI, including fairness, reliability, privacy, inclusiveness, transparency, and accountability. Learn about the Responsible AI Standard V2 and how to apply these guidelines in real-world scenarios.</p>
</li>
<li><p><strong>Azure AI Services</strong>: Gain hands-on experience with Azure AI Services, including setup, diagnostic logging, and the differences between Azure AI Services and Azure AI Studio. Explore Azure OpenAI Service models, deployment types, and prompt engineering.</p>
</li>
<li><p><strong>Azure AI Search</strong>: Discover the capabilities of Azure AI Search, including RAG, document cracking, HNSW, and semantic ranking.</p>
</li>
<li><p><strong>Text Analytics and Computer Vision</strong>: Learn about natural language processing, sentiment analysis, PII extraction, and the capabilities of Azure AI Vision Studio.</p>
</li>
<li><p><strong>Custom Vision and Document Intelligence</strong>: Understand custom vision project types, features, and object detection, as well as Azure AI Document Intelligence and form recognition.</p>
</li>
<li><p><strong>Speech API and AI Video Indexer</strong>: Explore the Speech API and AI Video Indexer to enhance your AI solutions with audio and video processing capabilities.</p>
</li>
<li><p><strong>Content Safety and Language Understanding</strong>: Implement content moderation solutions and explore language understanding with LUIS and QnA Maker.</p>
</li>
<li><p><strong>Face Service and Cleanup</strong>: Learn about the Face Service and how to effectively clean up your AI projects.</p>
</li>
</ol>
<h3 id="heading-certification-overview">Certification Overview</h3>
<p>As a Microsoft Azure AI engineer, you will be responsible for building, managing, and deploying AI solutions that leverage Azure AI. This role involves participating in all phases of AI solutions development, from requirements definition and design to deployment, integration, and maintenance. You will work closely with solution architects, data scientists, data engineers, and other specialists to build secure, end-to-end AI solutions.</p>
<p>The skills measured in the certification include planning and managing an Azure AI solution, implementing content moderation, computer vision, natural language processing, knowledge mining, document intelligence, and generative AI solutions.</p>
<h3 id="heading-get-started">Get Started</h3>
<p>To start your journey towards becoming an Azure AI Engineer Associate, watch the <a target="_blank" href="https://youtu.be/scJ4mobwjBQ">full course on the freeCodeCamp.org YouTube channel</a> (14-hour watch).</p>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/scJ4mobwjBQ" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Develop a CRUD App with Spring Boot, Neon Postgres, and Azure App Service ]]>
                </title>
                <description>
                    <![CDATA[ In this article, we'll explore how to develop a CRUD (Create, Read, Update, Delete) application using Spring Boot and Neon Postgres. We'll also deploy the application on Azure App Service and make it production-ready by setting up features like autos... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/build-a-crud-app-spring-boot-neon-postgres/</link>
                <guid isPermaLink="false">66c3762340438b5931fe0a0b</guid>
                
                    <category>
                        <![CDATA[ Azure ]]>
                    </category>
                
                    <category>
                        <![CDATA[ crud ]]>
                    </category>
                
                    <category>
                        <![CDATA[ postgres ]]>
                    </category>
                
                    <category>
                        <![CDATA[ spring-boot ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Abhinav Pandey ]]>
                </dc:creator>
                <pubDate>Fri, 26 Jul 2024 19:14:36 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2024/07/neon-banner.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>In this article, we'll explore how to develop a CRUD (Create, Read, Update, Delete) application using Spring Boot and <a target="_blank" href="https://neon.tech/">Neon Postgres</a>.</p>
<p>We'll also deploy the application on <a target="_blank" href="https://azure.microsoft.com/en-us/products/app-service">Azure App Service</a> and make it production-ready by setting up features like autoscaling and multiple environments.</p>
<p>You'll learn how Neon Postgres can make your development and deployment processes easier along the way.</p>
<h2 id="heading-heres-what-well-cover">Here's what we'll cover:</h2>
<ul>
<li>Setting up a Neon Postgres database and exploring its features</li>
<li>Building a CRUD application using Spring Boot and deploying the application on Azure App Service</li>
<li>Why Neon is a good fit for infrastructure that auto-scales</li>
<li>Database branching in Neon Postgres and how it can ease the development workflow</li>
</ul>
<h2 id="heading-prerequisites">Prerequisites</h2>
<ul>
<li>Working knowledge of Java, Maven, and Spring Boot</li>
<li>Basics of SQL databases</li>
<li>Understanding of serverless and cloud services</li>
<li>Familiarity with testing and deployment processes</li>
</ul>
<h2 id="heading-table-of-contents">Table of Contents</h2>
<ul>
<li><a class="post-section-overview" href="#heading-what-is-neon-postgres">What is Neon Postgres?</a></li>
<li><a class="post-section-overview" href="#heading-how-to-set-up-the-database">How to Set Up the Database</a><ul>
<li><a class="post-section-overview" href="#heading-create-the-database">Create the Database</a></li>
</ul>
</li>
<li><a class="post-section-overview" href="#heading-how-to-build-the-spring-boot-crud-app">How to Build the Spring Boot CRUD App</a><ul>
<li><a class="post-section-overview" href="#heading-create-an-entity-class">Create an Entity Class</a></li>
<li><a class="post-section-overview" href="#heading-create-a-repository">Create a Repository</a></li>
<li><a class="post-section-overview" href="#heading-create-a-rest-controller">Create a REST Controller</a></li>
<li><a class="post-section-overview" href="#heading-configure-the-database">Configure the Database</a></li>
</ul>
</li>
<li><a class="post-section-overview" href="#heading-how-to-deploy-on-azure-app-service">How to Deploy on Azure App Service</a><ul>
<li><a class="post-section-overview" href="#heading-create-a-new-web-app">Create a New Web App</a></li>
<li><a class="post-section-overview" href="#heading-deploy-the-application">Deploy the Application</a></li>
<li><a class="post-section-overview" href="#heading-access-the-application">Access the Application</a></li>
</ul>
</li>
<li><a class="post-section-overview" href="#heading-how-to-set-up-autoscaling">How to Set Up Autoscaling</a><ul>
<li><a class="post-section-overview" href="#heading-autoscaling-in-azure">Autoscaling in Azure</a></li>
<li><a class="post-section-overview" href="#heading-autoscaling-in-neon">Autoscaling in Neon</a></li>
</ul>
</li>
<li><a class="post-section-overview" href="#heading-how-to-configure-database-branches-in-neon">How to Configure Database Branches in Neon</a></li>
<li><a class="post-section-overview" href="#heading-summary">Summary</a></li>
</ul>
<h2 id="heading-what-is-neon-postgres">What is Neon Postgres?</h2>
<p>Neon is a fully managed serverless Postgres database platform. It offers features such as high availability, automatic backups, and scaling options to handle varying traffic levels.</p>
<p>Neon is designed to be cost-efficient and developer-friendly, and it focuses on providing a seamless experience for developers.</p>
<p>In addition to the standard Postgres features, it provides capabilities like database branching, allowing you to create Git-like branches of the database for different purposes.</p>
<h2 id="heading-how-to-set-up-the-database">How to Set Up the Database</h2>
<p>To begin with, let's explore how you can set up a Neon database for your application.</p>
<p>Firstly, you'll need to <a target="_blank" href="https://console.neon.tech/signup">create an account</a> on the Neon website. It doesn't require a credit card to sign up, and you're automatically set up with the free tier to get started.</p>
<p>Here's a <a target="_blank" href="https://neon.tech/pricing">pricing and features comparison</a> of Neon plans:</p>
<p><img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Finxumg46sf92ffre6l2q.png" alt="A screenshot of pricing plans in Neon listing down free and paid features" width="800" height="527" loading="lazy">
<em>Neon pricing plans</em></p>
<p>In the free tier, we get 0.5 GB of storage with basic computing which is enough for playing around with the database and building small applications.</p>
<h3 id="heading-create-the-database">Create the Database</h3>
<p>Once you've signed up, you can access the dashboard and create a new project.</p>
<p>Star by filling in the project name, region, and Postgres version options. In addition to this, we can choose two additional options:</p>
<ul>
<li><strong>compute size</strong> – You can choose a min and max compute size for the database. This is useful for autoscaling the database based on the load.</li>
<li><strong>suspend time</strong> – You can set a time after which the database will be suspended if not being used. This is useful for saving costs when the database is not being used.</li>
</ul>
<p><img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fggwuvqtb8ydl3mxd1dak.png" alt="Form with specifications required when creating a database" width="800" height="400" loading="lazy">
<em>Creating a database project in Neon</em></p>
<p>Once you submit the form, Neon will create the database and provide the connection details.</p>
<p><img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwe2x5d81euphg2owgxhd.png" alt="Neon Dashboard showing the project is ready. Also shows connection details." width="800" height="528" loading="lazy">
<em>Neon Dashboard</em></p>
<p>As you can see, the database was set up in 3.3 seconds (compared to hours of installing and setting up your own infrastructure). You can choose multiple ways to connect to the database. For this tutorial, select Java as your programming language and get the JDBC connection string.</p>
<h2 id="heading-how-to-build-the-spring-boot-crud-app">How to Build the Spring Boot CRUD App</h2>
<p>Next, let's set up our CRUD application. We'll use Spring Boot, as it provides easy bootstrapping and configuration for building web applications.</p>
<p>We can use the <a target="_blank" href="https://start.spring.io/">Spring Initializr</a> to generate a new Spring Boot project with the necessary dependencies:</p>
<ul>
<li>Spring Web – for building web applications</li>
<li>Spring Data JPA – for working with databases using JPA</li>
<li>PostGres Driver – for connecting to the Postgres database</li>
</ul>
<p><img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffifv17tc5d3swothe3zf.png" alt="Spring Initializer website form to select spring boot project specifications and dependencies" width="800" height="400" loading="lazy">
<em>Creating a Spring Boot project using Spring Initializer</em></p>
<p>You can generate, download, and import the project into your favorite IDE.</p>
<h3 id="heading-create-an-entity-class">Create an Entity Class</h3>
<p>Let's create an entity class to represent the data in the application. First, create a <code>User</code> class:</p>
<pre><code class="lang-java"><span class="hljs-meta">@Entity(name = "users")</span>
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">User</span> </span>{
    <span class="hljs-meta">@Id</span>
    <span class="hljs-meta">@GeneratedValue(strategy = GenerationType.IDENTITY)</span>
    <span class="hljs-keyword">private</span> Long id;
    <span class="hljs-keyword">private</span> String name;
    <span class="hljs-keyword">private</span> String email;

    <span class="hljs-comment">// Constructors, Getters and Setters</span>
}
</code></pre>
<p>The entity name <code>users</code> is the name of the table you want to use in your database.</p>
<h3 id="heading-create-a-repository">Create a Repository</h3>
<p>Next, create a repository interface to interact with the database. You'll extend the <code>JpaRepository</code> interface provided by Spring Data JPA:</p>
<pre><code class="lang-java"><span class="hljs-meta">@Repository</span>
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">interface</span> <span class="hljs-title">UserRepository</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">JpaRepository</span>&lt;<span class="hljs-title">User</span>, <span class="hljs-title">Long</span>&gt; </span>{
}
</code></pre>
<p>You need to annotate the interface with <code>@Repository</code> to mark it as a Spring bean. The <code>JpaRepository</code> interface provides methods for CRUD operations like <code>save</code>, <code>findAll</code>, <code>findById</code>, <code>delete</code>, and so on, so you don't need to write the queries manually.</p>
<p>You'll provide your entity class <code>User</code> and the type of the primary key <code>Long</code> as type arguments to the <code>JpaRepository</code> interface.</p>
<h3 id="heading-create-a-rest-controller">Create a REST Controller</h3>
<p>Finally, create a REST controller to handle the CRUD operations. You'll inject the <code>UserRepository</code> into the controller and implement the necessary endpoints:</p>
<pre><code class="lang-java"><span class="hljs-meta">@RestController</span>
<span class="hljs-meta">@RequestMapping("/users")</span>
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">UserController</span> </span>{
    <span class="hljs-keyword">private</span> <span class="hljs-keyword">final</span> UserRepository userRepository;

    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-title">UserController</span><span class="hljs-params">(UserRepository userRepository)</span> </span>{
        <span class="hljs-keyword">this</span>.userRepository = userRepository;
    }

    <span class="hljs-meta">@GetMapping</span>
    <span class="hljs-function"><span class="hljs-keyword">public</span> List&lt;User&gt; <span class="hljs-title">getUsers</span><span class="hljs-params">()</span> </span>{
        <span class="hljs-keyword">return</span> userRepository.findAll();
    }

    <span class="hljs-meta">@PostMapping</span>
    <span class="hljs-function"><span class="hljs-keyword">public</span> User <span class="hljs-title">createUser</span><span class="hljs-params">(<span class="hljs-meta">@RequestBody</span> User user)</span> </span>{
        <span class="hljs-keyword">return</span> userRepository.save(user);
    }

    <span class="hljs-meta">@PutMapping("/{id}")</span>
    <span class="hljs-function"><span class="hljs-keyword">public</span> User <span class="hljs-title">updateUser</span><span class="hljs-params">(<span class="hljs-meta">@PathVariable</span> Long id, <span class="hljs-meta">@RequestBody</span> User user)</span> </span>{
        user.setId(id);
        <span class="hljs-keyword">return</span> userRepository.save(user);
    }

    <span class="hljs-meta">@DeleteMapping("/{id}")</span>
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">deleteUser</span><span class="hljs-params">(<span class="hljs-meta">@PathVariable</span> Long id)</span> </span>{
        userRepository.deleteById(id);
    }
}
</code></pre>
<p>Here are a few things to note:</p>
<ul>
<li>You're using the <code>@RestController</code> annotation to mark the class as a controller that handles REST requests.</li>
<li>The <code>@RequestMapping</code> annotation specifies the base URL for the endpoints.</li>
<li>You're injecting the <code>UserRepository</code> into the controller using constructor injection.</li>
<li>Finally, you're implementing your API endpoints for CRUD operations using the <code>@GetMapping</code>, <code>@PostMapping</code>, <code>@PutMapping</code>, and <code>@DeleteMapping</code> annotations.</li>
</ul>
<h3 id="heading-configure-the-database">Configure the Database</h3>
<p>To connect your Spring Boot application to the Neon Postgres database, you need to configure the database URL, username, and password in the <code>application.properties</code> file:</p>
<pre><code>spring.datasource.url=jdbc:postgresql:<span class="hljs-comment">//&lt;db-url&gt;/&lt;db-name&gt;?sslmode=require</span>
spring.datasource.username=&lt;username&gt;
spring.datasource.password=&lt;password&gt;
spring.jpa.hibernate.ddl-auto=update
</code></pre><p>Here, you configured the database URL, username, and password provided by Neon when you created the database. The <code>spring.jpa.hibernate.ddl-auto=update</code> property tells Spring Boot to automatically create the necessary tables or columns based on the entity classes when the application starts.</p>
<h2 id="heading-how-to-deploy-on-azure-app-service">How to Deploy on Azure App Service</h2>
<p>Now that your Spring Boot application is ready, it's time to deploy it on Azure App Service.</p>
<h3 id="heading-create-a-new-web-app">Create a New Web App</h3>
<p>To deploy your Spring Boot application on Azure App Service, you'll first create a new <code>Web App</code>. You can do this through the Azure portal by following these steps:</p>
<ul>
<li>Log in to the <a target="_blank" href="https://portal.azure.com/">Azure portal</a>.</li>
<li>Click on the <code>Create a resource</code> button.</li>
<li>Search for <code>Web App</code> and select the <code>Create</code> option.</li>
<li>Fill in the necessary details like resource group, app name, runtime stack, and region.</li>
<li>Click the <code>Review + create</code> button.</li>
</ul>
<p><img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flf2kmh12t8eucd1qa1pg.png" alt="Form for creating a web app in Azure" width="800" height="400" loading="lazy">
<em>Creating a Web App in Azure</em></p>
<h3 id="heading-deploy-the-application">Deploy the Application</h3>
<p>The Web App takes a couple of minutes to create. Once done, you can deploy your Spring Boot application to Azure App Service.</p>
<p>One of the easiest ways to deploy is to package your Spring Boot application as a JAR file and deploy it to Azure App Service using the Azure CLI.</p>
<p>To do this, run the below commands:</p>
<pre><code>mvn package
az webapp deploy --src-path neon-demo<span class="hljs-number">-0.0</span><span class="hljs-number">.1</span>-SNAPSHOT.jar --resource-group learn-ba1a439c<span class="hljs-number">-71</span>ca<span class="hljs-number">-4</span>cab<span class="hljs-number">-9</span>bb1-f5b1331bab04 --name neon-app
</code></pre><p>Here, you're packaging your Spring Boot application using Maven and deploying the JAR file to Azure App Service using the Azure CLI. You've provided the path to the JAR file, the resource group, and the app name you previously configured.</p>
<h3 id="heading-access-the-application">Access the Application</h3>
<p>Once the deployment is complete, you can access your Spring Boot application on Azure App Service by navigating to the URL of the Web App. Your app is available at neon-app.azurewebsites.net</p>
<p>Let's use _curl _to test the endpoints.</p>
<h4 id="heading-create-a-user">Create a User</h4>
<pre><code>curl -X POST -d <span class="hljs-string">'{"name":"John Doe","email":"john@gmail.com"}'</span> https:<span class="hljs-comment">//neon-app.azurewebsites.net/users</span>
</code></pre><p>Here you provide user data in JSON format to create a new user.</p>
<h4 id="heading-get-users">Get Users</h4>
<p>You can also can test that the user was created by fetching all users:</p>
<pre><code>curl -X GET https:<span class="hljs-comment">//neon-app.azurewebsites.net/users</span>
</code></pre><h2 id="heading-how-to-set-up-autoscaling">How to Set Up Autoscaling</h2>
<p>A production application may experience varying levels of traffic, and it's important to scale the application dynamically based on the load.</p>
<p>Let's explore how you can autoscale your application when needed.</p>
<h3 id="heading-autoscaling-in-azure">Autoscaling in Azure</h3>
<p>Azure App Service provides <a target="_blank" href="https://learn.microsoft.com/en-us/azure/azure-functions/functions-premium-plan?tabs=portal#plan-and-sku-settings">autoscaling options</a> that let you automatically adjust the number of instances as needed.</p>
<p>You can configure autoscaling rules in the Azure portal by following these steps:</p>
<ul>
<li>Navigate to the Web App in the Azure portal.</li>
<li>Click the <code>Scale out (App Service Plan)</code> option from the left menu.</li>
<li>Configure the autoscaling rules – you can choose predefined rules like traffic or create custom rules based on metrics like CPU usage, memory usage, or custom metrics.</li>
<li>Save.</li>
</ul>
<p>Azure will automatically scale the application based on the configured rules.</p>
<h3 id="heading-autoscaling-in-neon">Autoscaling in Neon</h3>
<p>Since your application is automatically scaled based on the load, you'll want to ensure that the database can handle the increased traffic.</p>
<p>Neon provides <a target="_blank" href="https://neon.tech/docs/introduction/autoscaling">autoscaling options</a> to scale the database dynamically based on the load. You can configure autoscaling rules in the Neon dashboard to ensure the database can handle the increased load.</p>
<p>Follow the below steps to configure autoscaling in Neon:</p>
<ol>
<li>Navigate to the Neon dashboard and select the database. Then select the branch to configure autoscaling.</li>
</ol>
<p><img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl6s84pqhk2avflpjbgrf.png" alt="Neon project dashboard with branches section highlighted " width="800" height="400" loading="lazy">
<em>Selecting a branch from Neon project dashboard</em></p>
<ol start="2">
<li>Click on the <code>Edit</code> button next to the <code>Compute</code> section. Configure the autoscaling rules based on metrics like CPU usage, memory usage, or custom metrics.</li>
</ol>
<p><img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffkn11nop1zz9xxbfamsr.png" alt="Branch details view in Neon with edit button in the computes section highlighted" width="800" height="400" loading="lazy">
<em>Branch details view in Neon</em></p>
<ol start="3">
<li>Configure the min-max compute size and Save. Neon will automatically scale the database based on the configured rules when needed.</li>
</ol>
<p><img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdmuow8zvndz0dibv2kxt.png" alt="Form to enable autoscaling and select min and max size of the compute" width="800" height="400" loading="lazy">
<em>Setting up autoscaling for compute</em></p>
<p>Ensuring that both the application and the database can scale dynamically based on the load will help you handle varying levels of traffic efficiently.</p>
<h2 id="heading-how-to-configure-database-branches-in-neon">How to Configure Database Branches in Neon</h2>
<p>In a typical development workflow, multiple databases may be used for different purposes like development, testing, and production.</p>
<p>Neon Postgres provides <a target="_blank" href="https://neon.tech/docs/introduction/autoscaling">database branching</a> to create multiple branches for different purposes. Each branch is an instance of the database that you can use independently.</p>
<p>This Git-like feature helps set up a copy of the database for different environments like development, staging, and production. It also helps preserve data for different versions of the application.</p>
<p>Let's explore how you can create and manage branches in Neon Postgres:</p>
<ul>
<li>Navigate to the Neon dashboard and select the database.</li>
<li>In the <code>Branches</code> section, click on the <code>View All</code> button.</li>
<li>You can create a new branch from an existing one by clicking on the <code>Create Branch</code> button. You'll need to provide the branch name and what data to copy from the parent branch.</li>
</ul>
<p><img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9ncdgdrj32etd3gbqurf.png" alt="Branches view with Create branch option visible " width="800" height="400" loading="lazy">
<em>Create branch option</em></p>
<ul>
<li>You can either copy all the data or copy until a point in time or a specific record. This is useful for multiple purposes like restoring data, creating a new environment, or testing new features.</li>
</ul>
<p><img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw7gchucru5qw294icqw3.png" alt="Creating a new branch from an existing branch" width="800" height="400" loading="lazy">
<em>Creating a new branch</em></p>
<ul>
<li>Neon will create a new branch of the database that can be used independently. You can find the URL, username, and password for the new branch in the dashboard. And this happens in real time without any downtime and delays.</li>
</ul>
<p><img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fji79akuf193gtv94yaag.png" alt="Branch-specific connection details " width="800" height="400" loading="lazy">
<em>Branch-specific connection details</em></p>
<p>Now you can use your <code>dev</code> branch for local development and testing, and the <code>main</code> branch for production. This helps in keeping the data separate and ensures that changes in one branch do not affect the other branches.</p>
<h2 id="heading-summary">Summary</h2>
<p>In this article, we built a CRUD application using Spring Boot, Neon Postgres, and Azure App Service.</p>
<p>We explored how to set up the Neon Postgres database, build a basic CRUD application using Spring Boot, deploy the application on Azure App Service, and configure autoscaling for the application and the database.</p>
<p>We also learned about how the database branching feature in Neon Postgres helps you create branches of the database for different environments and purposes.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Deploy Your Node.js App on Azure ]]>
                </title>
                <description>
                    <![CDATA[ The advent of cloud computing marked a turning point in the field of technology. It provides easier access for users across the globe to web and mobile applications and services.  Modern-day computing services also provide a wide range of features wh... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-deploy-node-js-app-on-azure/</link>
                <guid isPermaLink="false">66bb58c75a83db22bea9843b</guid>
                
                    <category>
                        <![CDATA[ Azure ]]>
                    </category>
                
                    <category>
                        <![CDATA[ node ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Web Hosting ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Oluwatobi ]]>
                </dc:creator>
                <pubDate>Wed, 17 Jul 2024 11:56:43 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2024/07/awsP.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>The advent of cloud computing marked a turning point in the field of technology. It provides easier access for users across the globe to web and mobile applications and services. </p>
<p>Modern-day computing services also provide a wide range of features which make web apps easier to use and more efficient. So it's important for developers to have a basic understanding of how the cloud works.</p>
<p>This article is a beginner's guide to deploying backend applications to the cloud. We'll use the Azure platform as our cloud infrastructure and Node.js/Express for the backend web application. Before we go on, here are a few requirements:</p>
<ul>
<li>Basic understanding of cloud computing (you can check out <a target="_blank" href="https://dev.to/oluwatobi2001/introduction-to-cloud-computing-the-models-benefits-risks-implementation-and-popular-tools-2loh">this article</a> to learn more about that).</li>
<li>Knowledge of JavaScript.</li>
<li>VS Code.</li>
</ul>
<p>With that, let's get started.</p>
<h2 id="heading-introduction-to-azure">Introduction to Azure</h2>
<p>Azure is a cloud computing platform developed by Microsoft that acts as a server for deploying and hosting web applications, databases, file storage, and so on. </p>
<p>Compared to other cloud computing services, it is quite beginner-friendly and has an actively growing user base. Let’s explore the Azure portal.</p>
<h2 id="heading-how-to-set-up-azure-account">How to Set Up Azure Account</h2>
<p>Signing up on the Azure platform is the first step to hosting your application.   First, navigate to <a target="_blank" href="https://azure.microsoft.com/en-us/get-started/azure-portal">the website</a> and complete the signup process.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/07/image-36.png" alt="Image" width="600" height="400" loading="lazy">
<em>Azure sign in page</em></p>
<p>After signing up, you'll have access to the management console of the Azure application where all our activities can be carried out.</p>
<p>Before we go on, here are some of the services we'll be getting familiar with on this platform.</p>
<ul>
<li>Azure Resource groups</li>
<li>Azure app services</li>
<li>Storage accounts</li>
<li>SQL databases</li>
<li>Virtual networks</li>
</ul>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/07/serc3.PNG" alt="Image" width="600" height="400" loading="lazy">
<em>Azure services</em></p>
<p>Congratulations on successfully creating your Azure account.</p>
<h2 id="heading-deployment-options-on-azure">Deployment Options on Azure</h2>
<p>As a cloud computing platform, Azure boasts of its wide versatility. Depending on your skill level or preference, you can deploy web applications to Azure via the following options:</p>
<ul>
<li>Azure CLI</li>
<li>Azure Virtual machines</li>
<li>Azure Functions</li>
<li>Azure Kubernetes Service</li>
<li>Azure Storage.</li>
<li>Azure DevOps</li>
<li>Azure portal service</li>
</ul>
<p>We'll utilize the Azure portal service for this tutorial and use its VS Code integration to deploy a simple Node.js application to the Azure cloud.</p>
<h2 id="heading-how-to-set-up-the-backend-application">How to Set Up the Backend Application</h2>
<p>We'll create our web application using Node.js via the command line and Visual Studio Code.</p>
<p>Firstly, navigate to the folder where your app will be created and initialize a Node project by executing <code>npm init</code></p>
<p>Next, initialize the app by installing the <code>Express</code> framework. This can be done via <code>npm i express</code>. </p>
<p>Go on and paste the sample code for this tutorial:</p>
<pre><code><span class="hljs-keyword">const</span> express = <span class="hljs-built_in">require</span>(<span class="hljs-string">"express"</span>);
<span class="hljs-keyword">const</span> app = express();

app.use(express.json());

app.get(<span class="hljs-string">"/"</span>, <span class="hljs-function">(<span class="hljs-params">req, res</span>) =&gt;</span> {
    res.send(<span class="hljs-string">"Hello, World"</span>);
});

app.listen(process.env.PORT || <span class="hljs-number">5000</span>, <span class="hljs-function">() =&gt;</span> {
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"Server is running on port "</span> + (process.env.PORT || <span class="hljs-number">5000</span>));
});
</code></pre><p>The code above outputs <code>Hello World</code> whenever it is executed.</p>
<h2 id="heading-application-deployment">Application Deployment</h2>
<p>The backend code we wrote in the preceding paragraph will be deployed to Azure via the use of Azure’s VS Code extension.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/07/webVs.PNG" alt="Image" width="600" height="400" loading="lazy">
<em>VS Code homepage</em></p>
<p>Navigate to the Extensions tab, search for Azure App Services and install the extension. On successful installation, an Azure widget will appear on your taskbar where you can sign in to the Azure cloud.  </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/07/azure-app-service.PNG" alt="Image" width="600" height="400" loading="lazy">
<em>Extensions marketplace</em></p>
<p>Subsequently, we'll be creating a cloud-based web application in which our Node.js code will later be deployed.</p>
<p>On the Azure resources tab, clicking the <code>plus</code> icon will display a drop-down menu where various development options can be seen. We'll be clicking on the Azure app services option.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/07/res-1.png" alt="Image" width="600" height="400" loading="lazy">
<em>Azure drop down menu</em></p>
<p>After clicking that, a prompt will pop up asking for a unique name for the cloud application. In my case, I went with newApp777.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/07/newa7.PNG" alt="Image" width="600" height="400" loading="lazy">
<em>creating a web application</em></p>
<p>However, you can use any other name you so wish. Subsequently, you will need to select the backend language of your choice. Any version of Node.js will be compatible with our application.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/07/newStack.PNG" alt="Image" width="600" height="400" loading="lazy">
<em>web stacks available</em></p>
<p>Also, the F1 service option will be used for this tutorial. However, you can pick anyone you so desire.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/07/newTier.PNG" alt="Image" width="600" height="400" loading="lazy">
<em>Various Azure tiers</em></p>
<p>On successful completion, your application will be created on the Azure portal.</p>
<p>Now to the crux of the matter. Let's install our Node.js code on this web application. </p>
<p>We'll click on the code folder which provides us with options to automatically deploy our code to an Azure web app service.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/07/image-35.png" alt="Image" width="600" height="400" loading="lazy">
<em>Deployment dropdown menu</em></p>
<p>As soon as this is done, the list of the cloud servers on your Azure account will be shown. You can then select the new app we just created.  </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/07/sear.PNG" alt="Image" width="600" height="400" loading="lazy">
<em>app deployment</em></p>
<p>Your backend code should then be deployed on the NewApp cloud server we created. On successful completion, you'll receive a success message with a link to your cloud application.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/07/pro.PNG" alt="Image" width="600" height="400" loading="lazy">
<em>command prompt interface</em></p>
<p>Congratulations, you have successfully hosted your first web application. Navigate <a target="_blank" href="https://newapp777.azurewebsites.net/">here</a> to see the hosted application.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/07/wevpage.PNG" alt="Azure app" width="600" height="400" loading="lazy">
<em>The application webpage</em></p>
<h2 id="heading-additional-information">Additional Information</h2>
<p>So far, we have covered the basics of deploying an application via the use of VS code extensions on Azure portal services. As you progress in the field of cloud computing, other interesting fields can also be explored such as:</p>
<ul>
<li>App monitoring with Azure Monitor.</li>
<li>Azure app networking essentials.</li>
<li>Azure MySQL database integration.</li>
<li>Node JS serverless functions deployment.</li>
</ul>
<p>You can also interact with me on my blog and check out my other articles <a target="_blank" href="https://linktr.ee/tobilyn77">here</a>. Till next time, keep on coding!</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Deploy a Web App ]]>
                </title>
                <description>
                    <![CDATA[ Deploying a web application can seem daunting, but with the right tools and guidance, it becomes a manageable task. We are excited to share a comprehensive course on the freeCodeCamp.org YouTube channel that will explain this process. This course wil... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-deploy-a-web-app/</link>
                <guid isPermaLink="false">668fe41e014ed0d6be02e817</guid>
                
                    <category>
                        <![CDATA[ deployment ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Azure ]]>
                    </category>
                
                    <category>
                        <![CDATA[ youtube ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Beau Carnes ]]>
                </dc:creator>
                <pubDate>Thu, 11 Jul 2024 13:54:38 +0000</pubDate>
                <media:content url="https://cdn.hashnode.com/res/hashnode/image/upload/v1720706045613/eaa98b5c-2309-4abd-859e-02e1c4d45ad4.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Deploying a web application can seem daunting, but with the right tools and guidance, it becomes a manageable task. We are excited to share a comprehensive course on the <a target="_blank" href="http://freeCodeCamp.org">freeCodeCamp.org</a> YouTube channel that will explain this process. This course will guide you through deploying web applications using various services, including Azure, Render, MongoDB Atlas, Koyeb, and more.</p>
<p>In this course, Kerollos Magdy, a Microsoft software engineer, takes you step-by-step through different methods to deploy web applications. The course starts with free options and then explain how to deploy using Microsoft Azure. Regardless of the programming language or framework you use, you should be able to deploy using the same steps.</p>
<p>The first part of the course introduces you to deploying applications using free and sometimes open source options. In the second section, you'll get a detailed walkthrough on deploying applications using Microsoft Azure, a powerful cloud service provider. Azure’s comprehensive suite of tools and services makes it a popular choice for developers, and this course will show you how to leverage its full potential.</p>
<p>Kerollos brings his expertise and passion for open-source technologies to this course, making complex concepts accessible and understandable. He uses various examples to illustrate the deployment process, demonstrating how to deploy both backend and frontend applications. You'll learn about setting up a PostgreSQL database, deploying backend services, and ensuring your frontend is properly integrated.</p>
<p>The course also covers other services like Render, MongoDB Atlas, and Koyeb, providing you with a broad understanding of different deployment environments. Render is particularly highlighted for its ability to deploy both backend and frontend applications seamlessly. You’ll follow along as Kerollos sets up a Render account, creates a PostgreSQL database, and deploys an application using Node.js and Prisma.</p>
<p>By the end of this course, you'll have the knowledge to choose the most suitable deployment solution for your projects. Whether you're working on a hobby project or a professional application, these skills are invaluable. The course ensures you’re well-equipped to handle deployment tasks confidently and efficiently.</p>
<p>Watch the full course on <a target="_blank" href="https://youtu.be/vROMXzOWqec">the freeCodeCamp.org YouTube channel</a> (1-hour watch).</p>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/vROMXzOWqec" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Create a ML Model with Azure Machine Learning Designer ]]>
                </title>
                <description>
                    <![CDATA[ Did you know that you can create machine learning models without writing any code? If you’re here, you’re probably curious about how to achieve this. In this article, I will guide you through building a regression model that predicts automobile price... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/create-an-ml-model-with-azure-machine-learning-designer/</link>
                <guid isPermaLink="false">66d45e3dbc9760a197a10374</guid>
                
                    <category>
                        <![CDATA[ Azure ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Low Code ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Machine Learning ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Eniola Ajala ]]>
                </dc:creator>
                <pubDate>Tue, 25 Jun 2024 14:45:20 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2024/06/F8825B00-8A4C-41D9-AE75-02A8631DE983.jpeg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Did you know that you can create machine learning models without writing any code? If you’re here, you’re probably curious about how to achieve this.</p>
<p>In this article, I will guide you through building a regression model that predicts automobile prices using Azure Machine Learning’s Low-Code/No-Code tools.</p>
<p><code>Regression</code> is a supervised machine learning technique used for predicting numerical values. To understand regression better, you can read my previous article <a target="_blank" href="https://medium.com/@ajalaeniola454/supervised-and-unsupervised-learning-in-machine-learning-06c7151a0c2a">here</a>.</p>
<h3 id="heading-prerequisites">Prerequisites</h3>
<p>To fully understand and follow the steps in this tutorial, you need the following:</p>
<ol>
<li><p>An Azure account: You must have an active Azure account.</p>
</li>
<li><p>An Azure subscription: An active Azure subscription is required.</p>
</li>
</ol>
<p>If you don’t have an Azure account yet, you can sign up for <a target="_blank" href="https://azure.microsoft.com/en-us/free/students?wt.mc_id=studentamb_230833">Azure for Students</a>, the <a target="_blank" href="https://github.com/edu/students?wt.mc_id=studentamb_230833">GitHub Student Developer Pack</a>, or an <a target="_blank" href="https://azure.microsoft.com/en-us/free?wt.mc_id=studentamb_230833">Azure Free Trial</a>. These options provide various benefits and free credits to get you started.</p>
<p>Now let's get into building our model. Follow the steps below to begin! Make sure you read till the end to learn the entire process.</p>
<h2 id="heading-table-of-contents">Table of Contents</h2>
<ul>
<li><p><a class="post-section-overview" href="#heading-how-to-set-up-your-azure-machine-learning-workspace">How to Set Up Your Azure Machine Learning Workspace</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-set-up-compute-resources-in-azure-machine-learning-studio">How to Set Up Compute Resources in Azure Machine Learning Studio</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-create-your-machine-learning-pipeline">How to Create Your Machine Learning Pipeline</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-build-the-model">How to Build the Model</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-evaluate-the-model">How to Evaluate the Model</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-deploy-the-model">How to Deploy the Model</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-clean-up">Cleaning Up</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-conclusion">Conclusion</a></p>
</li>
</ul>
<h2 id="heading-how-to-set-up-your-azure-machine-learning-workspace">How to Set Up Your Azure Machine Learning Workspace</h2>
<p>To start working with <code>Azure Machine Learning</code>, you first need to create a <code>workspace</code>. A <code>workspace</code> is a centralized place to manage all the resources and experiments in your machine learning projects.</p>
<h3 id="heading-step-1-create-a-resource-group">Step 1: Create a Resource Group</h3>
<p>Start by signing in to the <a target="_blank" href="https://azure.microsoft.com/en-us/get-started/azure-portal?wt.mc_id=studentamb_230833">Azure Portal.</a> Click the <code>Create a resource</code> button (the plus icon) on the left-hand navigation bar.</p>
<p>In the search bar, type “Machine Learning” and select <code>Azure Machine Learning</code> from the list.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/06/1-1.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Navigating to the Azure Home page and clicking the plus icon to create a new resource for the machine learning project</em></p>
<h3 id="heading-step-2-create-a-new-azure-machine-learning-resource">Step 2: Create a New Azure Machine Learning Resource</h3>
<p>Now click <code>Create</code> to begin setting up your workspace. You will need to fill in the necessary details:</p>
<ul>
<li><p><strong>Subscription:</strong> Select your Azure subscription.</p>
</li>
<li><p><strong>Resource Group:</strong> Either select an existing resource group or create a new one by clicking <code>Create new</code> and providing a name.</p>
</li>
<li><p><strong>Workspace Name:</strong> Provide a unique name for your workspace.</p>
</li>
<li><p><strong>Region</strong>: Choose a region that is closest to your location to reduce latency.</p>
</li>
<li><p><strong>Container Registry:</strong> Choose <code>Create new</code> unless you have an existing container registry you want to use.</p>
</li>
</ul>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/06/3-1.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Browsing the Azure Marketplace for machine learning services to find the appropriate tool for building and deploying models.</em></p>
<h3 id="heading-step-3-review-and-create">Step 3: Review and Create</h3>
<p>Fill in the form with all the required info. Make sure you provide a unique <code>Name</code> and select a region. Then create your new container registry.</p>
<p>Review your settings to ensure everything is correct. Then click <code>Review + create</code> to validate your configuration. Once the validation is complete, click <code>Create</code> to deploy your workspace. This process may take a few minutes.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/06/5-1.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Setting up a new machine learning workspace in Azure with essential configuration details.</em></p>
<h3 id="heading-step-4-deployment">Step 4: Deployment</h3>
<p>After the deployment is complete, click the <code>Go to resource</code> button to navigate to your new workspace.</p>
<p>In the workspace overview, click <code>Launch studio</code> to open the <code>Azure Machine Learning Studio</code>, where you will perform all your machine learning tasks.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/06/7.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Resource deployment complete in Microsoft Azure Machine Learning Services.</em></p>
<h2 id="heading-how-to-set-up-compute-resources-in-azure-machine-learning-studio">How to Set Up Compute Resources in Azure Machine Learning Studio</h2>
<p>Once your workspace deployment is complete, you need to set up the compute resources required to run your machine learning experiments. Follow the steps below to do this.</p>
<h3 id="heading-step-1-access-the-workspace">Step 1: Access the Workspace</h3>
<p>After the deployment is complete, click the <code>Go to resource button</code>. In the workspace overview, click <code>Launch studio</code> to open the Azure Machine Learning Studio.</p>
<h3 id="heading-step-2-create-a-compute-instance">Step 2: Create a Compute Instance</h3>
<p>In the Azure Machine Learning Studio, navigate to the left-hand menu and click on Compute. Select the <code>Compute instances</code> tab, then click <code>+ New</code> to create a new compute instance.</p>
<p>Fill in the required details:</p>
<ul>
<li><p><strong>Virtual machine size:</strong> Select <code>Standard_DS11_v2</code> for a balance of performance at minimal cost.</p>
</li>
<li><p><strong>Compute name:</strong> Enter a unique name for your compute instance.</p>
</li>
</ul>
<p>Then click <code>Create</code> set up the compute instance. This process might take a few minutes.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/06/conp-running.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Configuring compute instances in Azure Machine Learning to ensure the required computational power for training machine learning models.</em></p>
<h3 id="heading-step-3-create-a-compute-cluster">Step 3: Create a Compute Cluster</h3>
<p>In addition to a compute instance, you will need a compute cluster for scalable training. Still under the <code>Compute</code> section, select the <code>Compute clusters</code> tab and click <code>+ New</code>.</p>
<p>Fill in the details:</p>
<ul>
<li><p><strong>Cluster name:</strong> Enter a unique name for your compute cluster.</p>
</li>
<li><p><strong>Virtual machine size:</strong> Choose <code>Standard_DS11_v2</code>.</p>
</li>
<li><p><strong>Minimum number of nodes:</strong> Set to <code>0</code> to save costs when not in use.</p>
</li>
<li><p><strong>Maximum number of nodes:</strong> Set to <code>2</code> for this tutorial.</p>
</li>
</ul>
<p>Then click <code>Create</code> to set up the compute cluster. Wait for the cluster to be in a running state before proceeding.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/06/11.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Overview of compute clusters in Azure Machine Learning</em></p>
<h2 id="heading-how-to-create-your-machine-learning-pipeline">How to Create Your Machine Learning Pipeline</h2>
<p>In this section, we will create a <code>machine learning pipeline</code> using <code>Azure Machine Learning Designer</code>. Pipelines help streamline the process of preparing data, training models, and deploying them.</p>
<h3 id="heading-step-1-navigate-to-the-designer">Step 1: Navigate to the Designer</h3>
<p>In the Azure Machine Learning Studio, go to the left navigation bar and click on <code>Designer</code>. Then click <code>+ New pipeline</code> to start creating a new pipeline.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/06/p1.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Interface showing the creation of a new pipeline.</em></p>
<h3 id="heading-step-2-add-your-data">Step 2: Add Your Data</h3>
<p>You have the option to use external data or prebuilt sample datasets. For this tutorial, we’ll use a prebuilt sample dataset.</p>
<p>To use prebuilt sample data, click on the <code>Components</code> tab. Use the search bar or manually scroll to find the <code>Automobile price data</code> dataset. Drag and drop the dataset onto the canvas in the Designer.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/06/p2.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Interface showing the addition of Automobile price data set.</em></p>
<h3 id="heading-step-3-explore-the-data">Step 3: Explore the Data</h3>
<p>Once the dataset is on the canvas, click on it to view its details. Navigate to the <code>Visualizations</code> tab to explore data distribution and statistical summaries. Click the <code>Output+logs</code> tab and then <code>Preview data</code> to inspect the first few rows of the dataset. This will help you understand the data's structure and identify any potential issues.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/06/p3.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Visualization of dataset</em></p>
<h3 id="heading-step-4-prepare-the-data">Step 4: Prepare the Data</h3>
<p>To specify the variables we want to work with, we need to filter out unnecessary columns.</p>
<p>From the <code>Data Transformation</code> section, drag and drop the <code>Select Columns in Dataset</code> module onto the canvas below the dataset. Connect the output node of the dataset to the input node of the <code>Select Columns in Dataset</code> module.</p>
<p>Open the module’s settings, select the columns you want to include in your model, and exclude irrelevant columns such as <code>normalized-losses.</code> (<em>We are removing this column because it has high percentage of missing data</em>). Click <code>Save and close</code> to apply the changes.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/06/n1-1.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Interface for selecting columns in the dataset.</em></p>
<p>Next, you will need to clean any missing data. This helps us handle missing values to improve the model's accuracy.</p>
<p>To do this, drag and drop the <code>Clean Missing Data</code> module onto the canvas, below the <code>Select Columns in Dataset</code> module. Connect the nodes and configure the settings to remove rows with missing values. Save and close the settings.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/06/n2.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Interface for cleaning columns in the dataset.</em></p>
<h3 id="heading-step-5-normalize-the-data">Step 5: Normalize the Data</h3>
<p>To ensure the model performs well, we need to normalize the data. To do this, from the <code>Data Transformation</code> section, drag and drop the <code>Normalize Data</code> module onto the canvas. Connect the output of the <code>Clean Missing Data</code> module to the input of the <code>Normalize Data</code> module.</p>
<p>You'll want to configure the module to use the <code>MinMax</code> scaling method and select the columns to normalize, you can type them out manually by separating each column with a comma. Then save and close the settings.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/06/n3.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Interface for normalizing columns in the dataset.</em></p>
<h3 id="heading-step-6-finalize-the-pipeline-setup">Step 6: Finalize the Pipeline Setup</h3>
<p>Once all transformations are in place, review the pipeline to ensure all steps are correctly configured. Click <code>Submit</code> to run the pipeline. You can monitor the pipeline’s progress in the <code>Jobs</code> section.</p>
<p>NOTE: Each time you set up a module and you click submit, <code>view the details</code> of the <code>pipeline job</code> to keep track of your flows.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/06/n4.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Monitoring pipeline through the link</em></p>
<h2 id="heading-how-to-build-the-model">How to Build the Model</h2>
<p>This is the fun step where we start building our machine learning model by preparing the dataset for training and applying the appropriate algorithms.</p>
<h3 id="heading-step-1-split-the-dataset">Step 1: Split the Dataset</h3>
<p>Drag and drop the Split Data module onto the canvas. Then connect the output of the Normalize Data module to the input of the <code>Split Data</code> module.</p>
<p>In the settings panel of the Split Data module:</p>
<ul>
<li><p>Set the <code>Fraction of rows</code> in the first output dataset to 0.7. This means 70% of the data will be used for training the model.</p>
</li>
<li><p>Set the <code>Randomized seed</code> to any number to ensure reproducibility. For this tutorial, use 123.</p>
</li>
</ul>
<h3 id="heading-step-2-train-the-model">Step 2: Train the Model</h3>
<p>Now it's time to add the <code>Train Model</code> block. Drag and drop the <code>Train Model</code> module onto the canvas. Connect the first output of the <code>Split Data</code> module (the 70% training data) to the input of the <code>Train Model</code> module.</p>
<p>Click on the <code>Train Model</code> module to configure its settings. In the <code>Edit column</code> section, select the target variable, which in this case is <code>price.</code> Save and close the settings.</p>
<p>Next, you'll add the Training Algorithm. From the <code>Machine Learning Algorithms</code> section, drag and drop the <code>Linear Regression</code> module onto the canvas. Connect the output of the <code>Linear Regression</code> module to the right input of the <code>Train Model</code> module.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/06/n7.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Interface showing connection of modules in pipeline</em></p>
<h3 id="heading-step-3-evaluate-the-model">Step 3: Evaluate the Model:</h3>
<p>Drag and drop the <code>Score Model</code> module onto the canvas. Connect the second output of the <code>Split Data</code> module (the 30% testing data) to the left input of the <code>Score Model</code> module. Connect the output of the <code>Train Model</code> module to the right input of the <code>Score Model</code> module.  This will apply the trained model to the testing data to evaluate its performance.</p>
<p>Next, drag and drop the <code>Evaluate Model</code> module onto the canvas. Connect the output of the <code>Score Model</code> module to the input of the <code>Evaluate Model</code> module. This will provide various evaluation metrics to assess the model’s accuracy.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/06/model-1.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Interface showing connection of modules in pipeline</em></p>
<h3 id="heading-step-4-review-and-submit">Step 4: Review and Submit</h3>
<p>Double-check all connections and settings in your pipeline. Then click <code>Submit</code> to run the model training and evaluation pipeline. You can monitor the job’s progress in the <code>Jobs</code> section, where you can view logs and outputs.</p>
<h2 id="heading-how-to-evaluate-the-model">How to Evaluate the Model</h2>
<p>After training our model, it’s important to evaluate its performance to ensure it’s making accurate predictions. We will use the <code>Score Model</code> and <code>Evaluate Model</code> modules for this purpose.</p>
<h3 id="heading-step-1-evaluate-the-models-performance">Step 1: Evaluate the Model’s Performance</h3>
<p>Drag and drop the <code>Evaluate Model</code> module onto the canvas. Connect the output of the <code>Score Model</code> module to the input of the <code>Evaluate Model</code> module.</p>
<p>The <code>Evaluate Model</code> module will generate various evaluation metrics, such as Mean Absolute Error (MAE), Root Mean Squared Error (RMSE), and R-squared (R²), which are critical for assessing the accuracy and performance of the regression model.</p>
<h3 id="heading-explore-the-evaluation-metrics">Explore the Evaluation Metrics:</h3>
<p>Once the pipeline execution is complete, click on the <code>Evaluate Model</code> module to explore the detailed metrics.</p>
<p>Here are some key metrics to focus on:</p>
<ul>
<li><p><strong>Mean Absolute Error (MAE):</strong> Measures the average magnitude of errors in predictions, without considering their direction. Lower values indicate better accuracy.</p>
</li>
<li><p><strong>Root Mean Squared Error (RMSE):</strong> Similar to MAE but gives more weight to larger errors. Lower values are better.</p>
</li>
<li><p><strong>R-squared (R²):</strong> Indicates how well the model’s predictions match the actual data. Values closer to 1 signify a better fit.</p>
</li>
</ul>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/06/n9.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Visualization of data output from the regression model.</em></p>
<p>We just built and evaluated our model. Yayy!</p>
<h2 id="heading-how-to-deploy-the-model">How to Deploy the Model</h2>
<p>Now that we have trained and evaluated our regression model, it’s time to deploy it for real-time inference using Azure Machine Learning. Follow these steps to deploy the model and create an inference pipeline.</p>
<h3 id="heading-step-1-create-the-inference-pipeline">Step 1: Create the Inference Pipeline</h3>
<p>Navigate to the <code>Designer</code> section in Azure Machine Learning Studio and create a new pipeline for deployment. Select <code>Real-time inference</code> to set up the deployment pipeline automatically.</p>
<h3 id="heading-step-2-configure-the-pipeline">Step 2: Configure the Pipeline</h3>
<p>After selecting Real-time inference, the pipeline will be initialized with default components. You can modify the pipeline by adding necessary components.</p>
<p>We have to make some changes like adding <code>Enter data manually</code>, <code>Execute python script</code> modules. Also, in the <code>select column in dataset</code> block, edit and remove the price column. Remove connection between <code>Score model</code> and <code>web service</code>.</p>
<ul>
<li><code>Enter Data Manually</code>: Drag and drop this block onto the canvas. This component allows manual input of data for prediction. Copy and paste the data below into the <code>data</code> field.</li>
</ul>
<p>symboling,fuel-type,aspiration,num-of-doors,body-style,drive-wheels,engine-location,wheel-base,length,width,height,curb-weight,engine-type,num-of-cylinders,engine-size,fuel-system,bore,stroke,compression-ratio,horsepower,peak-rpm,city-mpg,highway-mpg,make 3,gas,std,two,convertible,rwd,front,88.6,168.8,64.1,48.8,2548,dohc,four,130,mpfi,3.47,2.68,9,111,5000,21,27,alfa-romero giulia 3,gas,std,two,convertible,rwd,front,88.6,168.8,64.1,48.8,2548,dohc,four,130,mpfi,3.47,2.68,9,111,5000,21,27,alfa-romero stelvio 1,gas,std,two,hatchback,rwd,front,94.5,171.2,65.5,52.4,2823,ohcv,six,152,mpfi,2.68,3.47,9,154,5000,19,26,alfa-romero Quadrifoglio 2,gas,std,four,sedan,fwd,front,99.8,176.6,66.2,54.3,2337,ohc,four,109,mpfi,3.19,3.4,10,102,5500,24,30,audi 100 ls 2,gas,std,four,sedan,4wd,front,99.4,176.6,66.4,54.3,2824,ohc,five,136,mpfi,3.19,3.4,8,115,5500,18,22,audi 100ls 2,gas,std,two,sedan,fwd,front,99.8,177.3,66.3,53.1,2507,ohc,five,136,mpfi,3.19,3.4,8.5,110,5500,19,25,audi fox 1,gas,std,four,sedan,fwd,front,105.8,192.7,71.4,55.7,2844,ohc,five,136,mpfi,3.19,3.4,8.5,110,5500,19,25,audi 100ls 1,gas,std,four,wagon,fwd,front,105.8,192.7,71.4,55.7,2954,ohc,five,136,mpfi,3.19,3.4,8.5,110,5500,19,25,audi 5000 1,gas,turbo,four,sedan,fwd,front,105.8,192.7,71.4,55.9,3086,ohc,five,131,mpfi,3.13,3.4,8.3,140,5500,17,20,audi 4000</p>
<ul>
<li><code>Execute Python Script</code>: Replace the code in this block with:</li>
</ul>
<p>import pandas as pd def azureml_main(dataframe1=None, dataframe2=None): scored_results = dataframe1[["Scored Labels"]] scored_results.rename(columns={"Scored Labels": "predicted price"}, inplace=True)<br>return scored_results</p>
<ul>
<li><p><code>Select Columns in Dataset</code>: Edit and remove the <code>price</code> column to ensure it’s not included in the input data for predictions.</p>
</li>
<li><p><code>Remove Connection</code>: Disconnect the <code>Score Model</code> module from the web service output to ensure only the <code>Execute Python Script</code> block connects to it.</p>
</li>
</ul>
<p>See the images below for a visual representation of how the connections are configured.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/08/3E905EDF-3F19-4451-8F31-6F80F7212957.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Interface of modules connection in pipeline</em></p>
<h3 id="heading-step-3-submit-and-deploy-the-model">Step 3: Submit and Deploy the Model</h3>
<p>Submit the flow and wait for all processes to complete successfully (green check mark). Once your deployment is successful, you can explore the output to verify everything is functioning as expected.</p>
<p>You can now deploy the model as a real-time web service for predictions.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/06/n13.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Configuration settings for setting up new pipeline</em></p>
<p>Once all the processes are successfully completed in Azure Machine Learning Studio, you are ready to explore the output and deploy your trained model as a real-time web service.</p>
<p>Here’s how you can proceed:</p>
<ol>
<li><p><strong>Review Pipeline Execution:</strong> Ensure that all the steps in your pipeline have completed with a green check mark indicating success.</p>
</li>
<li><p><strong>View Outputs and Visualizations:</strong> Navigate through the different components of your pipeline to inspect outputs and visualizations generated during data transformation, model training, and evaluation stages. This helps in understanding how each step has contributed to the overall model performance.</p>
</li>
<li><p><strong>Check Evaluation Metrics:</strong> Examine the evaluation scores generated by the <code>Score Model</code> block to assess the performance of your trained regression model. Common evaluation metrics include Mean Squared Error (MSE), R-squared (R2), and Root Mean Squared Error (RMSE). These metrics provide insights into how well your model predicts automobile prices based on the input features.</p>
</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/06/n10-1.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Visualization of data output from model evaluation.</em></p>
<p>Put the following checks in place before starting the deployment:</p>
<h4 id="heading-prepare-for-deployment">Prepare for Deployment</h4>
<p>First, ensure that the <code>Execute Python Script</code> block is correctly configured to transform input data and produce predicted prices.</p>
<p>You'll also want to verify that the pipeline is set up to handle real-time inference for deploying the model.</p>
<h4 id="heading-submit-the-pipeline">Submit the Pipeline</h4>
<p>Click on the submit button to initiate the deployment process. Wait for Azure Machine Learning to complete the deployment and verify that all components have been successfully deployed.</p>
<h4 id="heading-deploy-as-web-service">Deploy as Web Service</h4>
<p>Once deployment is confirmed successful, you can deploy the model as a real-time web service. This web service will be hosted on Azure and can be accessed via API endpoints, allowing applications to send data and receive predictions in real-time.</p>
<h4 id="heading-testing-the-web-service">Testing the Web Service:</h4>
<p>Use the <code>Enter Data Manually</code> block to manually input test data or use external systems to send requests to the deployed web service endpoint. You can verify that the web service responds with predicted prices based on the input features.</p>
<h4 id="heading-monitor-and-manage">Monitor and Manage:</h4>
<p>Monitor the performance of your deployed web service using Azure Machine Learning monitoring tools. You can manage the deployment by scaling resources as needed or updating the model with new data or improved versions.</p>
<p>Deploying your regression model as a real-time web service enables you to use its predictive capabilities in various applications without the need for direct human intervention. It ensures that your model can continuously provide accurate predictions based on real-time data inputs.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/06/n17.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Interface showing predicted price</em></p>
<h2 id="heading-clean-up">Clean Up</h2>
<p>The web service you created is hosted in an <code>Azure Container Instance</code>. If you don’t intend to experiment with it further, you should delete the endpoint to avoid accruing unnecessary Azure usage.</p>
<p>Deleting your compute ensures your subscription won’t be charged for compute resources. You will, however, be charged a small amount for data storage as long as the Azure Machine Learning workspace exists in your subscription.</p>
<p>If you have finished exploring Azure Machine Learning, you can delete the Azure Machine Learning workspace and associated resources.</p>
<p>To delete your workspace:</p>
<ol>
<li><p>In the <a target="_blank" href="https://portal.azure.com/?azure-portal=true">Azure portal</a>, in the <strong>Resource groups</strong> page, open the resource group you specified when creating your Azure Machine Learning workspace.</p>
</li>
<li><p>Click <strong>Delete resource group</strong>, type the resource group name to confirm you want to delete it, and select <strong>Delete</strong>.</p>
</li>
</ol>
<h2 id="heading-conclusion">Conclusion</h2>
<p>Congratulations! You have successfully created and deployed a regression model using Azure Machine Learning Designer without writing a single line of code.</p>
<p>In this tutorial, you have learned how to clean and preprocess data, build and train a machine learning model, evaluate its performance, and deploy it as a web service. This low-code/no-code approach in Azure Machine Learning Designer makes it accessible for everyone to use the power of machine learning.</p>
<p>Remember to clean up your resources to avoid unnecessary charges. With these skills, you can now experiment with other datasets and machine learning problems. Azure's possibilities are endless, and Azure Machine Learning provides a robust platform for your data science projects.</p>
<p>Till next time, cheers :)</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Host Static Sites on Azure Static Web Apps for Free ]]>
                </title>
                <description>
                    <![CDATA[ In this article, I will show you how you can host your React/Next.js app or any static web app on Azure Static Web Apps.  I will be showing you both ways of doing it – through the GUI and with the CLI. I assume you already have built a ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-host-static-sites-on-azure-static-web-apps/</link>
                <guid isPermaLink="false">66bb9188867a396452a8027f</guid>
                
                    <category>
                        <![CDATA[ Azure ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Web Development ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Shrijal Acharya ]]>
                </dc:creator>
                <pubDate>Tue, 18 Jun 2024 10:59:18 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2024/06/host_static_sites_swa_azure.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>In this article, I will show you how you can host your React/Next.js app or any static web app on Azure Static Web Apps. </p>
<p>I will be showing you both ways of doing it – through the GUI and with the CLI.</p>
<p>I assume you already have built a project and optionally pushed it to GitHub or any other alternative, like GitLab or Bitbucket.</p>
<p>It's time to go live with your project and showcase it to the world. 💪 </p>
<p>Whether it is your first time working with Azure or you are already a champ, feel free to follow along. </p>
<h2 id="heading-what-is-cicd">What is CI/CD?</h2>
<p>Before we dive into Azure Static Web App, let me give you a brief overview of what CI/CD is.</p>
<p>Imagine you're building your cool new web app. Now, to make sure it's always up-to-date and running, you need something called Continuous Integration/Continuous Deployment (CI/CD). </p>
<p>Here's how it works:</p>
<ul>
<li><strong>Continuous Integration (CI)</strong> is the process of automatically building and testing your code whenever you make changes and ensuring it is working as you expect.</li>
<li><strong>Continuous Deployment (CD)</strong> is the process of automatically deploying your tested code to production.</li>
</ul>
<p>You might have already came across CI/CD if you've ever hosted your project on Vercel, Netlify, or any other site hosting platform, and noticed that once you push your local changes to your remote repository, those changes are reflected on the original hosted site in just a few minutes. Magic, huh? This is all possible with the help of CI/CD.</p>
<p>In short, CI/CD ensures that your project is tested and deployed whenever you push new commits to the repository hosting your project.</p>
<h2 id="heading-how-to-push-your-project-to-github">How to Push your Project to GitHub</h2>
<p>In this step, I will use GitHub as an example. If your project is already pushed to GitHub, feel free to skip this step. Otherwise, follow the steps shown below.</p>
<h3 id="heading-log-in-to-github-cli">Log in to GitHub CLI</h3>
<p>Did you know you can create a GitHub repository right from your command line?</p>
<p>Let's get started. Firstly, make sure you have GitHub CLI installed. For installation instructions, follow the steps shown <a target="_blank" href="https://github.com/cli/cli/blob/trunk/docs/install_linux.md">here</a>.</p>
<p>To authenticate your GitHub CLI to your account, run the below command:</p>
<pre><code class="lang-bash">gh auth login
</code></pre>
<p>Follow the steps displayed in your terminal to authenticate with GitHub. Once done, you can proceed to the next step.</p>
<h3 id="heading-create-a-repository">Create a repository</h3>
<p>Once you're logged in, you can run the below command to start an interactive repository creation mode:</p>
<pre><code class="lang-bash">gh repo create
</code></pre>
<p>Or, directly specify flags to it like so:</p>
<pre><code class="lang-bash">gh repo create &lt;repository_name&gt; --public --license mit --description &lt;repository_description&gt;
</code></pre>
<p>Running, this command will create a repository with all the specified options in your GitHub account.</p>
<h3 id="heading-push-your-changes">Push your changes</h3>
<p>Now, that you have already authenticated yourself and have created a repository in your GitHub account, it's time to push your local changes to the remote repository.</p>
<p>Run the following commands to push your local changes to the remote:</p>
<pre><code class="lang-bash">git branch -M main
git remote add origin https://github.com/&lt;username&gt;/&lt;repository_name&gt;.git
git push -u origin main
</code></pre>
<p>Note that if you have SSH authentication set up, you need to make sure you change the origin URL to follow SSH protocol.</p>
<p>That concludes the initial preparation. Now, let's proceed with creating the Azure Static Web App. 🚀</p>
<h2 id="heading-host-your-project-with-azure-swa-cli">Host your project with Azure SWA CLI</h2>
<p>In this section, you'll learn how to host your static project, whether it built with Next.js, React, or any other static site, using Azure SWA CLI.</p>
<p>First, you need to install the <code>@azure/static-web-apps-cli</code> package as a dev dependency. </p>
<p>If using <code>pnpm</code> as a package manager, run the below command. The command might vary based on different package managers.</p>
<pre><code class="lang-bash">pnpm install -g @azure/static-web-apps-cli
</code></pre>
<p>Now, build your project with the appropriate build command:</p>
<pre><code class="lang-bash">pnpm run build
</code></pre>
<p>It's time to deploy the application with the build folder. Run the below command to deploy it to Azure SWA:</p>
<pre><code class="lang-bash">swa deploy &lt;build_location&gt; --env production
</code></pre>
<p>If your application uses an API, then you need to pass the <code>api</code> folder location as a flag to the above command. So, your final command would be:</p>
<pre><code class="lang-bash">swa deploy &lt;build_location&gt; --api-location &lt;api_folder_location&gt; --env production
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/06/Untitled-design-5-.png" alt="Image" width="600" height="400" loading="lazy">
<em>Deploying the project with Azure Static Web App CLI.</em></p>
<p>That is it. Your site is deployed to Azure Static Web App through CLI. 🎉 You can view it in the shown URL. </p>
<p>There are further configuration which can be specified. For additional configuration, follow this <a target="_blank" href="https://learn.microsoft.com/en-us/azure/static-web-apps/static-web-apps-cli-configuration">link</a>.</p>
<h2 id="heading-how-to-host-your-project-with-azure-portal-gui">How to Host your project with Azure Portal GUI</h2>
<p>In this section, we will create another brand new Azure SWA through the Azure portal.</p>
<p>Head over to the Azure portal at <a target="_blank" href="https://portal.azure.com">https://portal.azure.com</a> and search for the Azure Static Web App.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/06/Screenshot-from-2024-06-15-16-24-56.png" alt="Image" width="600" height="400" loading="lazy">
<em>Azure portal search results for Static Web App.</em></p>
<p> Hit "Create" and you should be asked with a bunch of extra configurations.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/06/Untitled-design-1-.png" alt="Image" width="600" height="400" loading="lazy">
<em>Creating a new Azure Static Web App.</em></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/06/Screenshot-2024-06-15-at-16-39-09-Microsoft-Azure.png" alt="Image" width="600" height="400" loading="lazy">
<em>Setting up the configurations for the Azure Static Web App.</em></p>
<p>For the Resource Group, create one and name it whatever you want. Also, give your web application a name.</p>
<p>If your project is hosted on GitHub, choose GitHub as the option and choose the repository from the dropdown menu. For the branch, select 'main' if you created the project from scratch with default settings.</p>
<p>If you are using any other alternatives, then select the one which satisfies your criteria.</p>
<p>Leave everything else as default and click on "Review + create" and wait till it is done hosting your project to Azure SWA.</p>
<p>In the Overview section of the app, you should see URL for your built project. Here is the overview of mine:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/06/Untitled-design-2-.png" alt="Image" width="600" height="400" loading="lazy">
<em>Azure Static Web App dashboard overview.</em></p>
<p>Visit the URL and you should have your site ready. 🥳</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/06/image-84.png" alt="Image" width="600" height="400" loading="lazy">
<em>Deployed project hero section.</em></p>
<h2 id="heading-wrapping-up">Wrapping Up</h2>
<p>By now, you should have a general idea of how to host any static web app in Azure Static Web Apps.</p>
<p>While we could cover additional topics like adding a custom domain to our site, this may not apply to most of you, so I'm not including the steps in this article. To learn more, visit this <a target="_blank" href="https://learn.microsoft.com/en-us/azure/static-web-apps/custom-domain-external">link</a>.</p>
<p>So, that is it for this article. Thank you so much for reading! See you next time. 🫡</p>
<p>Now that you've had a sneak peek at my portfolio in the image above, why not get in touch? 😉 Feel free to connect with me here:</p>
<ul>
<li><strong>GitHub</strong>: <a target="_blank" href="https://github.com/shricodev">https://github.com/shricodev</a></li>
<li><strong>LinkedIn</strong>: <a target="_blank" href="https://linkedin.com/in/iamshrijal">https://linkedin.com/in/iamshrijal</a></li>
<li><strong>Twitter</strong>: <a target="_blank" href="https://twitter.com/shricodev">https://twitter.com/shricodev</a></li>
</ul>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Master the Azure DevOps Engineer Expert Certification (AZ-400) ]]>
                </title>
                <description>
                    <![CDATA[ The Azure DevOps Engineer Expert Certification (AZ-400) is for professionals who aim to demonstrate their expertise in integrating people, processes, and technologies to continuously deliver valuable products and services. It’s ideal for those who ar... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/master-the-azure-devops-engineer-expert-certification-az-400/</link>
                <guid isPermaLink="false">6661cc41176c755bd459a7cd</guid>
                
                    <category>
                        <![CDATA[ Azure ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Devops ]]>
                    </category>
                
                    <category>
                        <![CDATA[ youtube ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Beau Carnes ]]>
                </dc:creator>
                <pubDate>Thu, 06 Jun 2024 14:48:33 +0000</pubDate>
                <media:content url="https://cdn.hashnode.com/res/hashnode/image/upload/v1717685292411/87c8d3d3-50e3-4561-a807-98f4bbcc170e.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>The Azure DevOps Engineer Expert Certification (AZ-400) is for professionals who aim to demonstrate their expertise in integrating people, processes, and technologies to continuously deliver valuable products and services. It’s ideal for those who are proficient in agile practices and familiar with both Azure administration and development.</p>
<p>We just posted a course on the <a target="_blank" href="http://freeCodeCamp.org">freeCodeCamp.org</a> YouTube channel that will help you pass the Azure DevOps Engineer Expert Certification (AZ-400). This comprehensive course, developed by Andrew Brown from ExamPro, provides in-depth coverage of all the essential skills and knowledge areas required for the AZ-400 certification. This course includes real-world scenarios and practical examples to help you apply what you learn.</p>
<p>Here are the key topics you will learn in this course:</p>
<ul>
<li><p><strong>Develop an Instrumentation Strategy</strong>: Learn how to design and implement logging, telemetry, and monitoring.</p>
</li>
<li><p><strong>Develop a Site Reliability Engineering (SRE) Strategy</strong>: Manage alerting, perform failure analysis, and implement health checks.</p>
</li>
<li><p><strong>Develop a Security and Compliance Plan</strong>: Implement secure DevOps processes and manage security and compliance.</p>
</li>
<li><p><strong>Implement a Continuous Integration (CI) Process</strong>: Master the build strategy, manage code quality, and security policies.</p>
</li>
<li><p><strong>Implement a Continuous Delivery (CD) and Release Management Strategy</strong>: Design a release strategy and set up a release management workflow.</p>
</li>
<li><p><strong>Implement Dependency Management</strong>: Manage code dependencies and artifact repositories.</p>
</li>
<li><p><strong>Implement Application Infrastructure</strong>: Learn to design and implement infrastructure as code and manage Azure Kubernetes Service (AKS) and other Azure services.</p>
</li>
<li><p><strong>Implement Continuous Feedback</strong>: Manage feedback from users and stakeholders effectively.</p>
</li>
</ul>
<p>The AZ-400 exam typically lasts 150 minutes and includes multiple-choice questions, drag-and-drop tasks, case studies, and more. A passing score is generally around 700 out of 1000.</p>
<p>Whether you’re an experienced DevOps professional or just starting, this course is designed to equip you with the skills and knowledge needed to pass the AZ-400 certification and advance your career. Watch the full course on <a target="_blank" href="https://youtu.be/11KT1hPNkY4">the freeCodeCamp.org YouTube channel</a> (8-hour watch).</p>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/11KT1hPNkY4" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Azure AI Fundamentals Certification (AI-900) 2024 UPDATE – Pass the Exam With This Free 4 Hour Course ]]>
                </title>
                <description>
                    <![CDATA[ By Andrew Brown The Azure AI Fundamentals Certification is for those seeking a Machine Learning role such as AI Engineer or Data Scientist. The certification has recently been updated for 2024 and I've released an updated course to teach you how to p... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/azure-data-fundamentals-certification-ai-900-pass-the-exam-with-this-free-4-hour-course/</link>
                <guid isPermaLink="false">66d45d9d37bd2215d1e24584</guid>
                
                    <category>
                        <![CDATA[ Azure ]]>
                    </category>
                
                    <category>
                        <![CDATA[ youtube ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Wed, 21 Feb 2024 15:02:00 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2024/02/azureai.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Andrew Brown</p>
<p>The Azure AI Fundamentals Certification is for those seeking a Machine Learning role such as AI Engineer or Data Scientist.</p>
<p>The certification has recently been updated for 2024 and I've released an updated course to teach you how to pass the exam.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/06/azure-ai-roadmap-1.jpg" alt="Image" width="600" height="400" loading="lazy"></p>
<p>In the last decade companies have been collecting vast amount of data surrounding their service and product offerings.</p>
<p>The successful companies of the 2010s were data-driven companies who knew how to collect, transform, store and analyze their vast amount of data. </p>
<p>The successful companies of the 2020s will be ml-driven who how know how to leverage deep learning and create AI product and service offerings.</p>
<h1 id="heading-overview-of-the-azure-ai-fundamentals"><strong>Overview of the Azure AI Fundamentals</strong></h1>
<p>The Azure AI Fundamentals covers the following:</p>
<ul>
<li>Azure Cognitive Services</li>
<li>AI Concepts</li>
<li>Knowledge Mining</li>
<li>Responsible AI</li>
<li>Basics of ML pipelines and MLOps</li>
<li>Classical ML models</li>
<li>AutoML and Azure ML Studio</li>
</ul>
<h1 id="heading-how-do-you-get-the-azure-ai-fundamentals-certification"><strong>How do you get the Azure</strong> AI <strong>Fundamentals certification?</strong></h1>
<p>You can get the certification by paying the exam fee and sitting for the exam at a test center partnered with Microsoft Azure.</p>
<p>Microsoft Azure is partnered with Pearson Vue and PSI Online who have a network of test centers around the world. They provide both in-person and online exams. If you have the opportunity, I recommend that you take the exam in-person.</p>
<p>Microsoft has <a target="_blank" href="https://home.pearsonvue.com/Clients/Microsoft.aspx">a portal page on Pearsue Vue</a> where you can register and book your exam.</p>
<p>That exam fee is <strong>$99 USD</strong>.</p>
<p><strong>Can I simply watch the videos and pass the exam?</strong></p>
<p>For a fundamental certification like the AI-900 you can pass by just watching the video content without exploring hands-on with the Azure services on your own</p>
<p>Azure has a much higher frequency of updates than other cloud service providers. Sometimes there are new updates every month to a certification however, the AI-900 is not hands-on focused, so study courses are less prone to becoming stale.</p>
<ul>
<li>The exam has <strong>40 to 60</strong> questions with a timeline of <strong>60 minutes</strong>.</li>
<li>The exam contains many different question types.</li>
<li>A passing grade is <strong>around 70%.</strong></li>
</ul>
<h2 id="heading-the-free-azure-ai-fundamentals-video-course"><strong>The Free Azure AI Fundamentals Video Course</strong></h2>
<p>Just like my other cloud certification courses published on freeCodeCamp, this course will remain free forever.</p>
<p>The course contains study strategies, lectures, follow-alongs, and cheatsheets, and it's designed to be a complete end-to-end course.</p>
<p><a target="_blank" href="https://youtu.be/hHjmr_YOqnU">Head on over to freeCodeCamp's YouTube channel</a> to start working through the full 4-hour course.</p>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/hHjmr_YOqnU" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Back Up and Restore Azure SQL Databases ]]>
                </title>
                <description>
                    <![CDATA[ Microsoft's Azure provides many services via a single cloud, which lets them offer one solution for multiple corporate infrastructures. Development teams often use Azure because they value the opportunity to run SQL databases in the cloud and complet... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-back-up-and-restore-sql-azure-database/</link>
                <guid isPermaLink="false">66ba2f06d8f1b6513f67389b</guid>
                
                    <category>
                        <![CDATA[ Azure ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Backup ]]>
                    </category>
                
                    <category>
                        <![CDATA[ database ]]>
                    </category>
                
                    <category>
                        <![CDATA[ SQL ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Alex Tray ]]>
                </dc:creator>
                <pubDate>Wed, 24 Jan 2024 22:34:09 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2023/12/maxresdefault.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Microsoft's Azure provides many services via a single cloud, which lets them offer one solution for multiple corporate infrastructures. Development teams often use Azure because they value the opportunity to run SQL databases in the cloud and complete simple operations via the Azure portal. </p>
<p>But you'll need to have a way to back up your data, as it's crucial to ensuring the functionality of the production site and the stability of everyday workflows. So creating Azure SQL backups can help you and your team avoid data loss emergencies and have the shortest possible downtime while maintaining control over the <a target="_blank" href="https://www.hostpapa.com/blog/technology/what-is-an-it-infrastructure/">infrastructure</a>.</p>
<p>Another reason to have a current Azure database backup is Microsoft’s policy. Microsoft uses the shared responsibility model, which makes the user responsible for data integrity and recovery while Microsoft only ensures the availability of its services. Microsoft directly recommends using third-party solutions to create database backups. </p>
<p>In case you run a local SQL Server, you'll need to prepare for the possibility of hardware failures that may result in data loss and downtime. An SQL database on Azure helps mitigate that risk, although it's still prone to human errors or cloud-specific threats like malware. </p>
<p>These and other threats make enabling Azure SQL database backups necessary for any organization using Microsoft’s service to manage and process data. </p>
<p>In this tutorial, you'll learn about backing up Azure databases and restoring your data on demand with native instruments provided by Microsoft, including methods like: </p>
<ul>
<li>Built-in Azure database backup functionality</li>
<li>Cloud archiving</li>
<li>Secondary database and table management</li>
<li>Linked server</li>
<li>Stretch Database</li>
</ul>
<h2 id="heading-why-backup-your-sql-azure-database">Why Backup Your SQL Azure Database?</h2>
<p>Although I covered this briefly in the intro, there are many reasons to back up your SQL Azure database data. </p>
<h3 id="heading-disaster-recovery">Disaster Recovery</h3>
<p>Data centers can be damaged or destroyed by planned cyberattacks, random malware infiltration (<a target="_blank" href="https://www.nakivo.com/blog/how-to-protect-against-ransomware-attacks/">check out this article</a> to discover more on ransomware protection), and natural disasters like floods or hurricanes, among others. Backups can be used to swiftly recover data and restore operations after various disaster cases.</p>
<h3 id="heading-data-loss-prevention">Data Loss Prevention</h3>
<p>Data corruption, hardware failure, and accidental or malicious deletion lead to data loss and can threaten an organization. Backup workflows set up to run regularly mean you can quickly recover the data that was lost or corrupted.</p>
<h3 id="heading-compliance-and-regulations">Compliance and Regulations</h3>
<p>Compliance requirements and legislative regulations can be severe regardless of your organization’s industry. Mostly, laws require you to keep up with security and perform regular backups for compliance.</p>
<h3 id="heading-testing-and-development">Testing and Development</h3>
<p>You can use backups to create Azure database copies for development, troubleshooting, or testing. Thus, you can fix, develop, or improve your organization’s workflows without involving the production environment.</p>
<h2 id="heading-how-to-back-up-your-azure-sql-database">How to Back Up Your Azure SQL Database</h2>
<p>Backing up your Azure SQL database can be challenging if you go through the process without preparation. So that's why I wrote this guide – to help you be prepared. Here's what we'll cover in the following sections:</p>
<ul>
<li>Requirements for SQL Azure database backup</li>
<li>How to configure database backups in Azure with native tools</li>
<li>Cloud archiving</li>
<li>Backup verification and data restoration</li>
</ul>
<h3 id="heading-sql-azure-database-backup-requirements">SQL Azure Database Backup Requirements</h3>
<p>Before backing up your SQL Azure databases, you need to create and configure Azure storage. Before you do that, you'll need to go through the following steps:</p>
<p>First, open the Azure management portal and find <strong>Create a Resource</strong>.</p>
<p>Then, go to <strong>Storage</strong> &gt; <strong>Storage account</strong>. Provide the information, including the location and names of a storage account and resource group according to your preferences. After you enter the information, hit <strong>Next</strong>.</p>
<p><img src="https://lh7-us.googleusercontent.com/TbuVyIRHXKkKd1__mMSo8RJTktZVnJjK2r8ijtY1h5gvlY5KqkRE8NPsej18m-A1-p3UwF-YO0W0p9AzJa8AW7TwR1yXp531y7qXrm84hJQIuTIKUMwhbnU7WAiUoGRPIdL_SrQCv0nxav4RnCu389o" alt="Image" width="800" height="500" loading="lazy">
<em>Storage account config</em></p>
<p>Then go to the advanced section for additional settings. The optimal choice is to set _"_Secure transfer required" as <strong>Enabled</strong> and "Allow access" from <strong>All</strong> networks. For more resilience in case of human error, you can set "Blob soft delete" as <strong>Enabled</strong>. With that setting, you can quickly correct accidental deletions in the storage account.</p>
<p>After that, specify the tags you need to simplify navigating through your infrastructure.</p>
<p><img src="https://lh7-us.googleusercontent.com/BTXJpa8dz9wKa7p9pQm84fmtqtwD5WEuRB9yh2_Htpa-pF86Zf70CuKP7j32uPR56igplljn6fehCuJEgnMkiCiAcZPZVU_FNEL2JZcrtVjunthzLKQOWp9wbtXLLLKMgYTerYNJpsiQxZjJcMlr05I" alt="Image" width="1000" height="563" loading="lazy">
<em>Azure backup storage tags</em></p>
<p>Check the settings once more. If everything is configured correctly, hit <strong>Create</strong>. Your new storage account is now created.</p>
<p>Once the storage volume is created, it's time to configure a backup data storage container. </p>
<p>Go to the storage account, find <strong>Containers</strong>, then hit the <strong>+ Container</strong> tab there. After that, specify a name for the new container and switch Public access level to <strong>Private (no anonymous access)</strong>.</p>
<p><img src="https://lh7-us.googleusercontent.com/eGTyBc9-uiRO52QsQ0pGzlWPAZlvyMR0miExCMX-Pck9yPQvUlwKqa0_N-zWc908TzHONdzLC2Kv8ACU5UHJjuJ8G6kBOmgxONkLN5LE33ItBsKOx5XdIKtMg8oYDY6eKrdFrZ0bhuOD535QALtqxMU" alt="Image" width="1600" height="955" loading="lazy">
<em>Container Azure storage account</em></p>
<p>You can then use the container as a backup storage (.bak files will be stored there in that case).</p>
<h2 id="heading-azure-database-backup-configuration">Azure Database Backup Configuration</h2>
<p>Now, everything is set up for you to back up your SQL Azure database. Do the following to create a database backup:</p>
<p>First, go to <strong>SQL Management Studio</strong>, and establish a connection with the SQL server. After that, right-click the database that should be backed up. The context menu appears, so go to <strong>Tasks</strong> there. Then hit <strong>Back Up…</strong>. </p>
<p><img src="https://lh7-us.googleusercontent.com/l5g6ajoZ6ZuBObluCiG7mra9pz9BPgP-iOCAoGh36SY5zfg1yv300oQQ1cvgrVFNL75Nu7roFIVp2BfPze3ag5nTzL1NQYiO_fhUokWSd9fVms1SDcoP5pJ7a4wWdB3fQJWeKbrNIK_-vo2-hiXTDl0" alt="Image" width="1348" height="720" loading="lazy">
<em>SQL server tasks backup</em></p>
<p>Then find the Destination tab, and set <strong>Back up to line to URL</strong> there. After that, hit <strong>New container</strong>.</p>
<p>Next, sign in to Azure. Pick the container you created before. Provide your credentials, then hit <strong>OK</strong>.</p>
<p>You’ll see a message asking you to sign in to Azure subscription. Then, choose the container and hit <strong>OK</strong>.</p>
<p>Now, you'll see the configured backup destination URL listed. To start the workflow to back up your Azure data, hit <strong>OK</strong> once again.</p>
<p>When your SQL Azure database backup is completed, the message shows up: "<em>The backup of database ‘your database name’ completed successfully</em>."</p>
<p>The backup file in the target container should now be visible from the Azure portal.</p>
<p>Keep in mind that, when uploading backups to any cloud storage, you may face issues if your network connection is not fast enough. </p>
<p>In case that’s true for you, you can reorganize your backup workflows: send backup data to a physical storage drive first, and then send another copy to the cloud. Thus, you can prevent operational challenges that might appear due to network bandwidth deficiency.</p>
<h2 id="heading-cloud-archiving-for-azure-database-backups">Cloud Archiving for Azure Database Backups</h2>
<p>Databases tend to grow in volume as the organization grows. This means that the storage space required to fit the data and that data's backup increases significantly. Also, the original data volume prolongs the duration of full backup workflows, posing another challenge. </p>
<p>Of course, the first way to get more storage space is to revise your data regularly and erase records that are irrelevant, outdated, or unnecessary otherwise. Still, it's sometimes difficult to determine if data will be or become unnecessary or irrelevant, especially when dealing with issues of compliance. </p>
<p>To keep your organization compliant in any case, data archiving can help you solve two problems at once: you can ensure data accessibility on one hand, and save storage space on the other hand.</p>
<p>To archive your SQL database in the cloud, you should first save that database copy to an Azure blob container. Then, to move a newly created blob to the archive tier in the Azure portal, do the following: </p>
<ol>
<li>Go to the required container where the SQL database is stored.</li>
<li>Choose the blob that you need to move.</li>
<li>Hit <strong>Change tier</strong>.</li>
</ol>
<p><img src="https://lh7-us.googleusercontent.com/p41GC9ys42mQBQGWW1jqcR2xCfACpCYF1MpGG7Qx6EdqzjDSK6xnuqlPRCtDuhEmH_-8E6Lz2gY8H3h1CoZ4_jpScQWUxB-21GXOnuDEBSHVJiGa1zBiHu4JJP2Xntq1fpbPLjbb1-APOTJMO2sdBMk" alt="Image" width="1281" height="629" loading="lazy">
<em>Azure blob container change tier</em></p>
<ol start="4">
<li>In the <strong>Access tier</strong> dropdown menu, choose <strong>Archive</strong>.</li>
</ol>
<p><img src="https://lh7-us.googleusercontent.com/qlyKGop3uj6kfi71fSpVsqKkhf8vc1TiQRyoeHEiwjKdg1i3Dsz_LXLHcD5q-qR77utIPUbkLyWU7Xzn7ehl3Z1IWUQZjy0LndXLEcDA1PRZj4ufO8QGR0GCmEDGqoWQ6paFwo8pn0VbUH8RWjlRzLU" alt="Image" width="432" height="283" loading="lazy">
<em>Azure blob change tier</em></p>
<ol start="5">
<li>Hit <strong>Save</strong>.</li>
</ol>
<p>Additionally, the Archive storage tier is the most affordable one in Azure, meaning that you can reduce your database data TCO with it.</p>
<h3 id="heading-secondary-database-and-table-management">Secondary Database and Table Management</h3>
<p>There exist several workflows that can help you set up Azure database backup archiving for your organization. When you need the data to stay in the initial database, for instance, creating a separate table and moving that data there can be your choice. However, the filegroup of that table should stay apart from the main database and be moved to a separate disk whenever possible. </p>
<p>Most probably, you’ll want to let users access the data you send to a separate table. To make that happen, you can create a view merging the relevant tables and redirect the requests to that view, not to the original table. Doing things that way, you can keep the data accessible while dealing with maintenance faster.</p>
<h3 id="heading-sql-server-linking">SQL Server Linking</h3>
<p>If you can’t move the data to another database for internal reasons such as special Azure backup policies, you can consider maintaining your primary database accordingly. </p>
<p>Here, the outcome is likely to be that of the previous case, but you need to link the SQL servers or configure apps so they can send direct requests to your second server. </p>
<p>The downside here is that your SQL database, which was supposed to be a backup one, becomes a production database and gains appropriate importance for an organization.</p>
<p>There are two ways to create linked servers via SQL Server Management Studio (SSMS): </p>
<ul>
<li><strong>sp_addlinkedserver</strong> (Transact-SQL) system stored procedure that creates a linked server</li>
<li><strong>SSMS GUI</strong></li>
</ul>
<p>After you've ensured that you have appropriate access rights on both server instances you need to link, the network is configured appropriately to access them, and SSMS is installed, you'll need to go through the following steps:</p>
<p>First, open SSMS.</p>
<p><img src="https://lh7-us.googleusercontent.com/6NS8wE2UmtV5Bs3-loE7kIASfehk4-hSaPP5y7Wm1oEVIUFDCPyxD_f1rLQzxsJVdCGaFJwcRHqKVrnypgETOSohLP5hQK50m4tj4pBZBIx6oTUj8WOJbcttfhy0IybUyC_CrJCyK8saEPnchKInp7g" alt="Image" width="1499" height="1087" loading="lazy">
<em>Microsoft SSMS</em></p>
<p>Connect to the instance where you need to establish a linked server. Then find <strong>Object Explorer &gt; Server Objects</strong>, then right-click <strong>Linked Servers</strong>.</p>
<p>Pick <strong>New Linked Server</strong> from the dropdown:</p>
<p><img src="https://lh7-us.googleusercontent.com/tD5YO2e1RtfLUmtBdRFNfiHQSyaxnQml9lBGnRPPzuNrW4Fcu-3alTg4N3-mdR-oQxcaUyMpyqp36l7r3aTfg29RzT6Jgx0Nb1eT2T-y-zotl1RujRUIC4gSwE25aslpfMJJUvNW4MMivP4BstyQu4o" alt="Image" width="400" height="340" loading="lazy">
<em>New linked server SSMS</em></p>
<p>Then configure the server properties, including name, server type, provider and product name:</p>
<p><img src="https://lh7-us.googleusercontent.com/y-WSzJni8uyKBAcJywPqk-iufIeJ_4TTs1rf3e_9RYhj1Kt8nUsZfad9Vekec4yL6eFCX8doLR4Qr7iA6X3p78jnRfIs3AYlHMn1GOhR8Ya29CW5X9DIU-nbj_jDaTwAvwEJXNjr7npd5THmnD7Iv3A" alt="Image" width="400" height="378" loading="lazy">
<em>Linked server configuration SSMS</em></p>
<p>Then you'll just need to complete the security configuration, set up the server options, and complete connection testing.</p>
<h3 id="heading-original-data-deletion">Original Data Deletion</h3>
<p>When you don’t need 24/7 data availability but need the data stored due to internal policies or compliance requirements, you can choose what's probably the simplest solution to increase storage space efficiency. Just back up the data that can stay unavailable and then delete the originals from the main database. Accessing any records you may need will still be possible via the backup.</p>
<h3 id="heading-stretch-database">Stretch Database</h3>
<p>Aiming to make data management of organizations’ databases simpler, Microsoft implemented a Stretch Database feature in SQL Server 2016. With this feature, you can get an SQL backup to Azure after you send the data from the hosted database to an Azure SQL database. The method enables you to increase overall infrastructure cost-efficiency by simplifying backup workflows.</p>
<p>To enable this workflow in your environment, develop the policy specifying the data on a hosted server to send to Azure. You don’t need to introduce any changes in applications that use the production database: SQL Server can independently get the records from the Azure SQL Database.</p>
<h3 id="heading-azure-database-backups-verification-and-restoration">Azure Database Backups Verification and Restoration</h3>
<p>During an SQL Azure database backup, you can choose to create such backups <strong>WITH CHECKSUMS</strong> or without them. When the workflow is complete, I recommend you use the following command: <strong><code>RESTORE VERIFYONLY</code></strong>. This command enables you to check the recoverability of backup files.  </p>
<p>To access the data, you can restore records from a backup to a different database. With Azure Automation scripts on backups, you can accelerate the restoration process, thus minimizing downtime and increasing the overall resilience of your Azure infrastructure. </p>
<p>You need to follow only a few steps to restore an Azure SQL database to a required recovery point from a backup. Still, keep in mind that your subscription can define the available retention period which can vary from 7 to 35 days. A native tool for backup restoration to SQL servers is Server Management Studio.</p>
<h2 id="heading-to-conclude">To Conclude</h2>
<p>The critical nature of Azure SQL database data makes Azure SQL backups obligatory for any organization that uses this Microsoft solution. In this guide, we reviewed the process of creating SQL Azure database backup using native Microsoft tools. </p>
<p>These tools provide data backup, backup verification, and recovery functionality along with some automation. </p>
<p>You can also implement a specialized all-in-one data protection solution, such as <a target="_blank" href="https://www.nakivo.com/backup-to-azure-blob/">NAKIVO</a>, the company where I work. It can help you make your data backup workflows more efficient.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Azure Fundamentals Certification (AZ-900) – Pass the Exam With This Free 8-Hour Course ]]>
                </title>
                <description>
                    <![CDATA[ The Microsoft Azure Fundamentals Certification is for technology professionals who want to demonstrate foundational knowledge of cloud concepts in general and Microsoft Azure in particular. This exam is a common starting point in a journey towards a ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/azure-fundamentals-certification-az-900-exam-course/</link>
                <guid isPermaLink="false">66b200aba2135cc2539a2120</guid>
                
                    <category>
                        <![CDATA[ Azure ]]>
                    </category>
                
                    <category>
                        <![CDATA[ youtube ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Beau Carnes ]]>
                </dc:creator>
                <pubDate>Thu, 14 Dec 2023 17:53:14 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2023/12/azurefund.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>The Microsoft Azure Fundamentals Certification is for technology professionals who want to demonstrate foundational knowledge of cloud concepts in general and Microsoft Azure in particular. This exam is a common starting point in a journey towards a career in Azure.</p>
<p>We just posted a full exam-prep course on the freeCodeCamp.org YouTube channel for the AZ-900 exam. Andrew Brown from ExamPro developed this course.</p>
<p>Microsoft Azure is a cloud service provider. A cloud service provider (CSPs) is a technology company that offers multiple cloud services. Azure has listed over 600 cloud service offerings, from computing to storage to databases to machine learning.</p>
<p>Azure is the second most popular cloud platform behind Amazon Web Services (AWS). Still, many long-lived or large tech companies are embracing both cloud platforms. This may be because Azure is able to compete on cost, niche cloud-offerings, easy integration, and developers' familiarity with Microsoft software.</p>
<h3 id="heading-the-azure-foundations-certification">The Azure Foundations Certification</h3>
<p>The Azure Foundations certification is the entry-level cloud certification for Microsoft Azure. It is commonly referred to by its course code, the AZ-900.</p>
<p>The exam covers the following domains:</p>
<ul>
<li>Cloud Concepts</li>
<li>Azure Core Services</li>
<li>Security, Privacy, Compliance and Trust</li>
<li>Pricing and Support</li>
</ul>
<p>The average study time – even for people who are new to cloud development – is only one week of study.</p>
<p>There is also some knowledge transfer if you have already earned the AWS Cloud Certified Practitioner (AWS's entry-level certification). But don't expect to pass the AZ-900 without studying.</p>
<p>Microsoft and Azure previously had Certifications that were service specific, but they have changed to role based Certifications (certifications based on job title). </p>
<h2 id="heading-how-do-you-get-the-certification">How do you get the certification?</h2>
<p>You obtain certification by paying the exam fee, and sitting the exam at a test center partnered with Microsoft Azure.</p>
<p>Microsoft Azure is partnered with Pearson Vue, a network of test centers around the world. Pearson Vue allows you to sit the exam in person or online. To sit the exam online, you need to ensure you have a quiet, clutter-free room and a working web-camera.</p>
<p>Microsoft has <a target="_blank" href="https://home.pearsonvue.com/Clients/Microsoft.aspx">a portal page on Pearsue Vue</a> where you register and book your exam.</p>
<h2 id="heading-can-i-simply-watch-the-course-and-pass-the-exam">Can I simply watch the course and pass the exam?</h2>
<p>For the entry-level certification, yes, it is possible to pass by just watching videos if you already have a technical background.</p>
<p>For more difficult certification levels starting at the Associate level, it is necessary to use paid practice exams by third-party providers.</p>
<p>The exam has <strong>40 to 60</strong> questions with a timeline of <strong>1 hour</strong>.</p>
<p>A passing grade is <strong>around 70%.</strong></p>
<p>Watch the full course on the <a target="_blank" href="https://www.youtube.com/watch?v=5abffC-K40c">freeCodeCamp.org YouTube channel</a> (8-hour watch).</p>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/5abffC-K40c" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Become an Azure Solutions Architect Expert – Pass the AZ-305 Exam ]]>
                </title>
                <description>
                    <![CDATA[ Are you ready to elevate your expertise in designing cloud and hybrid solutions on Azure? The Azure Solutions Architect Expert Certification exam measures your ability to accomplish the following technical tasks: design identity, governance, and moni... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/become-an-azure-solutions-architect-expert-pass-the-az-305-exam/</link>
                <guid isPermaLink="false">66b200bda8b92c9329236408</guid>
                
                    <category>
                        <![CDATA[ Azure ]]>
                    </category>
                
                    <category>
                        <![CDATA[ youtube ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Beau Carnes ]]>
                </dc:creator>
                <pubDate>Fri, 10 Nov 2023 16:03:07 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2023/11/azurearc.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Are you ready to elevate your expertise in designing cloud and hybrid solutions on Azure?</p>
<p>The Azure Solutions Architect Expert Certification exam measures your ability to accomplish the following technical tasks: design identity, governance, and monitoring solutions; design data storage solutions; design business continuity solutions; and design infrastructure solutions.</p>
<p>We just published a 10-hour course on the freeCodeCamp.org YouTube channel that will prepare you to pass this certification exam.  This course is your key to mastering the essentials of Microsoft Azure.</p>
<p>Andrew Brown of ExamPro created this course. He has created a ton of popular exam prep courses that have helped thousands of people get industry certification.</p>
<p>This course is not just a series of lectures; it's a journey through the vast landscape of Azure architecture. The course covers all the topics you need to learn to pass the AZ-305 exam. Here are the topics in the course:</p>
<p><strong>☁️ Introduction:</strong> Begin your journey with a detailed breakdown of the exam guide, offering insights into what to expect and how to navigate through the course effectively. Explore the Sandbox feature, an essential tool for practical learning.</p>
<p><strong>☁️ Identity Solutions:</strong> Delve into the world of Microsoft Entra ID, understanding its recent name change, applications, and compare AD vs. AAD. This section thoroughly covers Tenant, Users, Groups, and aspects of Access Rights, along with Single Sign-On and Conditional Access.</p>
<p><strong>☁️ Role-based Access Control:</strong> Discover the various Azure roles and their functionalities. Learn about Access Controls, Classic Administrators, Azure RBAC, and the nuances of Azure Policies vs. Azure Roles RBAC.</p>
<p><strong>☁️ Azure Policies:</strong> A dedicated section to understand Azure Policy Scope and the anatomy of Azure Policy Definition Files, alongside configuring these policies for optimal cloud governance.</p>
<p><strong>☁️ Azure Resource Manager &amp; ARM Templates:</strong> These sections are vital for understanding resource management and deployment in Azure. Learn about Azure Management Groups, Subscriptions, Resource Tags, and more. ARM Templates will guide you through resource, parameter, and function management in Azure.</p>
<p><strong>☁️ Monitoring Solutions:</strong> Gain expertise in Azure Monitor, its data stores, logs, and analytics. This module includes detailed lessons on Azure Sentinel and Application Insights.</p>
<p><strong>☁️ Identity Management Best Practices:</strong> A crucial part of the course focusing on principles like the least privilege and Privileged Identity Management, ensuring a strong foundation in identity security.</p>
<p><strong>☁️ Azure Key Vault &amp; Integration with On-premises Solutions:</strong> Understand the mechanics and pricing of Azure Key Vault and learn about integrating Azure solutions with on-premise infrastructures.</p>
<p><strong>☁️ Comprehensive Coverage on Azure Services:</strong> The course extends into detailed explorations of Azure SQL Database, Azure Synapse Analytics, Azure Data Factory, Azure Databricks, Azure Data Lake, Cosmos DB, and Azure Cache for Redis. Each of these sections is meticulously designed to provide you with a deep understanding of Azure's data services.</p>
<p><strong>☁️ Specialized Azure Modules:</strong> Learn about Azure's specialized services like Azure Virtual Machines, Azure App Service, Azure Container Instances, Azure Functions, and Azure Front Door, along with Azure CDN and Azure Service Bus. These modules offer a deep dive into specific Azure services, enhancing your architectural skills.</p>
<p><strong>☁️ Migration and Connectivity Solutions:</strong> Equip yourself with knowledge on Azure Cloud Adoption Framework, Azure Migrate, and connectivity solutions like VNets and Subnets.</p>
<p><strong>☁️ Network Security and Load Balancing:</strong> Understand how to optimize network security through Azure Firewall and Network Security Groups, and master load balancing and routing solutions.</p>
<p>Whether you're aiming to pass the AZ 305 certification or seeking to enhance your Azure expertise, this course is your comprehensive guide to success.</p>
<p>Watch the full course on <a target="_blank" href="https://youtu.be/i6NzKvGUsBs">the freeCodeCamp.org YouTube channel</a> (10-hour watch).</p>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/i6NzKvGUsBs" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Use Azure Kubernetes Service for Container Orchestration ]]>
                </title>
                <description>
                    <![CDATA[ Containerization has transformed the way applications are built, deployed, and scaled. Containers provide a lightweight, portable, and uniform environment for developers to bundle their programs as well as their dependencies into a single unit.  But ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-use-azure-kubernetes-service-for-container-orchestration/</link>
                <guid isPermaLink="false">66ba611ce5ad5bacb410af26</guid>
                
                    <category>
                        <![CDATA[ Azure ]]>
                    </category>
                
                    <category>
                        <![CDATA[ containers ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Kubernetes ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ valentine Gatwiri ]]>
                </dc:creator>
                <pubDate>Wed, 06 Sep 2023 13:56:05 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2023/09/Screenshot-from-2023-09-04-11-21-32.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Containerization has transformed the way applications are built, deployed, and scaled. Containers provide a lightweight, portable, and uniform environment for developers to bundle their programs as well as their dependencies into a single unit. </p>
<p>But when a system's container count rises, controlling and coordinating them becomes more difficult. Fortunately, Kubernetes is a powerful container orchestration solution.</p>
<p>This tutorial teaches you how to leverage Azure Kubernetes Service (AKS) for container orchestration in the Azure cloud environment.</p>
<h2 id="heading-key-terminologies"><strong>Key Terminologies</strong></h2>
<p>Before diving into the guide, let's define some essential terminologies:</p>
<ol>
<li>Containerization: The process of packaging your application code with all the files and libraries together into a single container to ensure consistency and portability across different environments.</li>
<li>Kubernetes: An open-source container orchestration platform that automates the deployment, scaling, and management of containerized applications.</li>
<li>Azure Kubernetes Service (AKS): A managed Kubernetes service provided by Microsoft Azure that simplifies the deployment and management of Kubernetes clusters in the Azure cloud environment.</li>
<li>Pod: The smallest deployable unit in Kubernetes, representing one or more containers running together on a node.</li>
<li>Deployment: A Kubernetes resource that defines how many replicas of a Pod should be running and the template for creating them.</li>
<li>Node: A virtual or physical machine in a Kubernetes cluster on which containers are deployed.</li>
<li>kubectl: The command-line tool used to interact with Kubernetes clusters.</li>
</ol>
<h2 id="heading-how-to-use-azure-kubernetes-service-aks">How to Use Azure Kubernetes Service (AKS)</h2>
<h3 id="heading-create-an-azure-resource-group"><strong>Create an Azure Resource Group</strong></h3>
<p>Let’s start by logging into the <a target="_blank" href="https://portal.azure.com/">Azure portal,</a> then clicking on "Create a resource" and searching for "Resource group.". Click on "Resource group" and then "Create."</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/09/Screenshot-from-2023-09-04-10-31-03.png" alt="Image" width="600" height="400" loading="lazy">
<em>Resource group</em></p>
<p>After that, let’s fill in the required information, such as the resource group name and region then click "Review + create" and then "Create" to create the resource group.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/09/Screenshot-from-2023-09-04-10-32-03.png" alt="Image" width="600" height="400" loading="lazy">
<em>Popup for the created resource group</em></p>
<h3 id="heading-create-an-aks-cluster"><strong>Create an AKS Cluster</strong></h3>
<p>In the Azure portal, click on "Create" and search for "Azure Kubernetes Service."Let’s now click on "Azure Kubernetes Service" and then  "Create."</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/09/Screenshot-from-2023-09-04-10-33-37.png" alt="Image" width="600" height="400" loading="lazy">
<em>Creating an AKS</em></p>
<p>Fill in the required information, such as the AKS cluster name, resource group (use the one created in Step 1), and region.</p>
<h3 id="heading-cluster-details"><strong>Cluster Details</strong></h3>
<p>First, let’s choose our plan and the resource that we created earlier:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/09/Screenshot-from-2023-09-04-10-34-41.png" alt="Image" width="600" height="400" loading="lazy">
<em>Plan and resource group</em></p>
<p>Ensure that the Preset configuration is Standard ($$). For more details on preset configurations, see the cluster configuration preset in the Azure portal. Enter a Kubernetes cluster name, such as <code>AKScluster</code>.</p>
<p>Select a Region for the AKS cluster, and leave the default value selected for the Kubernetes version.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/09/awww.png" alt="Image" width="600" height="400" loading="lazy">
<em>Cluster details</em></p>
<p>Leave the default values as they are in the "primary node pool":</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/09/Screenshot-from-2023-09-04-10-38-29.png" alt="Image" width="600" height="400" loading="lazy">
<em>Primary node pool</em></p>
<p>In the next parts, leave the default options and then select Next: Review + create:</p>
<p>When we go to the <code>Review + Create</code> tab, Azure validates the parameters we've selected. If the validation is successful, we may establish the AKS cluster by clicking <code>create</code>. If validation fails, it informs which parameters must be changed.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/09/a20-15-18-22-1.png" alt="Image" width="600" height="400" loading="lazy">
<em>Validation passed demo</em></p>
<p>The AKS cluster is created in a matter of minutes. When our deployment is finished, we may access our resource by either choosing Go to resource, or Selecting the AKS resource from the AKS cluster resource group.</p>
<h3 id="heading-configure-kubectl">Configure kubectl</h3>
<p>After the AKS cluster is successfully created, we should click on "Go to resource."</p>
<p>In the AKS cluster overview page, click on "Connect" and then "Open in Cloud Shell."</p>
<p>The Azure Cloud Shell will open at the bottom of the portal. If prompted, choose "Bash" as the shell type. Then "Create storage".</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/09/a5-31-19.png" alt="Image" width="600" height="400" loading="lazy">
<em>Azure Cloud Shell</em></p>
<p>Run the following command in the Cloud Shell to configure kubectl to connect to our AKS cluster:</p>
<pre><code class="lang-bash">az aks get-credentials --resource-group &lt;your_resource_group_name&gt; --name &lt;your_aks_cluster_name&gt;
</code></pre>
<p>In our case, our resource group name is <code>Tutorial</code> and AKS our cluster is <code>AKScluster</code>:</p>
<pre><code class="lang-bash">az aks get-credentials --resource-group Tutorial --name AKScluster
</code></pre>
<p>This will output the following:</p>
<pre><code>Merged <span class="hljs-string">"AKScluster"</span> <span class="hljs-keyword">as</span> current context <span class="hljs-keyword">in</span> /home/valentine/.kube/config
</code></pre><p>To verify the connection to our cluster, use <code>kubectl get</code> to return a list of the cluster nodes as shown below:</p>
<pre><code>NAME                               STATUS    ROLES   AGE   VERSION
aks-agentpool<span class="hljs-number">-22140002</span>-vmss000000   Ready    agent   <span class="hljs-number">16</span>m   v1<span class="hljs-number">.25</span><span class="hljs-number">.6</span>
</code></pre><h3 id="heading-deploy-and-manage-the-application"><strong>Deploy and Manage the Application</strong></h3>
<p>Now that kubectl is configured to connect to our AKS cluster, we can deploy and manage applications on it.</p>
<p>Create a Kubernetes deployment manifest file in the Cloud Shell. To do so let’s open the nano text editor and create the "nginx-deployment.yaml" file. Use the following command to do that:</p>
<pre><code>nano nginx-deployment.yaml
</code></pre><p>The nano editor will open, and we can start typing the content of the deployment manifest. For deploying a simple NGINX web server, use the following YAML content:</p>
<pre><code class="lang-yaml"><span class="hljs-attr">apiVersion:</span> <span class="hljs-string">apps/v1</span>
<span class="hljs-attr">kind:</span> <span class="hljs-string">Deployment</span>
<span class="hljs-attr">metadata:</span>
  <span class="hljs-attr">name:</span> <span class="hljs-string">nginx-deployment</span>
<span class="hljs-attr">spec:</span>
  <span class="hljs-attr">replicas:</span> <span class="hljs-number">3</span>
  <span class="hljs-attr">selector:</span>
    <span class="hljs-attr">matchLabels:</span>
      <span class="hljs-attr">app:</span> <span class="hljs-string">nginx</span>
  <span class="hljs-attr">template:</span>
    <span class="hljs-attr">metadata:</span>
      <span class="hljs-attr">labels:</span>
        <span class="hljs-attr">app:</span> <span class="hljs-string">nginx</span>
    <span class="hljs-attr">spec:</span>
      <span class="hljs-attr">containers:</span>
        <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">nginx</span>
          <span class="hljs-attr">image:</span> <span class="hljs-string">nginx:latest</span>
          <span class="hljs-attr">ports:</span>
            <span class="hljs-bullet">-</span> <span class="hljs-attr">containerPort:</span> <span class="hljs-number">80</span>
</code></pre>
<p>After copying and pasting our code above, we will press <code>Ctrl + X</code> to exit <code>nano</code>. This will prompt us to save the changes. Let’s press <code>Y</code> to confirm, and when asked to save the file, press Enter to save the file with the default name (nginx-deployment.yaml).</p>
<p>Now we have created the <code>nginx-deployment.yaml</code> file, which contains the YAML specification for deploying a simple NGINX web server with three replicas.</p>
<p>Let’s deploy the NGINX application to our AKS cluster using the following command:</p>
<pre><code>kubectl apply -f nginx-deployment.yaml
</code></pre><p>This will be the output:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/09/Screenshot-from-2023-09-04-10-56-05-1.png" alt="Image" width="600" height="400" loading="lazy">
<em>Output showing our application as been deployed</em></p>
<h3 id="heading-scale-the-application">Scale the Application</h3>
<p>We can easily scale our deployed application based on demand.</p>
<p>To scale the NGINX deployment to five replicas, let’s use the following command:</p>
<pre><code>kubectl scale deployment nginx-deployment --replicas=<span class="hljs-number">5</span>
</code></pre><h3 id="heading-test-the-application">Test the application</h3>
<p>Let’s now check the status of our deployment by using the following command:</p>
<pre><code>kubectl get deployment nginx-deployment --watch
</code></pre><p>The above command will show the status of the deployment, including the number of desired replicas, the number of available replicas, and the current state of the deployment as shown below:</p>
<pre><code>NAME                     READY   UP-TO-DATE   AVAILABLE   AGE
nginx-deployment          <span class="hljs-number">3</span>/<span class="hljs-number">3</span>     <span class="hljs-number">3</span>            <span class="hljs-number">3</span>           <span class="hljs-number">13</span>m
</code></pre><h3 id="heading-deployment-as-a-service">Deployment as a service</h3>
<p>To expose the deployment as a service and access it externally, we'll need to create a Kubernetes service manifest and apply it using <code>kubectl apply -f service-manifest.yaml</code>.</p>
<p>For example, we can create a service manifest file named <code>nginx-service.yaml</code> and add the following content:</p>
<pre><code class="lang-yaml"><span class="hljs-attr">apiVersion:</span> <span class="hljs-string">v1</span>
<span class="hljs-attr">kind:</span> <span class="hljs-string">Service</span>
<span class="hljs-attr">metadata:</span>
  <span class="hljs-attr">name:</span> <span class="hljs-string">nginx-service</span>
<span class="hljs-attr">spec:</span>
  <span class="hljs-attr">selector:</span>
    <span class="hljs-attr">app:</span> <span class="hljs-string">nginx</span>
  <span class="hljs-attr">ports:</span>
    <span class="hljs-bullet">-</span> <span class="hljs-attr">protocol:</span> <span class="hljs-string">TCP</span>
      <span class="hljs-attr">port:</span> <span class="hljs-number">80</span>
      <span class="hljs-attr">targetPort:</span> <span class="hljs-number">80</span>
  <span class="hljs-attr">type:</span> <span class="hljs-string">LoadBalancer</span>
</code></pre>
<p>Let’s save the file, and then apply it using the following command:</p>
<pre><code>kubectl apply -f nginx-service.yaml
</code></pre><p>This will create a Kubernetes service named <code>nginx-service</code>that maps to the pods deployed by the <code>nginx-deployment</code> based on the <code>app: nginx</code> label selector. The service will be accessible externally through a <code>LoadBalancer</code>, and we can check its status using:</p>
<pre><code>kubectl get service nginx-service --watch
</code></pre><p>We should be able to access our NGINX web server using the provided IP address.</p>
<pre><code>NAME           TYPE       CLUSTER-IP    EXTERNAL-IP    PORT(S)        AGE
nginx-service LoadBalancer <span class="hljs-number">10.0</span><span class="hljs-number">.61</span><span class="hljs-number">.228</span>   <span class="hljs-number">20.87</span><span class="hljs-number">.237</span><span class="hljs-number">.92</span>   <span class="hljs-number">80</span>:<span class="hljs-number">32415</span>/TCP   <span class="hljs-number">93</span>s
</code></pre><p>Let’s visit the external IP:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/09/Screenshot-from-2023-09-04-11-08-27.png" alt="Image" width="600" height="400" loading="lazy">
<em>Output</em></p>
<p>Congratulations! We have successfully deployed a web application to our AKS cluster, exposed it to the internet, and managed its scaling effortlessly using Azure Kubernetes Service.</p>
<h3 id="heading-monitor-the-cluster">Monitor the Cluster</h3>
<p>AKS integrates seamlessly with Azure Monitor, allowing us to monitor the performance and health of our Kubernetes cluster and applications.</p>
<p>In the Azure portal, navigate to your AKS cluster and click on "Monitoring." There, you can explore the various monitoring options, such as cluster health, performance, and diagnostics.</p>
<h2 id="heading-conclusion"><strong>Conclusion</strong></h2>
<p>In this tutorial, we took advantage of Azure's free trial to learn the ins and outs of AKS. We also used the Azure site to establish our own AKS cluster, with the opportunity to adjust parameters as needed. Cloud Shell was also utilized without installing anything on the PC. </p>
<p>You can check out my personal blog <a target="_blank" href="https://gatwirival.hashnode.dev/">here</a>. Happy learning.</p>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
