Exercise-11

 11. Creating Release Pipelines: Deploying Applications to Azure App Services, Managing Secrets and Configuration with Azure Key Vault, Hands-On: Continuous Deployment with Azure Pipelines

Objective

To understand how to deploy applications to Azure App Services using Azure Pipelines, manage secrets using Azure Key Vault, and implement continuous deployment.


1. Deploying Applications to Azure App Services

Azure App Services Overview

Azure App Services is a fully managed platform for building, deploying, and scaling web apps.

Steps to Deploy using Azure Pipelines

  1. Create an App Service in Azure:

    • Go to Azure Portal → Create a Resource → Web App.

    • Provide details like App name, Runtime stack, Region, and Resource group.

  2. Create a Release Pipeline in Azure DevOps:

    • Go to Azure DevOps → Pipelines → Releases.

    • Click on New Pipeline → Select Azure App Service Deployment template.

  3. Configure the Artifact:

    • Link the build artifact from your build pipeline (Maven/Gradle).

    • Choose the appropriate version and source.

  4. Add a Stage and Deploy:

    • Select the App Service target.

    • Configure App Service connection and app name.

  5. Trigger Deployment:

    • Enable continuous deployment trigger.

    • Save and create a release.


2. Managing Secrets and Configuration with Azure Key Vault

What is Azure Key Vault?

Azure Key Vault is a cloud service to securely store and access secrets, keys, and certificates.

Using Key Vault in Azure Pipelines

  1. Create a Key Vault:

    • Go to Azure Portal → Create Key Vault.

    • Store secrets like DB passwords, API keys.

  2. Configure Access:

    • Assign appropriate access policies (for Azure Pipelines or App Service).

  3. Link Key Vault in Azure Pipeline:

    • In the pipeline YAML or classic editor:

      variables:
        - group: MyKeyVaultSecrets
      
    • Use secrets like $(MySecret) in scripts or tasks.

  4. Integrate with App Service Configuration:

    • App Services can directly pull secrets using Managed Identity.


3. Hands-On: Continuous Deployment with Azure Pipelines

What is Continuous Deployment (CD)?

Continuous Deployment is the practice of automatically deploying every code change that passes the CI pipeline.

Setup CD with Azure Pipelines:

  1. Ensure CI Pipeline is Configured:

    • Generates build artifact after every commit.

  2. Create a Release Pipeline:

    • Link the artifact from CI.

    • Add deployment stages (Dev, QA, Prod).

  3. Enable Continuous Deployment Trigger:

    • In Artifact section → enable CD trigger.

  4. Deploy to Azure App Service:

    • Use the Azure App Service Deploy task.

    • Set environment-specific settings.

  5. Monitor and Validate:

    • Check deployment status.

    • Validate on the App Service URL.


Expected Outcome

  • You will be able to:

    • Automatically deploy your Java web app to Azure App Services.

    • Use Azure Key Vault to manage sensitive data securely.

    • Configure full CI/CD with Azure Pipelines.


Comments