Skip to main content

Posts

Showing posts from 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…

Access Azure Batch with Azure's REST API using PowerShell and AZ CLI

To start off, what is a REST API? In short, a REST API is how you programmatically interact with an application via HTTP requests. You can do things like get data (GET API call), write data (POST API CALL), and even delete data (DELETE API call). Most of the libraries or modules you work with in PowerShell are API calls. Let's see how to set up a REST API call with PowerShell and AZ CLI. Every service in Azure can be called via REST. Today as an example, we'll use Batch accounts.

What is Batch? From the Microsoft documentation: "Azure Batch runs large-scale applications efficiently in the cloud. Schedule compute-intensive tasks and dynamically adjust resources for your solution without managing infrastructure." - https://docs.microsoft.com/en-us/azure/batch/

Let's get started.

Pre-requisites: 1. A Batch account. To create one:  https://docs.microsoft.com/en-us/azure/batch/batch-account-create-portal
2. Access to an Azure portal
3. VSCode
4. AZ CLI


The first way w…

The road to AZ-400 Azure Certified DevOps Engineer

I've decided to switch gears in my training to focus on something that I haven't before, certifications. I currently hold a Microsoft cert, VMWare cert, and Cisco cert, but I never really set out to say "I want this certification in X amount of take for this purpose.

The reason why I haven't is because I've always been more of a "jack of all trades" technology professional. Recently I've been focusing on one portion, Development Operations (DevOps). It's something that I'm very passionate about and I enjoy extensively. So what does this mean for my blog? Well, it means it won't really be changing. A lot of my content is already focused on this.

So, what's the plan? The plan is to first pass the AZ-203. Why? Because there is a pre-requisite for the AZ-400. It's either the AZ-102 (Azure Certified Administrator) which is focused more on the IT side and the AZ-203 (Azure Certified Developer) which is more focused on the development si…

Github Actions CI/CD

What is GitHub Actions? It's an API for orchestration of workflows, events, and now, CI/CD. You may be asking yourself the same question I've asked - If Microsoft has Azure DevOps for CI/CD, why put CI/CD into Github? Well, it's simple. Not everyone that uses Github uses Azure DevOps. Some use Jenkins, Octopus, or Gitlab CI. The interesting part about GitHub Actions CI/CD is the fact that it's all YAML based, just like YAML pipelines in Azure DevOps.

Now that we know what GitHub Actions is, how about we take a look at how it works? To see how it works in action, we're going to create a webapp.

Pre-requisites: 1) Azure account
2) GitHub account (free or paid)

I'm going to head over to my GitHub page and use my Cloudengineer_PowershellAzure repo.


Next I'm going to click on the "Actions" tab and scroll down until I see the "Docker image" workload. Click on "Set up this workflow".



As we can see above, this is a default YAML file.

No…