When you are developing Powershell scripts, creating some unit tests will help you in monitoring the quality of the scripts. Writing some tests will give you some assurance that your code still works after you make some changes. Writing Powershell unit tests can be done with Pester. Pester will enable you to test your Powershell scripts from within Powershell. It is a set of Powershell functions for unit testing Powershell. These functions will allow you to mock and isolate the Powershell code under test. When you want to integrate your unit test into your VSTS build pipeline, you need an build extension to run then in your build pipeline.
Continue reading “Running Powershell Pester unit test in a VSTS build pipeline”
Create a VSTS release pipeline for Azure Functions
Azure Functions enable you to easily run small pieces of code in the cloud. To do this right, you need to setup continuous delivery of the infrastructure and the code involved. Otherwise you will end with an uncontrolled environment where nobody knows what code is actually running. In this blog post I’ll describe how to setup a deployment pipeline for Functions with VSTS. This will enable you to deploy Functions as Infrastructure as Code.
From an deployment perspective an Azure Function contains of two parts:
- Azure infrastructure
- Function code
Both the ARM template and the code can be deployed from VSTS. By doing this, you can manage functions like any other Azure resource.
Continue reading “Use VSTS to deploy Functions as Infrastructure as Code”
In my previous blog post Lock Azure resources to prevent accidental deletion, I showed how to add a lock to a resource with an ARM template to protect it from accidental deletion. When you want to delete the resource, you first need to remove the lock. A lock cannot be removed with an ARM template. To remove the lock you can use:
- Rest API
Continue reading “Remove locks from Azure resources”
How a lock can prevent user from accidental deletion of a resource.
In some cases you want to protect critical resources from accidental deletion. Some examples are a storage account with source data for processing, a Key Vault with disk encryption keys, or another key component in your infrastructure. When losing some resources that are key in your infrastructure, recovery can be dramatic. Resource Manager locks will enable you to protect these critical resources from deletion.
Resource Manager locks
Resource Manager locks apply to the management function of the locked resources. The locks do not have any impact the normal functions of the resource. You have two possible types of locks on a resource:
Locking down a resource can save your contributors from accidently delete a critical resources. An ‘oeps… I deleted the wrong resources’ moment should be a thing of the past.
CannotDelete means authorized users can still read and modify a resource, but they can’t delete the resource.
ReadOnly means authorized users can read a resource, but they can’t delete or update the resource. Applying this lock is similar to restricting all authorized users to the permissions granted by the Reader role.
Continue reading “Lock Azure resources to prevent accidental deletion”
When running ARM templates to deploy Linux with disk encryption on Azure I encountered a few errors. The errors where coming when I rerun the same template multiple times. In this post I explain the errors and how I fixed them.
Error: … is not a valid versioned Key Vault Secret URL
Continue reading “Fixing ARM deployment errors for Linux disk encryption”
.NET Core comes with a new tool chain for software development. These tools run from the CLI (Command Line Interface). Out of the box you have command line restore, build, etc. These tools are the primary tools on which higher-level tools, such as Integrated Development Environments (IDEs), editors and build orchestrators can build on. The tools set in extendable on project level. That means that you can add tools in the context of your project by adding it to your project file. The tool you want to run with the from the CLI is called a verb (dotnet-verb). Running a verb is done by: dotnet verb.
Continue reading “Make a .NET Core CLI Extensions”
Written by Pascal Naber and Peter Groenewegen for the Xpirit Magazine
Your team is in the process of developing a new application feature, and the infrastructure has to be adapted. The first step is to change a file in your source control system that describes your infrastructure. When the changed definition file is saved in your source control system it triggers a new build and release. Your new infrastructure is deployed to your test environment, and the whole process to get the new infrastructure deployed took minutes while you only changed a definition file and you did not touch the infrastructure itself.
Continue reading “Infrastructure as Code and VSTS”