<?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-devops - 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-devops - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Wed, 24 Jun 2026 10:05:58 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/tag/azure-devops/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ Cloud-Native Development with Azure DevOps CI/CD Pipelines in Enterprise .NET Applications ]]>
                </title>
                <description>
                    <![CDATA[ Cloud-native development enables enterprise .NET applications to scale and remain resilient in the cloud. Using Azure DevOps CI/CD pipelines, you can automate building, testing, and deploying applicat ]]>
                </description>
                <link>https://www.freecodecamp.org/news/cloud-native-development-with-azure-devops-ci-cd-pipelines-in-enterprise-net-applications/</link>
                <guid isPermaLink="false">69c6a9e49aa3928a58bfd382</guid>
                
                    <category>
                        <![CDATA[ azure-devops ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Azure Pipelines ]]>
                    </category>
                
                    <category>
                        <![CDATA[ CI/CD pipelines ]]>
                    </category>
                
                    <category>
                        <![CDATA[ dotnet ]]>
                    </category>
                
                    <category>
                        <![CDATA[ kubernetes-services ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Containerizing .NET Applications ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Observability and Monitoring ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Gopinath Karunanithi ]]>
                </dc:creator>
                <pubDate>Fri, 27 Mar 2026 16:00:00 +0000</pubDate>
                <media:content url="https://cdn.hashnode.com/uploads/covers/5e1e335a7a1d3fcc59028c64/eada90ad-0d90-4287-acee-2e544980ed4a.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Cloud-native development enables enterprise .NET applications to scale and remain resilient in the cloud. Using Azure DevOps CI/CD pipelines, you can automate building, testing, and deploying applications, package them as Docker containers, and orchestrate deployments on platforms like Azure Kubernetes Service (AKS).</p>
<p>This approach ensures consistent, reliable releases across multiple environments while supporting best practices like infrastructure as code, security scanning, and observability. It can help your organization deliver cloud-ready .NET software efficiently and safely.</p>
<p>In this article, you'll learn how to implement cloud-native CI/CD pipelines for enterprise .NET applications using Azure DevOps, Docker, and Kubernetes.</p>
<h2 id="heading-table-of-contents">Table of Contents</h2>
<ul>
<li><p><a href="#heading-prerequisites">Prerequisites</a></p>
</li>
<li><p><a href="#heading-overview">Overview</a></p>
</li>
<li><p><a href="#heading-principles-of-cloud-native-net-development">Principles of Cloud-Native .NET Development</a></p>
</li>
<li><p><a href="#heading-understanding-azure-devops-cicd-pipelines">Understanding Azure DevOps CI/CD Pipelines</a></p>
</li>
<li><p><a href="#heading-creating-an-azure-devops-pipeline-for-a-net-application">Creating an Azure DevOps Pipeline for a .NET Application</a></p>
</li>
<li><p><a href="#heading-containerizing-net-applications">Containerizing .NET Applications</a></p>
</li>
<li><p><a href="#heading-building-and-publishing-docker-images-in-azure-devops">Building and Publishing Docker Images in Azure DevOps</a></p>
</li>
<li><p><a href="#heading-deploying-to-azure-kubernetes-service-aks">Deploying to Azure Kubernetes Service (AKS)</a></p>
</li>
<li><p><a href="#heading-managing-environments-with-deployment-stages">Managing Environments with Deployment Stages</a></p>
</li>
<li><p><a href="#heading-infrastructure-as-code-with-azure-devops">Infrastructure as Code with Azure DevOps</a></p>
</li>
<li><p><a href="#heading-implementing-security-in-cicd-pipelines">Implementing Security in CI/CD Pipelines</a></p>
</li>
<li><p><a href="#heading-observability-and-monitoring">Observability and Monitoring</a></p>
</li>
<li><p><a href="#heading-best-practices-for-enterprise-cicd-pipelines">Best Practices for Enterprise CI/CD Pipelines</a></p>
</li>
<li><p><a href="#heading-conclusion">Conclusion</a></p>
</li>
</ul>
<h2 id="heading-prerequisites">Prerequisites</h2>
<p>Before moving into cloud-native development with Azure DevOps CI/CD pipelines, it’s helpful to have a basic understanding of the following concepts:</p>
<ul>
<li><p>Familiarity with building applications using <a href="http://ASP.NET">ASP.NET</a> Core or .NET (for example, controllers, APIs, project structure).</p>
</li>
<li><p>Understanding how to clone repositories, create branches, and push code changes.</p>
</li>
<li><p>Ability to run commands such as dotnet build, docker build, and kubectl.</p>
</li>
<li><p>Understanding what Continuous Integration and Continuous Deployment mean and why they're important.</p>
</li>
<li><p>Basic idea of how containerization works and how Docker packages applications.</p>
</li>
<li><p>Familiarity with Microsoft Azure or similar cloud providers.</p>
</li>
</ul>
<p>To work through the examples, you should also have the following tools:</p>
<ul>
<li><p>.NET SDK (version 6 or later recommended)</p>
</li>
<li><p>Docker installed locally</p>
</li>
<li><p>Azure DevOps account</p>
</li>
<li><p>Azure CLI (optional but useful)</p>
</li>
<li><p>A code editor like VS Code or Visual Studio</p>
</li>
</ul>
<h2 id="heading-overview">Overview</h2>
<p>Modern enterprise applications must be built to scale, adapt, and deploy quickly. Traditional monolithic deployment strategies (where applications are manually built, tested, and deployed) are no longer sufficient for teams delivering software in fast-paced environments. Organizations now expect rapid feature delivery, automated testing, and resilient infrastructure.</p>
<p>Cloud-native development addresses these challenges by embracing automation, microservices architectures, containerization, and continuous delivery. For .NET teams building enterprise applications, combining cloud-native principles with Azure DevOps CI/CD pipelines provides a powerful way to automate software delivery and improve reliability.</p>
<p>Azure DevOps enables teams to create fully automated pipelines that build, test, and deploy applications across environments. When integrated with .NET applications and cloud platforms such as Azure Kubernetes Service (AKS) or Azure App Service, CI/CD pipelines become the backbone of cloud-native development workflows.</p>
<p>By the end of this guide, you will understand how to implement a cloud-native delivery pipeline for .NET applications using Azure DevOps.</p>
<h2 id="heading-principles-of-cloud-native-net-development">Principles of Cloud-Native .NET Development</h2>
<p>Cloud-native applications are designed specifically to run in <strong>dynamic cloud environments</strong>. Rather than treating the cloud as simply another hosting location, cloud-native systems take advantage of elasticity, automation, and distributed architecture.</p>
<p>Key principles include:</p>
<h3 id="heading-microservices-architecture">Microservices Architecture</h3>
<p>Modern .NET applications are often split into smaller independent services. Each microservice can be deployed, scaled, and updated independently. This reduces system coupling and allows teams to deploy features faster.</p>
<h3 id="heading-stateless-services">Stateless services</h3>
<p>Cloud-native services typically avoid storing session data locally. Instead, state is stored in distributed databases, caches, or storage services. This allows applications to scale horizontally across multiple instances.</p>
<h3 id="heading-containerization">Containerization</h3>
<p>Containers package applications along with their dependencies, ensuring consistent execution across environments. Technologies like Docker allow .NET services to run identically in development, testing, and production.</p>
<h3 id="heading-infrastructure-as-code">Infrastructure as Code</h3>
<p>Cloud infrastructure is defined declaratively using templates such as Bicep, ARM, or Terraform. This ensures environments are reproducible, version-controlled, and automated.</p>
<h3 id="heading-observability-and-resilience">Observability and Resilience</h3>
<p>Cloud-native applications must be observable through logs, metrics, and traces. They also require resilience patterns such as retries, circuit breakers, and health checks.</p>
<p>Azure DevOps pipelines help enforce these principles by automating builds, deployments, and operational processes.</p>
<h2 id="heading-understanding-azure-devops-cicd-pipelines">Understanding Azure DevOps CI/CD Pipelines</h2>
<p>Azure DevOps pipelines automate the process of building, testing, and deploying applications.</p>
<p>A typical pipeline consists of two stages:</p>
<ul>
<li><p>Continuous Integration (CI)</p>
</li>
<li><p>Continuous Deployment (CD)</p>
</li>
</ul>
<h3 id="heading-continuous-integration-ci">Continuous Integration (CI)</h3>
<p>Continuous Integration ensures that every code change is automatically built and tested.</p>
<p>When developers push code to the repository, the pipeline:</p>
<ul>
<li><p>Restores dependencies</p>
</li>
<li><p>Compiles the application</p>
</li>
<li><p>Runs automated tests</p>
</li>
<li><p>Produces build artifacts</p>
</li>
</ul>
<p>This process helps teams detect issues early and maintain code quality.</p>
<h3 id="heading-continuous-deployment-cd">Continuous Deployment (CD)</h3>
<p>Continuous Deployment takes the build artifacts and deploys them to different environments, such as:</p>
<ul>
<li><p>Development</p>
</li>
<li><p>Staging</p>
</li>
<li><p>Production</p>
</li>
</ul>
<p>Deployment can include infrastructure provisioning, container image publishing, and application rollout.</p>
<h2 id="heading-creating-an-azure-devops-pipeline-for-a-net-application">Creating an Azure DevOps Pipeline for a .NET Application</h2>
<p>Azure DevOps uses YAML pipelines to define automation workflows.</p>
<p>Let’s start with a simple pipeline configuration for building a .NET application.</p>
<pre><code class="language-yaml">trigger:
- main

pool:
  vmImage: 'ubuntu-latest'

variables:
  buildConfiguration: 'Release'

steps:
- task: UseDotNet@2
  inputs:
    packageType: 'sdk'
    version: '8.0.x'

- script: dotnet restore
  displayName: Restore dependencies

- script: dotnet build --configuration $(buildConfiguration)
  displayName: Build project

- script: dotnet test --configuration $(buildConfiguration)
  displayName: Run unit tests

- script: dotnet publish -c \((buildConfiguration) -o \)(Build.ArtifactStagingDirectory)
  displayName: Publish application

- task: PublishBuildArtifacts@1

 inputs:
    pathToPublish: $(Build.ArtifactStagingDirectory)
    artifactName: drop
</code></pre>
<p>This pipeline performs the following tasks:</p>
<ol>
<li><p>Installs the .NET SDK</p>
</li>
<li><p>Restores NuGet dependencies</p>
</li>
<li><p>Builds the application</p>
</li>
<li><p>Runs tests</p>
</li>
<li><p>Publishes build artifacts</p>
</li>
</ol>
<p>Once the artifacts are generated, they can be deployed automatically.</p>
<h2 id="heading-containerizing-net-applications">Containerizing .NET Applications</h2>
<p>Cloud-native systems commonly use containers to ensure consistency across environments.</p>
<p>Docker allows you to package your .NET application and its dependencies into a container image.</p>
<p>Here is an example Dockerfile for an <a href="http://ASP.NET">ASP.NET</a> Core application:</p>
<pre><code class="language-dockerfile">FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src

COPY . .
RUN dotnet restore
RUN dotnet publish -c Release -o /app

FROM mcr.microsoft.com/dotnet/aspnet:8.0
WORKDIR /app
COPY --from=build /app .

ENTRYPOINT ["dotnet", "MyApp.dll"]
</code></pre>
<p>This Dockerfile uses a multi-stage build to keep the final container image lightweight.</p>
<p>The application is compiled in the build stage and then copied into a smaller runtime image.</p>
<h2 id="heading-building-and-publishing-docker-images-in-azure-devops">Building and Publishing Docker Images in Azure DevOps</h2>
<p>After containerizing your application, the pipeline can automatically build and push the container image.</p>
<pre><code class="language-yaml">- task: Docker@2
  displayName: Build and push Docker image
  inputs:
    command: buildAndPush
    repository: myregistry.azurecr.io/myapp
    dockerfile: Dockerfile
    containerRegistry: MyAzureContainerRegistry
    tags: |
      $(Build.BuildId)
      latest
</code></pre>
<p>This step performs two important actions:</p>
<ol>
<li><p>Builds the Docker image</p>
</li>
<li><p>Pushes it to Azure Container Registry (ACR)</p>
</li>
</ol>
<p>Once stored in ACR, the image can be deployed to various environments.</p>
<h2 id="heading-deploying-to-azure-kubernetes-service-aks">Deploying to Azure Kubernetes Service (AKS)</h2>
<p>Kubernetes is a popular orchestration platform for cloud-native applications.</p>
<p>Azure Kubernetes Service (AKS) simplifies Kubernetes deployment and management.</p>
<p>To deploy the application, you can use a Kubernetes deployment manifest.</p>
<p>Example deployment.yaml:</p>
<pre><code class="language-yaml">apiVersion: apps/v1
kind: Deployment
metadata:
  name: dotnet-app
spec:
  replicas: 3
  selector:
    matchLabels:
      app: dotnet-app
template:
    metadata:
      labels:
        app: dotnet-app
spec:
      containers:
      - name: dotnet-app
        image: myregistry.azurecr.io/myapp:latest
        ports:
        - containerPort: 80
</code></pre>
<p>This configuration defines:</p>
<ul>
<li><p>A deployment with three replicas</p>
</li>
<li><p>The container image to run</p>
</li>
<li><p>The exposed port</p>
</li>
</ul>
<p>Now we add a pipeline step to deploy it.</p>
<pre><code class="language-yaml">- task: KubernetesManifest@0
  inputs:
    action: deploy
    kubernetesServiceConnection: myKubernetesConnection
    namespace: default
    manifests: deployment.yaml
</code></pre>
<p>This step updates the Kubernetes cluster with the latest version of the application.</p>
<h2 id="heading-managing-environments-with-deployment-stages">Managing Environments with Deployment Stages</h2>
<p>Enterprise pipelines often include multiple environments.</p>
<p>For example:</p>
<ul>
<li><p>Development</p>
</li>
<li><p>QA</p>
</li>
<li><p>Production.</p>
</li>
</ul>
<p>Azure DevOps allows pipelines to define deployment stages.</p>
<p><strong>Example:</strong></p>
<pre><code class="language-yaml">stages:
- stage: Build
 jobs:
  - job: BuildApp
  steps:
      - script: dotnet build

  - stage: DeployDev
  dependsOn: Build
  jobs:
  - deployment: DeployDev
    environment: dev
    strategy:
     runOnce:
       deploy:
        steps:
          - script: echo Deploying to Dev
- stage: DeployProd
  dependsOn: DeployDev
  jobs:
  - deployment: DeployProd
    environment: production
</code></pre>
<p>Stages allow teams to:</p>
<ul>
<li><p>Approve deployments</p>
</li>
<li><p>Run environment-specific tests</p>
</li>
<li><p>Control promotion between environments</p>
</li>
</ul>
<h2 id="heading-infrastructure-as-code-with-azure-devops">Infrastructure as Code with Azure DevOps</h2>
<p>Cloud-native environments require automated infrastructure provisioning.</p>
<p>Tools such as Terraform, Bicep, or ARM templates allow infrastructure to be defined as code.</p>
<p>Example Terraform pipeline step:</p>
<pre><code class="language-markdown">- script: |
    terraform init
    terraform plan
    terraform apply -auto-approve
  displayName: Provision infrastructure
</code></pre>
<p>This ensures infrastructure environments remain consistent and reproducible.</p>
<h2 id="heading-implementing-security-in-cicd-pipelines">Implementing Security in CI/CD Pipelines</h2>
<p>Security in CI/CD pipelines should be automated and enforced at every stage of the delivery lifecycle. Instead of treating security as a separate step, modern pipelines integrate security checks directly into build and deployment workflows.</p>
<p>Below are practical implementations of key security practices.</p>
<h3 id="heading-1-secure-secrets-with-azure-key-vault">1. Secure Secrets with Azure Key Vault</h3>
<p>Never hardcode secrets such as API keys, connection strings, or credentials in your codebase.</p>
<p>In Azure DevOps, you can link secrets from Azure Key Vault using variable groups.</p>
<p><strong>Pipeline Example</strong></p>
<pre><code class="language-yaml">variables:
- group: KeyVault-Secrets
</code></pre>
<h4 id="heading-usage-in-code">Usage in Code</h4>
<p>var connectionString = Environment.GetEnvironmentVariable("DB_CONNECTION");</p>
<p>This ensures:</p>
<ul>
<li><p>Secrets are stored securely</p>
</li>
<li><p>No sensitive data is exposed in source control</p>
</li>
<li><p>Secrets can be rotated without code changes</p>
</li>
</ul>
<h3 id="heading-2-dependency-vulnerability-scanning">2. Dependency Vulnerability Scanning</h3>
<p>Automatically scan for vulnerable packages during the build process.</p>
<p><strong>Pipeline Step:</strong></p>
<pre><code class="language-yaml">- script: dotnet list package --vulnerable
  displayName: Check for vulnerable dependencies
</code></pre>
<p><strong>Example Output (What You’ll See)</strong></p>
<table>
<thead>
<tr>
<th>Package</th>
<th>Requested</th>
<th>Resolved</th>
<th>Severity</th>
</tr>
</thead>
<tbody><tr>
<td>Newtonsoft.Json</td>
<td>12.0.1</td>
<td>12.0.1</td>
<td>High</td>
</tr>
</tbody></table>
<p>This allows teams to:</p>
<ul>
<li><p>Detect vulnerabilities early</p>
</li>
<li><p>Prevent insecure builds from progressing</p>
</li>
</ul>
<h3 id="heading-3-static-code-analysis">3. Static Code Analysis</h3>
<p>Use tools like SonarCloud or built-in analyzers to catch security issues.</p>
<p><strong>Example Pipeline Step:</strong></p>
<pre><code class="language-yaml">- task: SonarCloudAnalyze@1
</code></pre>
<p>This can detect:</p>
<ul>
<li><p>SQL injection risks</p>
</li>
<li><p>Hardcoded credentials</p>
</li>
<li><p>Unsafe API usage</p>
</li>
</ul>
<h3 id="heading-4-enforcing-secure-build-policies">4. Enforcing Secure Build Policies</h3>
<p>You can enforce rules such as:</p>
<ul>
<li><p>Blocking builds with vulnerabilities</p>
</li>
<li><p>Requiring pull request approvals</p>
</li>
</ul>
<p><strong>Example – Fail Pipeline on Vulnerabilities:</strong></p>
<pre><code class="language-yaml">- script: |
    dotnet list package --vulnerable | grep "High" &amp;&amp; exit 1 || echo "No        high vulnerabilities"
  displayName: Fail on high vulnerabilities
</code></pre>
<h3 id="heading-5-container-security-scanning">5. Container Security Scanning</h3>
<p>Scan Docker images before deployment.</p>
<pre><code class="language-yaml">- task: Docker@2
  displayName: Scan Docker Image
  inputs:
    command: build
</code></pre>
<p>You can integrate tools like Trivy or Microsoft Defender for Containers.</p>
<h2 id="heading-observability-and-monitoring">Observability and Monitoring</h2>
<p>Cloud-native applications require strong observability.</p>
<p>Observability ensures that you can understand how your application behaves in production. In cloud-native systems, it is essential for debugging, performance optimization, and reliability.</p>
<p>A complete observability strategy includes:</p>
<ul>
<li><p>Logs</p>
</li>
<li><p>Metrics</p>
</li>
<li><p>Traces</p>
</li>
</ul>
<h3 id="heading-1-adding-application-insights-to-a-net-app">1. Adding Application Insights to a .NET App</h3>
<p>Azure Application Insights provides built-in telemetry for .NET applications.</p>
<p><strong>Setup in</strong> <strong>ASP.NET</strong> <strong>Core:</strong></p>
<pre><code class="language-csharp">builder.Services.AddApplicationInsightsTelemetry();
</code></pre>
<p>Example: Custom Logging</p>
<pre><code class="language-csharp">private readonly ILogger&lt;HomeController&gt; _logger;

public HomeController(ILogger&lt;HomeController&gt; logger)
{
    _logger = logger;
}

public IActionResult Index()
{
    _logger.LogInformation("Home page accessed");
    return View();
}
</code></pre>
<p>In Azure Portal, this appears as:</p>
<ul>
<li><p>Request logs</p>
</li>
<li><p>Response times</p>
</li>
<li><p>Dependency tracking</p>
</li>
</ul>
<h3 id="heading-2-tracking-custom-metrics">2. Tracking Custom Metrics</h3>
<p>You can track business-specific metrics.</p>
<pre><code class="language-csharp">var telemetryClient = new TelemetryClient();

telemetryClient.TrackMetric("OrdersProcessed", 1);
</code></pre>
<p><strong>Example use cases:</strong></p>
<ul>
<li><p>Number of API calls</p>
</li>
<li><p>Orders processed</p>
</li>
<li><p>Failed transactions</p>
</li>
</ul>
<h3 id="heading-3-distributed-tracing-example">3. Distributed Tracing Example</h3>
<p>Tracing helps track requests across services.</p>
<pre><code class="language-csharp">using System.Diagnostics;

var activity = new Activity("ProcessOrder");
activity.Start();

// Business logic here

activity.Stop();
</code></pre>
<p>This allows you to:</p>
<ul>
<li><p>Trace request flow across microservices</p>
</li>
<li><p>Identify bottlenecks</p>
</li>
</ul>
<h3 id="heading-4-observability-in-cicd-pipelines">4. Observability in CI/CD Pipelines</h3>
<p>You can also monitor pipeline execution itself.</p>
<p>Example: Logging in Pipeline</p>
<pre><code class="language-yaml">- script: echo "Deploying version $(Build.BuildId)"
  displayName: Log deployment version
</code></pre>
<p>Example: Tracking Deployment Time</p>
<pre><code class="language-yaml">- script: date
  displayName: Start Time

- script: echo "Deploying..."

- script: date
  displayName: End Time
</code></pre>
<h3 id="heading-5-monitoring-kubernetes-deployments">5. Monitoring Kubernetes Deployments</h3>
<p>If using AKS, monitor pods and services.</p>
<pre><code class="language-markdown">kubectl get pods
kubectl logs &lt;pod-name&gt;
</code></pre>
<p>This helps identify:</p>
<ul>
<li><p>Crashes</p>
</li>
<li><p>Restart loops</p>
</li>
<li><p>Performance issues</p>
</li>
<li><p>What Observability Looks Like in Practice</p>
</li>
</ul>
<p>In a real system, observability enables you to answer questions like</p>
<ul>
<li><p>Why is this request slow?</p>
</li>
<li><p>Which service failed?</p>
</li>
<li><p>What changed in the last deployment?</p>
</li>
</ul>
<p><strong>For example:</strong></p>
<p>A spike in latency can be traced to a slow database query. Increased errors can be linked to a recent deployment. And high CPU usage can be caused by inefficient code.</p>
<h2 id="heading-best-practices-for-enterprise-cicd-pipelines">Best Practices for Enterprise CI/CD Pipelines</h2>
<p>Designing CI/CD pipelines for enterprise .NET applications requires more than automation—it requires consistency, reliability, and control. Below are key best practices with real examples to show how they are implemented in practice.</p>
<h3 id="heading-1-keep-pipelines-declarative-yaml-based">1. Keep Pipelines Declarative (YAML-Based)</h3>
<p>Defining pipelines in YAML ensures they are version-controlled and reproducible.</p>
<p>Example:</p>
<pre><code class="language-yaml">trigger:
- main

pool:
  vmImage: 'ubuntu-latest'

steps:
- script: dotnet build
</code></pre>
<p>This approach allows you to:</p>
<ul>
<li><p>Track pipeline changes in Git</p>
</li>
<li><p>Review pipeline updates via pull requests</p>
</li>
<li><p>Reuse templates across projects</p>
</li>
</ul>
<h3 id="heading-2-implement-automated-testing-at-multiple-levels">2. Implement Automated Testing at Multiple Levels</h3>
<p>A robust pipeline includes unit, integration, and end-to-end tests.</p>
<p>Example:</p>
<pre><code class="language-yaml">- script: dotnet test --filter Category=Unit
  displayName: Run Unit Tests

- script: dotnet test --filter Category=Integration
  displayName: Run Integration Tests
</code></pre>
<p>This ensures that bugs are caught early, critical workflows are validated, and releases are more stable.</p>
<h3 id="heading-3-use-immutable-build-artifacts">3. Use Immutable Build Artifacts</h3>
<p>Build once and deploy the same artifact across all environments.</p>
<p>Example:</p>
<pre><code class="language-yaml">- script: dotnet publish -c Release -o $(Build.ArtifactStagingDirectory)

- task: PublishBuildArtifacts@1
  inputs:
    pathToPublish: $(Build.ArtifactStagingDirectory)
    artifactName: drop
</code></pre>
<p>Deployment Uses Same Artifact</p>
<pre><code class="language-yaml">- task: DownloadBuildArtifacts@0
  inputs:
    artifactName: drop
</code></pre>
<p>This prevents environment inconsistencies and “Works on my machine” issues.</p>
<h3 id="heading-4-enable-safe-deployment-strategies-blue-green-canary">4. Enable Safe Deployment Strategies (Blue-Green / Canary)</h3>
<p>Avoid deploying directly to all users at once.</p>
<p>Example: Canary Deployment Concept</p>
<pre><code class="language-yaml">- script: echo "Deploying to 10% of users"
</code></pre>
<p>In Kubernetes:</p>
<pre><code class="language-yaml">spec:
  replicas: 10
</code></pre>
<p>Then gradually increase replicas of the new version.</p>
<p>This allows:</p>
<ul>
<li><p>Gradual rollout</p>
</li>
<li><p>Early detection of failures</p>
</li>
<li><p>Quick rollback if needed</p>
</li>
</ul>
<h3 id="heading-5-enforce-pull-request-validation">5. Enforce Pull Request Validation</h3>
<p>Ensure code is tested before merging into main branches.</p>
<p>Example:</p>
<pre><code class="language-yaml">pr:
- main
steps:
- script: dotnet build
- script: dotnet test
</code></pre>
<p>This ensures that only validated code is merged, and that code quality remains high.</p>
<h3 id="heading-6-use-environment-approvals-for-production">6. Use Environment Approvals for Production</h3>
<p>Prevent accidental deployments to production.</p>
<p>Example:</p>
<pre><code class="language-yaml">- stage: DeployProd
  jobs:
- deployment: Deploy
    environment: production
</code></pre>
<p>Azure DevOps allows manual approvals and role-based access control.</p>
<p>This ensures that you have controlled releases and results in reduced risk.</p>
<h3 id="heading-7-version-your-builds-and-artifacts">7. Version Your Builds and Artifacts</h3>
<p>Every build should be uniquely identifiable.</p>
<p>Example:</p>
<pre><code class="language-yaml">- script: echo "Version: $(Build.BuildId)"
</code></pre>
<p>For Docker:</p>
<pre><code class="language-yaml">tags: |
  $(Build.BuildId)
  latest
</code></pre>
<p>This allows for easy rollbacks and traceability.</p>
<h3 id="heading-8-add-logging-and-diagnostics-in-pipelines">8. Add Logging and Diagnostics in Pipelines</h3>
<p>Pipelines should produce meaningful logs.</p>
<p>Example:</p>
<pre><code class="language-yaml">- script: echo "Starting deployment..."
- script: dotnet build
- script: echo "Build completed"
</code></pre>
<p>This helps you debug failed pipelines and understand execution flow.</p>
<h3 id="heading-9-automate-infrastructure-provisioning">9. Automate Infrastructure Provisioning</h3>
<p>Don't manually create infrastructure. Instead, use a tool like Terraform.</p>
<p>Example (Terraform):</p>
<pre><code class="language-yaml">- script: |
    terraform init
    terraform apply -auto-approve
</code></pre>
<p>This ensures consistent environments and repeatable deployments.</p>
<h3 id="heading-10-monitor-pipeline-and-deployment-performance">10. Monitor Pipeline and Deployment Performance</h3>
<p>Track metrics such as build time and deployment frequency.</p>
<p>Example:</p>
<pre><code class="language-yaml">- script: echo "Build completed at $(date)"
</code></pre>
<p>You can track:</p>
<ul>
<li><p>Build duration</p>
</li>
<li><p>Deployment success rate</p>
</li>
<li><p>Failure trends</p>
</li>
</ul>
<h2 id="heading-conclusion">Conclusion</h2>
<p>Cloud-native development has transformed how enterprise .NET applications are built and delivered. By adopting containerization, automated pipelines, and infrastructure as code, teams can deliver reliable software faster and with greater confidence.</p>
<p>Azure DevOps CI/CD pipelines play a central role in this process. They automate everything from building and testing applications to packaging containers and deploying them across cloud environments. When combined with technologies such as Docker, Kubernetes, and Azure monitoring services, they enable .NET teams to build scalable, resilient, and continuously deployable systems.</p>
<p>For teams beginning their cloud-native journey, the best starting point is to automate the build and test process using CI pipelines. From there, gradually introduce containerization, deployment automation, and infrastructure as code. As pipelines mature, organizations can incorporate advanced practices such as multi-environment deployments, automated security scanning, and progressive rollout strategies.</p>
<p>Ultimately, cloud-native CI/CD pipelines turn software delivery into a repeatable and reliable process. For enterprise .NET applications, this shift allows development teams to focus less on manual operations and more on delivering value through faster innovation and continuous improvement.</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="2428" height="1284" 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="1686" height="1376" 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>
        
    </channel>
</rss>
