Example end-to-end Governance Model from CI/CD to Azure Resource Manager. Use this project to deploy example AAD, ARM and Azure DevOps resources to learn about e2e RBAC.
Перейти к файлу
Julie Ng 2078884fc9
fix(aad): provider must be specified. cd fails otherwise
2022-05-01 19:12:16 +02:00
.github chore(github-templates): remove not relevant bits from autogenerated templates 2020-08-28 09:25:55 +02:00
azure-pipelines feat(devops): mask tenant and user principal ids 2022-01-13 10:08:24 +01:00
backends fix(variables): make clearer why 2 admin object ID types needed. misc text adjustments 2022-05-01 15:29:31 +02:00
environments feat(tags): merge custom and default tags per environment 2022-05-01 15:35:32 +02:00
images docs(deploy): update to use microsoft graph api #49 2022-01-11 16:51:41 +01:00
modules fix(aad): provider must be specified. cd fails otherwise 2022-05-01 19:12:16 +02:00
.env.sample local-development: add .env example to set required Azure DevOps vars 2021-03-18 19:50:18 +01:00
.gitignore chore: rename backend config 2022-04-29 13:59:42 +02:00
.terraform.lock.hcl fix(providers): upgrade versions, esp. aad should fix various issues when creating new projects 2022-05-01 15:32:15 +02:00
.terraformignore key-vault: add access policy for superadmins AAD group 2020-11-20 16:00:49 +01:00
CHANGELOG.md chore(release): 0.4.0 2022-01-27 14:38:00 +01:00
CONTRIBUTING.md docs(contributing): update links and placeholders 2021-04-15 18:26:37 +02:00
DEPLOY.md Merge pull request #48 from Azure/feat/docs-env 2022-01-13 09:30:59 +01:00
LICENSE.md Initial LICENSE.md commit 2020-08-28 00:12:00 -07:00
README.md feat(concept): remove drafts, link to now published official AAC and CAF docs, closes #24 2021-06-14 12:49:01 +02:00
_override.tf.sample fix(variables): make clearer why 2 admin object ID types needed. misc text adjustments 2022-05-01 15:29:31 +02:00
local.auto.tfvars.example fix(variables): make clearer why 2 admin object ID types needed. misc text adjustments 2022-05-01 15:29:31 +02:00
main.tf fix(ado): prefer project id over name to prevent weird tf config drifts 2022-05-01 19:10:05 +02:00
outputs.tf fix(deploy): remove key vaults, reduce time by minutes 2022-05-01 19:08:40 +02:00
provider.tf fix(providers): upgrade versions, esp. aad should fix various issues when creating new projects 2022-05-01 15:32:15 +02:00
terraform.tfvars fix(ado): prefer project id over name to prevent weird tf config drifts 2022-05-01 19:10:05 +02:00
variables.tf feat(tags): merge custom and default tags per environment 2022-05-01 15:35:32 +02:00

README.md

Governance on Azure Demo - from DevOps to ARM

This demo project deploys Azure resources and bootstraps Azure DevOps projects to illustrate end-to-end RBAC, including best practices and pitfalls. It follows principles from Microsoft's Cloud Adoption Framework (CAF).

Status Description
CD - Build Status Deployment Azure Resources and Azure DevOps
Detect Drift - Build Status Detect Configuration Drift (scheduled nightly)

Contents

What is End to End Governance?

When developing a governance model for your organization, it is important to remember that Azure Resource Management (ARM) is only one way to manage resources.

End to End Governance

When introducing automation via CI/CD pipelines, be aware that the Role Based Access Control (RBAC) model must be applied at multiple layers. This code sample deploys many of these layers and show how they can be configured together in a unified governance model.

In a nutshell, you can achieve this by leveraging Azure Active Directory and connecting all role assignments (both Azure DevOps and ARM) to this single identity management plane.

Official Documentation

This repository features the code to deploy the infrastructure and bootstrap Azure DevOps. For more about the concept of end to end governance, please see:

Understanding this Demo

The Terraform Infrastructure as Code in this repository will bootstrap various resources for you:

  • Azure Resources (ARM)
  • Azure AD Groups
  • Service Principals
  • Azure DevOps Projects incl. Service Connections, Security Group Assignments, etc.

Random Generated Suffix

When run Terraform will create the following resources. Note: random suffix used to ensure globally unique names, e.g. u6t7 but are omitted here for clarity.

Azure AD Groups

The key to end to end governance is to have multiple role assignments (with different role definitions and different resource scopes to the same Azure AD groups) as illustrated below.

To understand the benefits, imagine if you had to remove a contractor after completion of a project. If you use the concept described in this project and in the accompanying official Microsoft documentation, you can remove their access from multiple environments and resources simply by removing their membership to AAD group(s).

Multiple Role Assignments

Note: the -all groups are currently not in use but was introduced to address a conceptual problem (see #12):

Group Name ARM Role Azure DevOps Role
fruits-all - -
fruits-devs Contributor Contributor
fruits-admins Owner Project Administrators
veggies-all - -
veggies-devs Contributor Contributor
veggies-admins Owner Project Administrators
infra-all - -
infra-devs Contributor Contributor
infra-admins Owner Project Administrators

In the future when we bootstrap the supermarket project, we will need the -all groups as well.

Azure DevOps Projects

The project structure illustrates different governance models and their trade-offs.

Preview of the Azure DevOps organization

Screenshot of the Azure DevOps organization created by this code sample. Icons by Smashicons not included.

  • "fruits" and "veggies" when isolated means less governance management - at the cost of less collaboration.
  • "supermarket" model prioritizes collaboration via shared Azure Boards - but requires more governance management, especially for repositories and pipelines.
Project Boards Repos Pipelines
project-fruits Yes Yes Yes
project-veggies Yes Yes Yes
collaboration Yes No No
central-it No Yes Yes
supermarket Yes Yes Yes

Azure Pipelines

  • Service Connection using Contributor Service Principal
  • Service Connection using Key Vault read-only Service Principal for Pipeline Secrets Integration

Note: At time of this writing there is no REST API (v6) for Key Vault Integration. Therefore it must be configured manually.

Azure Resource Groups as "Environments"

To reduce complexity for CI/CD automation of this open source repository, this project uses resource groups as a logical and security boundary for deployments.

  • fruits-dev-rg
  • fruits-prod-rg
  • veggies-dev-rg
  • veggies-prod-rg
  • infra-shared-rg

Be aware that in practice per Cloud Adoption Framework, these boundaries should be Azure Subscriptions, not Resource Groups.

Contributing

This demo was created with ♥ by the FastTrack engineer Julie Ng and based on previous experience as an Enterprise Architct and current experieince with Azure customers new to CI/CD and DevOps. After regularly breaking and fixing the demo in onboarding sessions, it was automated.

Learn more about FastTrack for Azure →

Code of Conduct

If you want to contribute, please first read the Microsoft Code of Conduct →

Bugs and Suggestions

The easiest way to contribute is to provide feedback.

Code Contributions

This project affects real Azure resources and leverages CI/CD to safeguard them. Therefore please read through all the sections below carefully for highest success of your contribution being accepted.

  • Use Conventional Commits

    Please use Conventional Commits so we can automate the Change Log. Thank you.

  • Create a Fork and Use small branches

    To get started, fork this repository. Please make your changes in your fork in a feature branch, ideally beginning with feat/* or fix/*

    Large Pull Requests can be a challenge to merge. Consider separating changes are you would into smaller bits like features and create separate pull requests for each.

  • Create a Pull Request

    Only Pull Requests with passing CI builds can be accepted for merging.

    When you are ready and checked you have met all code requirements described above, you can open a pull request. When you do so, a CI build should be automatically started. If you're having difficulty, please feel free to reach out for help by opening an issue or via Twitter @jng5.

License

This project is published under the MIT license. See LICENSE.md for details.