Hello Azure Infrastructure as code using C#

Ha Doan
2 min readDec 22, 2019

--

As an Azure Administrator, I often use Web console to create new web app or new service, e.g if you want to create a new web app and deploy to Azure use following guide https://docs.microsoft.com/en-us/azure/app-service/environment/app-service-web-how-to-create-a-web-app-in-an-ase

However, when you deploy many web applications in production, things are getting more complex (e.g Load balancer, databases, services,…). That is job Infrastructure as code => Manage your cloud infrastructure by configuration/programming.

As .NET developer, I prefer a C# language to manage cloud infrastructure, and I found out that Pulumi supports C# language recently, it also supports TypeScript, Javascript, Golang and Python.

With Pulumi for .NET you can:

  • Declare infrastructure using C#, VB.NET, or F#.
  • Automatically create, update, or delete cloud resources
  • Use your favorite IDEs and tools (e.g Visual Studio Code)
  • Catch mistakes early on with standard compiler errors, Roslyn analyzers, and an infrastructure-specific policy engine for enforcing security, compliance, and best practices.
  • Reuse any existing NuGet library.
  • Deploy continuously, predictably, and reliably using Azure DevOps Pipelines,…
  • Build scalable cloud applications using classic infrastructure cloud-native technologies like Kubernetes, Docker containers, serverless functions, …

Steps to try out Pulumi

Install Pulumi for Windows

choco install pulumi

Install Azure CLI

https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest

Config Azure

  • Config Azure https://www.pulumi.com/docs/intro/cloud-providers/azure/setup/
  • After install, run Pulumi new azure-csharp from the terminal/cmd and select parameter to create a new project, it will ask you to create login/signup an account in Pulumi website
  • Open program.cs Pulumi already generated a sample to create a new resource and sample storage account
  • To deploy the sample to your Azure account, run command pulumi up, it will prompt for confirm, press “yes” to confirm the deployment
  • Now you go to Azure, you can see your resources created
  • To delete resources, run command pulumi destroy

To learn more about Pulumi, visit https://www.pulumi.com/docs/.

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

--

--

No responses yet

Write a response