Posts

Showing posts from September, 2017

Setting VSTS variables from PowerShell

Image
I was using a VSTS release pipeline to build an Azure environment today with ARM Templates, and needed to set up a secure connection from a Web App to a Blob Storage account so the app could write logs. As with a lot of things in ARM, you can set up the connection and grab the template, but then you end up having a fixed access URL (SAS URL, or Shared Access Signature) in your JSON file:



This is bad from a portability and security point of view, as the URL only gives access to one named account, but if you have that URL you can write whatever you want to storage. This URL will also expire in around a year's time - which will mean your site suddenly stops working like it used to!  That'll be an fun and interesting day.

Fortunately its easy to create a SAS URL and pass it to a script as a parameter.  This PowerShell will create the access token:

$rg = "my-storage-resource-group"
$name = "mystorageaccount"


$key = ((Get-AzureRmStorageAccountKey -ResourceGroupNam…

Feature Toggles on a .Net Core API

This is my second tutorial on feature toggling.  You can read the first here.

There are many languages and frameworks to choose from when it comes to back ends - I wanted to make a REST service to deliver all of the Time Entries to my Angular application, and almost every language available has REST server capabilities.  I chose to use .Net Core (C#) and Java for my example app.  My background is in Java, and I was really interested to see how .Net Core works.  If you don't know, .Net Core is Microsoft's cross platform offering - it has the Windows-specific parts taken out and runs on Docker. Linux, MacOSX, and of course Windows too.  It can also be compiled on other platforms too, which is very handy.

Today I'll be setting up LaunchDarkly using the .Net libraries - I'll do the Java version later on.  LaunchDarkly provides some samples to help you get started, but I wanted to change a few things.  Just like I did in the Angular front end, I wanted to use a type to repr…

Feature Toggles for Angular UIs

Image
I had a chance to demonstrate a feature toggling library to a customer last week, and wanted to share what I did.  Feature toggles, in case you don't know, let you to configure how your system behaves without redeploying code.  This is fantastic if you have a feature that needs to launch at a particular time, or you want to experiment with by switching off and on in different environments.  Feature toggles act like an if statement around a code of block and can be switched on or off as desired, without requiring a restart.  Martin Fowler covers this in some detail here.

Filling out my timesheet is one of the least favourite parts of my week, but I thought I would build a simple timesheeting system for my demo.  I have a UI written in Angular using the Angular Seed project and the Angular Material components.  The basic UI looks like this:

I am working on a couple of features that aren't quite ready yet - being able to add and remove time entries, and to look up projects.  To p…

Automatically Logging PowerShell in to Azure

Image
I've been working with Azure Resource Manager templates a lot lately, as an easy, repeatable way to create deployment environments for my code.  ARM templates are a JSON description of a resource or grouping of resources and can be applied to create or update an environment.  This means you can roll out a new environment quickly and easily - perfect for quickly setting up a Dev or Test system, and you know that if you use the same templates to configure Production you won't have any surprises, or "Well, it worked in Dev..." conversations.
The best thing about ARM templates for me is how easy it is to generate them.  If you have a resource group, you can create a template by clicking on the Automation Script button:


This will create a show you a JSON template and supporting files that can be downloaded as a Zip.  It contains all the information needed to reproduce your resource group's infrastructure.  It isn't a backup though - it doesn't have the website…