Skip to content

Instantly share code, notes, and snippets.

@jonshaffer
Last active February 8, 2025 20:17
Show Gist options
  • Save jonshaffer/271281f7ea47e3e4ebe69be65eedcece to your computer and use it in GitHub Desktop.
Save jonshaffer/271281f7ea47e3e4ebe69be65eedcece to your computer and use it in GitHub Desktop.

Prereqs:

  1. Create an Azure account
  2. If you haven't already, install Git, Docker (Docker Desktop free in personal plan), .NET CLI, Node.js, Azure Developer CLI, and your preferred IDE like VSCode
    • Node.js, .NET CLI, and other versioned programming related CLI's may be easier to manager with a version manager like asdf

1. Set up your Azure DevOps org

** Remember your new home: https://aex.dev.azure.com/me

  • Create your organization tutorial ๐Ÿ”—
  • Create the project, you'll be deploying an example e-commerce application to it so name it appropriately.
  • You may want to start a wiki to keep notes on what you learn, and things specific to this project.

2. Clone eShopOnAzure to your org

  • Clone the Github repo of this example app: GitHub - Azure-Samples/eShopOnAzure: A variant of https://github.com/dotnet/eShop that uses Azure services
  • Create a new Azure Repo in your org
  • Add a remote of your Azure Repo to your local clone
    • Remove the existing origin remote by executing git remote remove origin; origin is the common default name for remote git repository references and will be automatically populated when you clone the example eShopOnAzure repo.
    • Check your Azure Repo webpage for a specific git remote add origin command under Push an existing repository from command line
  • git push the code to the org repo default branch
    • This should be the last time you're updating the default branch without a pull request!
    • git push involves a few things: git status will display a list of currently changed files, git add -A will stage all of the files to be committed, git commit -m "Some changes" will commit the changes locally, and finally git push will either push the changes to your remote origin or tell you how to track your branch to a corresponding remote branch.
    • Commit messages are a practiced art and sometimes a part of release automation

3. Get the app running

Run the app locally using Docker eShopOnAzure -> README.md -> Getting Started

4. Deploy the app to Azure

Follow the steps to install the Azure CLI and deploy the app locally. Make sure you have the app running locally in Docker, then in Azure via the provided default options.

5. Create the Azure DevOps pipelines

Note: This project has both unit tests via dotnet test and e2e tests via npx playwright.

  • Referencing the existing Github Actions pipelines, create a CI pipeline that will verify the code (hint: .github/workflows/pr-validation.yml is an existing Github Actions version)
  • Create a CD (Release) pipeline that will update the Azure deployment of the app whenever the default branch is updated official docs ๐Ÿ”—
    • Make sure your tests are running prior to release and prevent a release if they fail
    • Verify that Tests tab populates with test results for both unit and e2e tests.

6. Save your wallet

This step helps avoid unnecessary costs by automatically tearing down resources that arenโ€™t needed after testing.

Create a new release pipeline that will use azd to delete the eShopOnAzure resources scheduled to run once per day in case we forget to take them down.

7. Pipeline hardening

  • Make sure you move all of your secrets to Azure secret variables (Pipelines -> Library -> Variables)
  • You can make variable groups for specific environments, applications
  • Make sure your pipeline is represented and used as code schema ๐Ÿ”— lab ๐Ÿ”—
    • Create the pipelines in a branch
    • Merge the branch when it is running appropriately. Note: you may want to change the target and run conditions while testing, and set it to its final settings when ready to merge.
    • You may use a validator in your IDE or via the Azure Pipelines editor (Pipelines -> Create Pipeline)

8. Let's make a change

Congratulations, you just got bought out. The only stipulation of the buyout is that the company must change its' name.

  • Make sure the app is currently deployed
  • Locally (on your machine), create a new branch to work on
  • Update any AdventureWorks references (besides images) to the new company name (your choice or Toboggan Noggins)
  • Make sure the app runs locally and the references to the old company name are updated
  • Commit the changes to your local branch
  • Push the local branch to the same name branch on Azure DevOps repos
  • Make a pull request to the default branch
  • Make sure all tests pass for your pull request
  • Merge the pull request
  • Follow the release to Azure and make sure it works prior to signing off for the day

Resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment