Skip to main content

DevOps tooling in the Microsoft realm

When I really started to dive into automation and practicing DevOps with specific tooling, there were a few key players. At the time Microsoft was not one of them. They were just starting to embrace the open source world, including the art and practice of DevOps. Since then Microsoft has went all in and the tech giant has made some incredible tooling. Recently I switched to a Microsoft-heavy environment and I love it. I went from AWS/Python/Ansible/Jenkins to Azure/PowerShell/ARM/Azure DevOps. My first programming language was PowerShell so being back in the saddle allowed me to do a full circle between all of the different types of tooling in both worlds. Today I want to share some of that tooling with you.

The first thing I want to talk about is ARM. What is ARM? ARM is a configuration management tool that allows you to perform software-defined-infrastructure. Much like Ansible and Terraform, ARM allows you to define what you want your environment to look like at scale. With ARM, you can define parameters and variables to specify dynamically changing environments. The syntax is in JSON (key/value pairs) which allow you to define what your infrastructure will look like. Let's have a look at the below example.

"subnetRef": "[concat(variables('vnetId'), '/subnets/', parameters('subnetName'))]"

Above we see a key called "subnetRef". After that you see a function called "concat" which concatenates whatever you decide to put in your line of code. In this case I'm concatenating the variable 'vnetId' with 'subnets' and my parameter called 'subnetName'.

After you define your parameters and variables, you have resources. Your resources are essentially API calls to anything from VMs to storage accounts that allow you to define how you want that piece of infrastructure to look like. For example, if you want to create a network interface, you would call the "Microsoft.Network/networkInterfaces" API. For more information on Azure ARM Functions, take a look at this article: https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-template-functions


Next up we have AKS. What is AKS? AKS is an Azure-hosted Kubernetes service. This service allows you to tie your Kubernetes micro-service infrastructure into Azure. Azure hosts the master node for you (where the Kubernetes API is) and allows you to manage your workers. Instead of spinning up a Kubernetes environment on-prem, you can utilize AKS to easily spin up your environment. You can also spin up this environment in an automated fashion (With PowerShell, ARM, etc.)

What is Azure? Azure is a cloud-based platform that allows you to host your entire environment. Much like AWS, Azure has SDKs, a great CLI (which we will talk about later), and plenty of other automation tools that allow you to easily spin up anything from VMs to networks to API-hosting services to serverless functions. Cloud based environments have changed the game. No longer do we have to wait for a server to arrive, configure ESXi on the server, and hope that everything gets spun up in a timely fashion.

What is Azure DevOps? Azure DevOps is a full-fledged DevOps tooling solution that is comprised of the following;
1. A ticketing system which allows you to track progress in a kanban board or even set up your sprints.
2. A wiki which allows you to document all of your processes and tips.
3. A CI platform which allows you to create builds based on your code
4. A CD platform which allows you to ship your product in an automation fashion
5. Test plans which allow you to perform testing on your code and your CI/CD
6. Azure Repos which is a distributed version control system (much like Github) to store your code via source control

Much like Jenkins and Gitlab CI, Azure DevOps gives you the ability to have a full-fledged CI/CD platform. Despite the name, Azure DevOps also works for on-premise deployments and even deploying to AWS. Because it is not tied to Azure, this is a great solution for multiple needs.

What is PowerShell? PowerShell is a programming/scripting language that gives you the ability to fully automate from start to finish. This is anything from resources in Azure to resources in AWS to on-prem resources to virtualization resources in both ESXi and Hyper-V. You can even create scripts to push specific components into Docker, create Docker image with features like IIS, build a desktop app, and build a web app. With the introduction to PowerShell Core, it completely changed the languages game. Now you can run PowerShell on Linux, OSX, and Windows. It's fully cross-platform and allows you to have a one-stop-shop programming/scripting language.


What is the .NET Framework? It's a software framework that was developed by Microsoft. The .NET Framework also has an open source version, .NET Core. This too, much like PowerShell, can run cross-platform. The power behind PowerShell is in fact the .NET Framework. Many will use it for C# applications, but it can also be heavily incorporated into PowerShell. Within PowerShell you can add .NET assemblies, call namespaces to be used, and even use the same methods you can use in C#. This allows you to extend the power of PowerShell even further. With cmdlets in PowerShell like Add-Type and New-Object, you can call upon these .NET resources to incorporate anything you'd like.


What is the Azure CLI? There are many ways to manage resources in Azure. With the Azure CLI, you can work right from the terminal. No longer do you need to click around to find resources throughout subscriptions. The Azure CLI gives you the ability to find and create any Azure resources that you need. The Azure CLI can also be wrapped within PowerShell or called within your CI/CD pipeline for any component function. You also have the ability to use the Azure CLI on Linux and OS X. If you're using the new Windows Terminal, the cloud shell is built in and allows you to use the Azure CLI as well.

What are Azure Repos and Github? They are source control for your code. It allows you to have a centralized location to store your source code and collaborate across teams for all projects that you are working on. Azure Repos is built into Azure DevOps and now that Microsoft owns GitHub, these two are Microsofts most popular source control tools. The great thing about source control is no longer do you need to worry about where you're storing your code, who can see it, who can make changes, and who can work on it with you. Source control is the core to all development, DevOps, and anyone else who is writing code. You can track and manage all changes to code to ensure the code is production or development ready. The best part is multiple people can see it and you have the ability to really collaborate across people and teams.


This brings us to the end of the post. I'd like to point out the trend here. Microsoft IS open-source friendly. There was a time that they certainly weren't, but that has all changed. The Microsoft we're seeing today is a completely new and different Microsoft. With the tools and the changes that they've made, it's no doubt that they will continue to be one of the top players in the open-source and DevOps game. 

Comments

Post a Comment

Popular posts from this blog

Run PowerShell code with Ansible on a Windows Host

Ansible is one of the Configuration Manager kings in the game. With it's easy-to-understand syntax and even easier to use modules, Ansible is certainly a go-to when you're picking what Configuration Management you want to use for your organization. Your question may be "but Ansible is typically on Linux and what happens when I'm in a Windows environment?". Luckily I'm here to tell you that Ansible will still work! I was pleasantly surprised with how easy it is to use Ansible on Windows with a little WinRM magic. Let's get started.

Pre-requisites for this post:
1) WinRM set up to connect to your Windows host from Ansible
2) Ansible set up for Windows Remote Management
3) SSH access to the Ansible host
4) Proper firewall rules to allow WinRM (port 5985) access from your Ansible host to your Windows host
5) Hosts file set up in Ansible that has your IP or hostname of your Windows Server.
6) At least one Linux host running Ansible and one Windows Server host …

Running PowerShell commands in a Dockerfile

As Docker continues to grow we are starting to see the containerization engine more and more on Windows. With the need for containers on Windows, we also need the same automation we get in Linux with Dockerfiles. Today we're going to create a Dockerfile that runs PowerShell cmdlets.
Prerequisites; 1. Docker for Windows
2. A code editor (VSCode preferred)

Let's go ahead and get our Dockerfile set up. Below is the Dockerfile I used for this post.

from mcr.microsoft.com/windows/servercore:1903 MAINTAINER Michael Levan RUN powershell -Command Install-WindowsFeature -Name Web-Server RUN powershell -Command New-Item -Type File -Path C:\ -Name config
As you can see from the above, this is a tiny Dockerfile. What this will do is install the IIS Windows 

Feature and create a new file in C:\ called "config".
You should see something very similar to the below screenshot;

Next let's create a running container out of our image. First we'll need to run docker container ls to

 get o…