Test Azure deployments in your VSTS Release Pipeline

pesterWhen deploying Azure Resources you want to know if all resources are deployed as expected. To check if the resources are correctly deployed you can open the portal and visually inspect the deployed recourses or you can also run some powershell to validate the resources. Why not automate these checks and add them to your deployment pipeline. To validate the resources, I extended the Pester Build Task to connect to Azure. A test that checks the deployment of a VM can look like:

Continue reading “Test Azure deployments in your VSTS Release Pipeline”

Advertisements

Log4Net Troubleshooting

logoLog4net is a fail-stop logging system. Fail stop means that it stops logging on an internal exception and by design does not interact with the program flow. Knowing this explains you troubleshooting log4net isn’t so easy. If logging fails, your program does not notice. You see a lot of questions about: why is my log4net logging not working? This article explains the basic troubleshooting and most common solutions.

Continue reading “Log4Net Troubleshooting”

Entity Framework and Full Text Search

Out of the box Entity Framework does not support Full Text Search. To do Full Text Search you have a number of options to get it working. In this blog post I’ll describe a method to get Full Text Search working using a table valued function. The method does the Full Text Search in a table valued function that returns an id list, the returned ids can be used to filter the records from an actual table.
Continue reading “Entity Framework and Full Text Search”

Get your web application errors into Slack

Get your devops going by integrating your application into your team communication tooling.

bugbotTo get more out of Slack and your team, you can integrate Slack with your application. Integrating with slack is done with webhooks. In this sample I use a Incoming Webhook to post the messages from the application to slack. By adding a GlobalExceptionFilter to you .Net Core web application, you can get all exceptions that are not handled in your web application.
Continue reading “Get your web application errors into Slack”

Create multiple data disks with a property copy in an ARM Template

When you had to create a N number of items from a property in an ARM object, you had to create an array and take N from that array. With the new copy functionality you are able to do a copy on an property in resource deployment object. For disks this can look like:

           "copy": [
            {
              "name": "dataDisks",
              "count": "[parameters('dataDiskCount')]",
              "input": {
                "diskSizeGB": "1023",
                "lun": "[copyIndex('dataDisks')]",
                "createOption": "Empty"
              }
            }
          ]

This new feature will make the creation of multiple properties a lot easier. For a full sample you can look at: Ryan Jones GitHub.

Serial copies in ARM Templates

You can now make copies in serial mode. That means that the copies are created after each other instead of parallel. This can be a good idea when you update a live resource. The resources will go down and up after each other.

A sample of this:

        {
            "apiVersion": "2015-01-01",
            "name": "[concat('nestedDeployment',copyIndex())]",
            "type": "Microsoft.Resources/deployments",
            "copy": {
                "name": "myCopySet",
                "count": 4,
                "mode": "serial",
                "batchSize": 2
            },

The mode and batchSize are new. Mode can be serial or parallel. The batchSize configures how many objects are created at the same time in serial mode.

ARM template cross resource group deployment

Sometimes you need to deploy to different resource groups in one deployment. Till now you had to split-up you ARM template. With new API versions you can now deploy to multiple resource groups in one deployment:

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "StorageAccountName1": {
            "type": "string"
        },
        "StorageAccountName2": {
            "type": "string"
        }
    },
    "variables": {},
    "resources": [
        {
            "apiVersion": "2017-05-10",
            "name": "nestedTemplate",
            "type": "Microsoft.Resources/deployments",
            "resourceGroup": "crossResourceGroupDeployment",
            "properties": {
                "mode": "Incremental",
                "template": {
                    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
                    "contentVersion": "1.0.0.0",
                    "parameters": {},
                    "variables": {},
                    "resources": [
                        {
                            "type": "Microsoft.Storage/storageAccounts",
                            "name": "[parameters('StorageAccountName2')]",
                            "apiVersion": "2015-06-15",
                            "location": "West US",
                            "properties": {
                                "accountType": "Standard_LRS"
                            }
                        }
                    ]
                },
                "parameters": {}
            }
        },
        {
            "type": "Microsoft.Storage/storageAccounts",
            "name": "[parameters('StorageAccountName1')]",
            "apiVersion": "2015-06-15",
            "location": "West US",
            "properties": {
                "accountType": "Standard_LRS"
            }
        }
    ]
}

You can find this source code in Ryan Jones GitHub.