# set the value for the parameters resourceGroupName="rg-aks" location="westeurope" aksClusterName="tosokr" aksClusterNodeSize="Standard_DS1_v2" aksClusterNodeCount=2 # create the resource group az group create --name $resourceGroupName --location $location # create the service principle for the AKS servicePrinciplePassword=$(az ad sp create-for-rbac --skip-assignment --name myAKSClusterServicePrincipal --query password --output tsv) servicePrincipleId=$(az ad sp show --id http://myAKSClusterServicePrincipal --query appId --output tsv) # create the AKS cluster az aks create --resource-group $resourceGroupName --name $aksClusterName \ --node-count $aksClusterNodeCount --location $location \ --generate-ssh-keys --service-principal $servicePrincipleId \ --client-secret $servicePrinciplePassword --node-vm-size $aksClusterNodeSize \ --network-plugin azure # get the AKS resource group for the nodes and vnet name nodeResourceGroup=$(az aks show --resource-group rg-aks --name tosokr --query nodeResourceGroup --o tsv) vnetName=$(az network vnet list --query [].name --o tsv --resource-group $nodeResourceGroup) # create subnet for the ACI instances az network vnet subnet create \ --resource-group $nodeResourceGroup \ --vnet-name $vnetName \ --name aci-subnet \ --address-prefixes 10.241.0.0/16 # enable ACI connector on the AKS cluster az aks enable-addons --addons virtual-node \ --resource-group $resourceGroupName --name $aksClusterName \ --subnet-name aci-subnet # create subnet for Application Gateway az network vnet subnet create \ --name ag-subnet \ --resource-group $nodeResourceGroup \ --vnet-name $vnetName \ --address-prefix 10.242.0.0/27 # Create public IP address for Application Gateway az network public-ip create \ --resource-group $nodeResourceGroup \ --name myAGPublicIPAddress \ --allocation-method Static \ --sku Standard #Create the ApplicationGateway az network application-gateway create \ --name aksAppGateway \ --location $location \ --resource-group $nodeResourceGroup \ --capacity 1 \ --sku Standard_v2 \ --http-settings-cookie-based-affinity Enabled \ --public-ip-address myAGPublicIPAddress \ --vnet-name $vnetName \ --subnet ag-subnet # get the AKS credentials az aks get-credentials --resource-group $resourceGroupName --name $aksClusterName # get the subscriptionId subscriptionId=$(az account show --query id -o tsv) # create aad-pod-identity kubectl apply -f https://raw.githubusercontent.com/Azure/aad-pod-identity/master/deploy/infra/deployment-rbac.yaml # create an Azure identity azureIdentityId=$(az identity create -g $nodeResourceGroup -n azureIdentity --query id -o tsv) azureIdentityClientId=$(az identity show --ids $azureIdentityId --query clientId -o tsv) # install the Azure Identity into AKS cat <