Skip to main content

Posts

Showing posts from December, 2019

Dockerize your .NET Core Webapp and deploy with CI/CD

In this blog post we're going to;

1. Build a .NET Core web app
2. Confirm the web app works
3. Build a Docker image from that web app
4. Build an Azure Container Registry to store our image
4. Deploy our Docker image via CI/CD to Azure WebApps with Azure DevOps

Before building your Docker image, ensure you are using Linux containers if you are working on Windows 10. Open up the Docker application and select "Switch to Linux containers...." Pre-requisites; 1. Visual Studio (Community Edition is fine) 2. Visual Studio Code 3. An Azure subscription 4. An Azure DevOps Project
5. Docker installed on your desktop

Code for this project can be found at: https://github.com/AdminTurnedDevOps/TheLifeOfAnEngineerBlog/tree/master/DockerizeDotNetCoreApp
First let's open up a terminal (I'm using Windows Terminal, but you can use PowerShell) and run dotnet new to see our options. In the options, we're going to want webapp


Create a new directory for your webapp to go in. For e…

Using Azure DevOps and Terraform to deploy infrastructure

Terraform has been gaining more and more traction throughout 2019. With version 0.12, it gained even more traction. With it's bracket-based syntax and large library of providers (providers are what APIs you can hit. Azure, AWS, etc.), it provides a plethora of options for automating your infrastructure.

This example will be a very basic example of using Terraform, but if you would like something more sophisticated (building a certain piece of infrastructure, tfvars, Terraform variables, Terraform state, etc.) please feel free to reach out and ask.

Pre-requisites 1. An Azure DevOps account
2. A repo that's ready to commit your Terraform code and YAML pipeline to. I'm using Azure Repos.
3. The Terraform extension in Azure DevOps. For directions please visit: https://docs.microsoft.com/en-us/azure/devops/marketplace/install-extension?view=azure-devops&tabs=browser
4. An Azure DevOps project that you have access to.
5. A storage account to hold your Terraform state.


provider…

Create a Durable Azure Function with Visual Studio

First, let's talk about the difference between an Azure Function and a Durable Azure Function. The difference here is stateful vs stateless. A stateless platform does not hold your data. A stateful platform does hold your data.

To give a few examples, Docker containers are stateless. Once that container is gone, the data is gone. This is why (besides performance issues) it's frowned upon to put databases in containers (sure, you can mount volumes for the purpose of making it stateful, but that's off topic). However, LXC (Linux Containers) are stateful and hold your data.

Another example is your computers RAM and hard drive. RAM is stateless, meaning once you turn off your computer, everything held in RAM is gone. However your hard drive is stateful, as in once your computer gets turned off, your data stored in your hard drive still exists.

Now that we understand stateful vs stateless, let's talk about Azure Functions. Durable Azure Functions are "stateful". L…

Azure SQL automation with PowerShell

Azure SQL makes our lives much easier as much IT professionals and DevOps professionals. There was a time that we had to set up virtual machines or physical hosts, networking, an operating system, then finally install SQL Server. With Azure's built-in Azure SQL service, it makes as a much easier way to store our application data. Today we're going to take a look at spinning up an Azure SQL Server, database, and firewall rules.

Pre-requistes; 1. Azure account
2. Visual Studio Community or Enterprise

If you want to follow what code I'm using, you can find it on my Github: https://github.com/AdminTurnedDevOps/AZ-203-Code/blob/master/azureSQL/New-azureSQL.ps1

The first thing we'll need to do is open up VSCode and create a new PowerShell file (.ps1). The first part of our script will be creating out function and param block.

function New-AzureSQLDB {
    [cmdletbinding(SupportsShouldProcess, ConfirmImpact = 'low', DefaultParameterSetName = 'newDB')]
    param…