This guide provides guidelines regarding kubernetes cluster creation using Microsoft Azure with AKS (Azure Kubernetes Serviceopen in new window) with AAD (Azure Active Directory) using bash script automation.

Azure Kubernetes Cluster can be created in two ways:

  1. Bash
  2. Terraform


Following pre-requisite requirements must be fullfilled:

  • A domain on AWS (currently we use AWS domain to forward it to Azure AKS).

  • A Micorsoft Azure account with admin rights (needed to grant consent to server application)


If admin account is not available and you need to request admin consent for application permission, comment out the line 50 and uncomment the line 48 in bash/

Configuration & Deployment

  1. GitHub Repository to deploy AKS cluster can be found hereopen in new window. Clone it:

  2. Project has the following directory structure:

├── terraform/
│   └──
│   └──
│   └──
│   └──
│   └──
├── bash/
│   └── config
│   └──
│   └──
│   └──
  1. AKS with AAD cluster creation is automated using bash scripts. These bash scripts run according to the configuration provided in the config file. Set the following parameters in order to create the desired cluster.
usernameusername of the admin account
passwordpassword of the admin account
aksNameName of the AKS cluster to be created
resourceGroupName of ResourceGroup in which AKS Cluster is to be created
locationDesired location of the cluster e.g. eastus
locationNumber of nodes in the cluster
externalDnsNamespaceNamespace in which externaldns service is running global in our case
dnsResourceGroupResourceGroup for externaldns service externaldns in our case
dnsZoneNameDNS entry for Domain e.g.


Azure Kuberbetes Service with Azure Active Directory requires following steps:

  1. Move to the bash folder
cd bash/
  1. Edit the config file to setup the variables

  2. Make sure all three .sh files are executable

chmod 744 <file>
  1. Run by using the following command to start the deployment
bash ./
  1. After a while terminal will display this message:


Note the Nameservers and add it to the hosted zone in AWS. Hit any key to continue deployment.


Use the above Nameservers and add their values in the hosted zones.

  1. Following line will be displayed on the terminal to request the admin to consent to the permissions if the account being used is not an admin account. When the admin has consented to the permissions, Press any key to continue the deployment


Ask Administrator to consent on the Application Permissions

  1. When the deployment is done, it will ask the user to login using a web browser with a token. Use the token to login via web browser.


This guide provides guideline regarding kubernetes cluster creation using Terraformopen in new window

1. Pre-requisites


If admin account is not available and you need to request admin consent for application permission, the command terraform apply will fail. When it fails. Request the admin to consent for the Server Application, and run terraform apply again to complete the deployment

2. Configuration

All the configuration that is to be needed should be done in file. Edit the for the creation of desired cluster.

3. Deployment

  • Move to terraform folder
cd terraform/
  • Edit as per requirement.

  • Initialize Terraform

terraform init
  • Plan Terraform deployment. Remove errors if it shows any errors
terraform plan
  • Apply the changes
terraform apply


  1. When deployment is complete, use the following command on the terminal to start the proxy server:
kubectl proxy
  1. Open any browser and pas the URL given below to check whether cluster is deployed successfully or not: