Paul K space : Azure Landing Zones - Uncut Special Collectors Edition

Taking inspiration from the recent Microsoft Blog Post “Azure Proof of Concept Guide for Developers”, this post is aiming to deliver you a few proof of concept “azure vending” services that connect your common business or user technology requests directly into automated and flexible versions of your manual processes

Landing Zone or Vending services I have encountered are often simplistic offering “basic” resource delivery, but also delivered to be executed by, for example. a GitHub Pull Request - which worked for your developers - but un-usable by HR.. running the real risk of actually making things worse by never transitioning and some users self-service requesting.

I am hoping to deliver a 1st class analysis if current process and aim to deliver a set of solid business functions

  • That accept, validate, deploy and manage services on behalf of a direct customer request

  • That the accepted request can be delivered in via either

    • Git process to add a new configuration file

    • HTTP call to a web-hook, including the request config

    • WebUI via a simple form that accepts all required fields and posts the request to the reposiutory_dispatch process

    • Slack or Teams integrations will be summarised

  • Delivered at the end complete - available from Github as a template repository

Uncut Special Collectors Edition - The Differences

Original Landing Zone

Collectors Edition

Fan Edits

00:00:00

The original landing zones are delivered in a GitHub repository and Branch Based integration of config files

The collectors edition offers the original format - enhanced with extended input operations by accepting web-hook calls into the repository - passing the config via json

This boiler-plate enhancement allows for custom entry points - and we include a webform POST request

Using the Collectors Edition enhancements as working examples, power users can build integrations using their preferred platform (slack, teams) and interface in the same way

For true integration, setup your existing management tools to call using web-hooks!

00:01:00 - inputs

The basic execution of the Azure Subscriptions Landing Zone was just that - the user prompted for a few values and submitting the request

The collectors edition really interacts with the user to offer a diverse range of options to compliment their request- collating the users requirements to deliver features that are - in some cases required to et going - in others, trying to deliver as much as possible with minimal fuss

Delivering the code as small add=ons that contain all their own variables etc. we start to deliver real value for the user - and they should be able to see the patterns and customise themselves - or possible deliver to the practice for integration

00:69:00 - Delivery

vchfgh

04:20:00 - Outputs

By pulling possible dependent resources into the optional features, we can start to remove the human element and outputs form inputs for the process

Everything here is in the proof of concept spirit of the MS Guide - we deliver to overcome technical challenges - until there are no barriers left - at which point we expect to cherry pick the code from Proof of Concept implementations, apply code quality standards and use chunks of our dynamic, flexible - we deliver engineering as a solution - and repeat.

For example - once we have solved a challenge of delivering a developer-customised azure solution, (a subscription and some resources), we should consider the “product”

  • What else will this service or product require -

  • What could compliment what we deliver - what works?

You’re solving the problem from first principles and then using the same model

  • Administrator would deliver a subscription for a developer

    • (blue star) he’ll probably do manual deploys first until he figures the process

    • (blue star) we can add a GitHub provider in - and if they want a repo, we deploy a repository

    • (blue star) we can ask if they want automated deployments - set up a service principal…

      • (blue star) we know the repo details and subscription details - so we can also deploy their own service principal - automatically setting up their Azure ARM credentials in the Repository Secrets

60% - propose a solution and keep thinking of what would help - how much effort can we save our customers using our platform?

15% - pseudo-code to actual code ensuring correct providers, dependencies, resources and variables being used

25% - destructive validation and testing


What is a proof of concept?

A proof of concept is a scoped, time-bound exercise with specific, measurable goals and
metrics of success. Ideally, it should have some basis in business reality so that the results are
meaningful.

Benefits of Proof of Concept Projects

A proof of concept project can be a valuable tool to evaluate whether a potential technology
or concept can be used to fulfil the requirements of a business solution. It can help identify
any potential technical and logistical issues before the service is implemented in a mainstream
project. In addition, it provides timely insights on the technology while mitigating risks by
allowing key decisions to be made in the early stages of the development process.
There are several benefits that proof of concept projects provide:


Experimenting with new technologies

As technologies evolve, proof of concept projects enable organisations to discover, learn
and experiment with groundbreaking technologies that can potentially be used in upcoming
projects. Under the guidelines of a well-scoped and time-framed execution, the development
team can quickly ramp up on new technology without posing risks to the company’s
mainstream large-scale projects. Best of all, the success of the proof of concept project
might be adapted in a mainstream project in the future. As a result, proof of concept projects
encourage innovation.

Minimising Risks

Prior to embarking on a high-risk, large-scale and potentially expensive project, it is a good
practice to minimise risks and costs by performing a quick validation of the parts of the
project that are considered risky. For example, a project teamq could identify and isolate a
particular technology used in a large-scale project, and flag it as risky due to the development
team’s inexperience with such technology. The project team can perform a quick feasibility
experimentation and assessment of said technology by scoping out a small sub-project with
a fixed budget and timeline. The risks are mitigated as proof of concept projects are typically
executed in a controlled and sandboxed environment.


Azure EA Subscription Creation

This module helps you to keep consistency on your resources names for Terraform The goal of this module it is that for each resource that requires a name in Terraform you would be easily able to compose this name using this module and this will keep the consistency in your repositories.

Usage

The module can either be called directly

module "azurerm_ea_subscription" {
    source="../"

    billing_account         = <value>
    enrollment_account      = <value> 

    owner                   = <value>
    email                   = <value>
    purpose                 = <value>
    alias                   = <value>

    # optional parameters
    apply_budget            = <value>
    management_group        = <value>

    create_service_principal = <value>
    service_principal_display_name = <value>
    
    create_automation_repo  = <value>
    github_username         = <value>
    template_repo_org       = <value>
    template_repo           = <value>
}

or, in a preferred configuration, by identifying config files in the subscription_configurations folder - each file iterated over to deliver a new subscription with all of the options as set in the <any_filename>.json files

locals {
    json_files = fileset(path.module, "subscription_configurations/*json")   
    json_data  = [ for f in local.json_files : jsondecode(file("${f}")) ]  
}


module "azurerm_ea_subscription" {
    source="../"

    for_each = { for f in local.json_data : f.owner => f }

    all_variables_as_above  = each.value.variable_name_from_config_file

}

Operating Guidance

  1. This terraform requires very high role assignments and should ony be operated by automation with all secret values from secret stores

  2. For each user, assuming all optional extra's are set to true, will

  • Identify the new subscription requestor in AD via their email address

  • Create a subscription under the supplied Billing Account and Enrolment account details provided

  • Add a subscription alias if provided

optionally

  • Assign the included budget and budget notification scheme

  • Assign the subscription into the supplied Management Group (if one is supplied)

  • Create a GitHub repository to store automation code for this subscription

  • Create a service principal to run automation from Github

  • Create the repository from either a supplied template repository, or if not, a blank repo

  • Pre-populate all the sensitive values for automation by storing the SP details in the Repository Secrets

  • Assigning appropriate roles for teh requester for all resources

Trigger by Web-hook

This repository can be triggered remotely for further integration with other systems

curl  -H "Authorization: token <token>" \\
      -H 'Accept: application/vnd.github.everest-preview+json' \\
      "<https://api.github.com/repos/<owner>/<repository_name>/dispatches"> 
      -d '{"event_type": "subscription-request", "client_payload": {"billing_account" : "87561154", "enrollment_account" : "311200","owner" : "paul.kelleher","email" : "paul.kelleher@contino.io","purpose" : "subscription_purpose","alias" : "subscription_alias","apply_budget" : true,"management_group" : "UK","create_automation_repo" : true,"github_username": "pknw1","template_repo_org" : "pknw1","template_repo" : "terraform-boilerplate","create_service_principal" : true,"service_principal_display_name" : "subscription_name_subscription"}}'

In sending the request and triggering the workflow, the POST body is stored as a subscription_configurations/*json file and can be committed either directly to main
and processed - or if some approvals were required, into a new branch with a PR

name: example-client-payload-action
on: 
  repository_dispatch:
    types: [subscription-request]
jobs:
  easub:
    name: EA Subscription
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - run: 'echo "field: ${{ github.event.client_payload.foo }}"'
      - run: 'echo "payload: ${{ toJson(github.event.client_payload) }}"'
      - run: echo baz
        if: github.event.action == 'baz'
      - run: 'echo "payload: ${{ toJson(github.event.client_payload) }}" > newfile.txt'
      - run: 'cat newfile.txt'

Terraform Init and Plan

 Terraform Apply

* Terraform Apply Recording