Complete guides to deploy .NET core Microservice apps to Azure AKS by Pulumi - part 1: Azure Sql, Container Registry, and DevOps Pipeline

Ha Doan
4 min readMay 3, 2020

--

TLDR: In this guide I will deploy .NET core micrservice apps to Azure AKS, Azure SQL server by Pulumi Infrastructure as Code, the code is written in Typescript

  • Source-code published here
  • Microservice architect overview is in below document:
Architect diagram

I forked from Abp framework to my github repository for deployment:

You must install Pulumi in your local computer, please see guide from here

Create new folder and run this command:

pulumi new azure-typescript

Deploy 2 Azure Sql Databases: product-db and identity-db

  • Create sql-deployments.ts file as below
  • Run pulumi up to deploy Sql databases

Select “yes” and wait for deployment, after successful deployment you can see result as below

Deploy Azure Container Registry

Create container-registry.ts file as below

  • Run pulumi up to and select “Yes” to deploy
  • After successful deployment, you can navigate to Azure portal to see your container service as below

Deploy IdentityServer4 to Azure Container Registry by DevOps

  • Authorize your Github account to allow Azure DevOps pull source-code
  • Select project you want to deploy
  • Choose “Docker container” template
  • Go to Trigger section, enable “Enable continuous integration” for CI, you can enable Folder trigger in Path filter section below if you want trigger your CI only from specific folder (this project I don’t use it!)
  • I am going to deploy AuthServer.Host project in below folder
  • Go to Tasks section, remove everything below “Agent job 1” and then select “Add a task to Agent 1”
  • Filter “copy file” and Add to Task
Copy source-codes to ./src folder
  • Add “Install Docker” task
  • Add “Command line” task to build docker file

As you see in above picture we will build “auth-server-host” image and later push to Container Registry

  • Add “Run Docker command” task to push to Container Registry

Input Parameters as above picture, select “DemoMicroserviceRegistry” as we created before by Pulumi.

  • Save and run CI
  • Wait few minutes for CI to build and push image to Container Registry
Successfully build!
  • After sucessfully build, we create new image to the Registry as below

That is enough for PATR 1, in Part2 I’ll show how to create Azure AKS and deploy containers from Container Registry and Kubernetes Workload!

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Responses (2)

Write a response