This repository provides a set of scripts and Kubernetes manifests to fully automate the deployment of a production-ready Argo CD instance on Azure Kubernetes Service (AKS).
The goal is to solve the complex challenge of securing Argo CD in a corporate environment by integrating it with a centralized identity provider, eliminating secrets, and automating HTTPS. This setup ensures that all GitOps access is controlled, audited, and seamless for users.
Key Features:
- π Production-Grade Security: Deploys a hardened AKS cluster with local admin accounts disabled and administration managed via a dedicated Microsoft Entra ID group.
- π Secret-less SSO: Configures Single Sign-On with Microsoft Entra ID using the modern Workload Identity Federation, eliminating the need for client secrets or certificates.
- π Automated TLS: Uses NGINX and Cert-Manager to automatically provision and renew a valid TLS certificate from Let's Encrypt for your Argo CD instance.
- βοΈ Fully Automated: The entire process, from provisioning Azure infrastructure to configuring Argo CD, is handled by a series of easy-to-run shell scripts.
- π₯ Pre-configured RBAC: Sets up admin and read-only groups in Entra ID and maps them to the corresponding roles in Argo CD.
- β¨ Seamless User Experience: Pre-grants admin consent to the Entra ID application, so users have a smooth, no-prompt login experience from both the UI and the CLI.
- π§Ή Clean Uninstall: Includes a script to cleanly destroy all created Azure and Kubernetes resources.
Technology Stack: Azure AKS | Microsoft Entra ID | Argo CD | NGINX Ingress | Cert-Manager | Helm | Bash
The final setup includes:
- An AKS cluster with Workload Identity enabled.
- NGINX Ingress Controller for traffic management.
- Cert-Manager for automated TLS certificates via Let's Encrypt.
- Argo CD configured for secret-less Single Sign-On (SSO) with Microsoft Entra ID.
.
βββ README.md # This file
βββ LICENSE # Project license
βββ env.sh.example # Template for environment variables
βββ env.sh # Your configuration file (created from template)
βββ scripts/
β βββ 01-infra-setup.sh # Provisions Azure infrastructure (AKS, Entra ID)
β βββ 02-k8s-core-setup.sh # Installs Kubernetes components (Ingress, Cert-Manager, Argo CD)
β βββ 03-argocd-config.sh # Patches Argo CD ConfigMaps (Ingress, OIDC, RBAC)
β βββ uninstall.sh # Destroys all created resources
βββ manifests/
βββ argocd-cm.yaml.tpl # Template for Argo CD ConfigMap data
βββ argocd-ingress.yaml.tpl # Template for Argo CD Ingress
βββ argocd-rbac-cm.yaml.tpl # Template for Argo CD RBAC ConfigMap data
βββ letsencrypt-issuer.yaml.tpl # Template for Cert-Manager ClusterIssuer
-
Azure CLI: You must be logged in (
az login
). If you don't have it installed, use the platform-appropriate instructions below. After installation runaz login
.-
macOS (Homebrew):
brew update brew install azure-cli az version
-
Linux (Debian/Ubuntu):
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash az version
-
-
kubectl: The Kubernetes command-line tool. You can install
kubectl
directly, or install it via the Azure CLI helper which ensures the client matches your AKS version.-
macOS (Homebrew):
brew install kubectl kubectl version --client
-
Linux (Debian/Ubuntu) via Azure CLI:
sudo az aks install-cli
-
-
Helm: The Kubernetes package manager.
-
macOS (Homebrew):
brew install helm helm version
-
Linux (Debian/Ubuntu):
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | sudo bash helm version
-
-
envsubst: A command-line utility for substituting environment variables. It's available in the
gettext
package.- On macOS (via Homebrew):
brew install gettext
- On Debian/Ubuntu:
sudo apt-get update && sudo apt-get install gettext-base
- On macOS (via Homebrew):
-
Custom Domain: You need a domain name for which you can configure DNS records.
The deployment is broken down into three simple steps.
First, you must define your environment settings.
-
Make a copy of the environment variable template:
cp env.sh.example env.sh
-
Open the
env.sh
file in a text editor and replace all placeholder values with your specific configuration. Do not change the variable names.
Execute the scripts in sequential order.
-
Provision Azure Infrastructure: This script creates the AKS cluster and all necessary Entra ID objects. This step can take 10-15 minutes to complete.
bash ./scripts/01-infra-setup.sh
-
Install Kubernetes Components: This script uses Helm to install NGINX, Cert-Manager, and applies the Argo CD installation manifests.
bash ./scripts/02-k8s-core-setup.sh
After this script finishes, you will be prompted to create a DNS 'A' record. You must complete this manual DNS step before proceeding.
-
Configure Argo CD: This final script creates the Ingress for Argo CD, safely patches the existing Argo CD ConfigMaps with OIDC and RBAC settings, and restarts the server.
bash ./scripts/03-argocd-config.sh
After the final script completes successfully, your secure Argo CD instance will be available at the FQDN you configured.
- Log in to the UI: Navigate to
https://$ARGOCD_FQDN
in your browser. - Log in via CLI: Run
argocd login $ARGOCD_FQDN --sso --sso-launch-browser=false
. - Disable Local Admin: Once you have verified SSO is working, you can run the final command from
03-argocd-config.sh
to disable the localadmin
user.
kubectl patch cm argocd-cm -n ${ARGOCD_NAMESPACE} -p '{\"data\":{\"admin.enabled\":\"false\"}}' && kubectl rollout restart deployment argocd-server -n ${ARGOCD_NAMESPACE}
To destroy all resources created by these scripts (including the AKS cluster and Entra ID app registration), run the uninstall.sh
script.
- Run the uninstall script:
bash ./scripts/uninstall.sh