/images/nasan-avatar.jpeg

(1/2) Setting up Azure workload identity federation with Terraform in Azure DevOps pipelines (2 Part Series)

I was curious about how to set up Azure DevOps to utilize Terraform for deploying Azure resources with workload identity federation instead of relying on a service principal with secrets. In this blog post, I will demonstrate how I set up this configuration.

To learn more about workload identity federation read the docs:
Workload identity federation - Microsoft Entra | Microsoft Learn

Prerequisites

  • Azure DevOps Org
  • “Customer Azure Tenant” with Subscription
  • “Backend Azure Tenant” with Subscription (can be in the same tenant - in our example we use different tenants)
  • Azure Powershell Module

Overview - Setup Steps

  1. Create a storage account that will store the Terraform state file
  2. Create a managed identity which has contributor permissions on this storage account
  3. If not already the case, install the Terraform extension for your Azure DevOps Org
  4. Create a new Azure DevOps Project
  5. Create a service connection to the “backend tenant” using workload identity federation with your previously created managed identity
  6. Create a managed identity in the customer tenant where you finally want to deploy Azure Resources using Terraform, with Contributor permission on the Subscription
  7. Create a service connection to the customer tenant using workload identity federation with your previously created managed identity
  8. Create a repository with basic Terraform files
  9. Create an Azure DevOps Pipeline

Read More

Securing Resources in Azure VMs with Microsoft Entra Private Access in a Hub-and-Spoke Architecture

I did a little Microsoft Entra Private Access Test setup.
My goal was to test access to some private Resources hosted on Azure Virtual Machines with Microsoft Entra Private Access instead of VPN.

Overview

The test setup is illustrated below:

/images/MicrosoftEntraPrivateAccess-AzurVM.drawio.png
Preview

I have one Virtual Machine (VM) with a Windows File Share that I wish to access from my endpoint and I also want to be able to access this VM via RDP.
Additionaly in another Spoke VNET I have a simple Web Server which I also would like to access via Private Access.

AzureAD App Registrations explained

Azure AD App registration

Recently I had some talks with developers which made me to realize that I didn’t fully understand how App Registrations are working. I was aware that we are registering an app and allowing the app certain permissions but in detail I didn’t understand it.

Why Azure AD App registration?

Basically for every app where you want to use the Microsoft Identity Platform, you need to register your app. So you want to login into a certain webapp with your Microsoft Account? This app needs to be registered in Azure AD. After you logged in into your application, this app maybe also need some data of your Microsoft Account and you maybe need to grant perrmissions.

SC-100 - Microsoft Certified Cybersecurity Architect Expert - MindMap Collection

Studying SC-100

In my recent self-study, I have been working through the Microsoft SC-100 learning path. One of the ways that I have been organizing and consolidating my learning is by creating mind maps of the key concepts and topics covered in the course.

You can find some of those mind maps below:

Design a Zero Trust strategy and architecture

Build an overall security strategy and architecture:

Read More

Stop Azure Backup for multiple SQL on Azure VM Databases with Powershell

link: https://learn.microsoft.com/en-us/azure/backup/backup-azure-sql-automation#stop-protection

I had a case where I did need to migrate a lot of databases from one SQL Server on a Azure VM to another VM. After the successful migration there were a lot of old databases on the “old SQL Server” offline and I got a lot of Azure Backup Alerts. Because I was to lazy to disable the backup for each database by hand, I created the following small script which will do that job.

Azure - Create a Custom RBAC Role to allow Stop - Start of all Azure Virtual Machines in a Subscription with Terraform

Yes… its annoying there is no built in role to only allow restarting of Azure Virtual Machines… The Virtual Machine Contributor Role allows to much. With this role you are able to destory and create VMs..

So what I want to do in this case is creating a custom role which only allows to start / stop / restart Virtual Machines. And I want to do that with terraform because I’m doing the whole Azure Resource Deployment with terraform anyway.