-
Notifications
You must be signed in to change notification settings - Fork 1
/
Step-DevSecOps.azcli
49 lines (32 loc) · 1.35 KB
/
Step-DevSecOps.azcli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Create cluster
location="westeurope"
# Get latest AKS version
version=$(az aks get-versions -l $location --query 'orchestrators[-1].orchestratorVersion' -o tsv)
echo $version
# Prepare group
group=event-comp-aks
az group create --name $group --location $location
name=event-comp-01
# Create AKS Cluster
az aks create --resource-group $group \
--name $name \
--location $location \
--kubernetes-version $version \
--generate-ssh-keys \
--load-balancer-sku basic \
# Connect to AKS Cluster with kubectl
az aks get-credentials --resource-group $group --name $name
# Create ACR
export ACR_NAME=eventmatperdevsecops${RANDOM}$$; echo $ACR_NAME
az acr create --resource-group $group --name $ACR_NAME --sku Standard
ACR_NAME=eventmatperdevsecops25746104
#Grant AKS access to Azure Container Registry
CLIENT_ID=$(az aks show --resource-group $group --name $name --query "servicePrincipalProfile.clientId" --output tsv)
ACR_ID=$(az acr show --name $ACR_NAME --resource-group $group --query "id" --output tsv)
az role assignment create --assignee $CLIENT_ID --role acrpull --scope $ACR_ID
##################
kubectl create ns aqua-security
kubectl create -n aqua-security -f aqua-sa.yaml
kubectl create -n aqua-security -f aqua-csp.yaml
kubectl get svc -n aqua-security -w
# connect via browser :8080