az terraform git kubectl cheat sheet

To log in into the az module

az login

To List Available Subscriptions –

az account list -o table --all

you can see az login is going to a default subscription

To Set a Specific Subscription copy the subscription ID and set it.

az account set --subscription e08f63cf-xxxx-44e3-ba41-xxxxxxx

Creating a test resource group using az command in UAE north for example –

az group create -n $RESOURCEGROUP -l uaenorth

Login to test aks cluster for example

az aks get-credentials --admin --name akscluster --resource-group testaks

To get nodes / pods / describe the pod / get services

kubectl get nodes
kubectl get pods
kubectl describe pods
kubectl get services

Test asp net app YAML file with the integrated application gateway

 kubectl apply -f 

Yaml file backup

apiVersion: v1
kind: Pod
name: aspnetapp
app: aspnetapp
- image: ""
name: aspnetapp-image
- containerPort: 80
protocol: TCP


apiVersion: v1
kind: Service
name: aspnetapp
app: aspnetapp
- protocol: TCP
port: 80
targetPort: 80


apiVersion: extensions/v1beta1
kind: Ingress
name: aspnetapp
annotations: azure/application-gateway
- http:
- path: /
serviceName: aspnetapp
servicePort: 80

To get inside Pod

kubectl exec -it aspnetapp -- /bin/bash

To delete the pod

kubectl delete pods

az login via proxy


Git to work via proxy –

git config --global http.proxy

Initial Git Config

git config --global "Sathesh Manoharan"
git config --global

Terraform Init

Init – Run from ACF Folder – PS C:\repo\ACF> when your file is

terraform init .\Workloads\subs-conn-prod\infrastructure\1.0\

Plan from workspace folder – C:\repo\workspaces>

terraform plan -out plan.tfplan -var-file ..\ACF\Workloads\subs-prod\infrastructure\1.0\input_variables.tfvar ..\ACF\Workloads\subs-prod\infrastructure\1.0\

Git Sample commands –

git pull
git add * or git add.
git commit
git push

To use a remote state from local computer

terraform {
backend "azurerm" {
resource_group_name = "az-azure365pro-iac-rg"
storage_account_name = "azazure365proiacsta"
container_name = "subs-prod"
key = "infrastructure-sub-prod.tfstate"
access_key = "9qyXAiYxxxxxxxxxxxeirLlKBXCZ3PAlKnuXYYxxxxxxxxxxxxxSphy+pj6fCMP2QSLaDfmuY1f2T0BjgQ=="

Key Vault Secret Config using AZ commands

az keyvault secret set --vault-name az-azure365pro-tf-kv --name sp-client-id --value xxxxx-19e2-4b37-bd22-48d364a7ab80
az keyvault secret set --vault-name az-azure365pro-tf-kv --name sp-client-secret --value xxxxxxxx~~hKZMB6Wa0j0xxx.1OCts65
az keyvault secret set --vault-name az-azure365pro-tf-kv --name sp-tenant-id --value xxxxxxx-9352-4fa4-xxxx-112da2837c29
az keyvault secret set --vault-name az-azure365pro-tf-kv --name sp-subscription-id --value xxxxxx-b524-46f9-aa1a-3c583ee00d65</pre>

az keyvault secret set --vault-name az-azure365pro-tf-kv --name sp-key-1 --value xxxxxx-b524-46f9-aa1a-xxxxxxxxx
az keyvault secret set --vault-name az-azure365pro-tf-kv --name sp-key-2 –value xxxxxxxxxxxxxxxxxxxxMirqY58sJAdB0bwFLPogQt/95cWWPnbwnpCbYtUnvxMYJ+c/Q==

Storage Accounts Recommended Configuration –

  • Turn ON No Delete locks
  • Turn ON Versioning
  • Turn on Soft delete for 60 days
  • Turn on Point in time restore for containers

About Satheshwaran Manoharan

Satheshwaran Manoharan is an Microsoft Office Server and Services MVP , Publisher of Specialized in Office365 / Microsoft Exchange / Virtualization , Sathesh is an Messaging Expert supporting/Designing/Deploying many medium size businesses to large enterprises when it comes to Corporate messaging and Virtualization Infrastructure

Check Also

az Git Terraform configs to work behind Proxy

Let’s see how to configure proxy for az Git and Terraform behind an authenticated proxy …

Leave a Reply

Your email address will not be published.