SHARE
TWEET

Untitled

a guest Jan 21st, 2020 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  version=$(az aks get-versions -l westeurope --query 'orchestrators[-1].orchestratorVersion' -o tsv)
  2.  
  3.  #!!!! use specific vesion instead
  4.  #  in Kubernetes 1.16 some api has been changed.
  5. version=1.13.11
  6.  
  7. AKS_RESOURCE_GROUP='aks'
  8. AKS_CLUSTER_NAME='jzscaks'
  9. ACR_NAME='jzsccr'
  10.  
  11. az group create --name $AKS_RESOURCE_GROUP --location westeurope
  12.  
  13.  az aks create --resource-group $AKS_RESOURCE_GROUP --name jzscaks --enable-addons monitoring --kubernetes-version $version --generate-ssh-keys --location westeurope
  14.  
  15.  az acr create --resource-group $AKS_RESOURCE_GROUP --name jzsccr --sku Standard --location westeurope
  16.  
  17.  
  18.  # Get the id of the service principal configured for AKS
  19.  CLIENT_ID=$(az aks show --resource-group $AKS_RESOURCE_GROUP --name $AKS_CLUSTER_NAME --query "servicePrincipalProfile.clientId" --output tsv)
  20.  
  21.  # Get the ACR registry resource id
  22.  ACR_ID=$(az acr show --name $ACR_NAME --resource-group $AKS_RESOURCE_GROUP --query "id" --output tsv)
  23.  
  24. # Create role assignment
  25. az role assignment create --assignee $CLIENT_ID --role acrpull --scope $ACR_ID
  26.  
  27. az sql server create -l westeurope -g $AKS_RESOURCE_GROUP -n jzcssql -u sqladmin -p P2ssw0rd1234
  28.  
  29. az sql db create -g $AKS_RESOURCE_GROUP -s jzcssql -n mhcdb --service-objective S0
  30.  
  31. #check sql db exists (imples sql server exists)
  32. az sql db list --server jzcssql --resource-group $AKS_RESOURCE_GROUP
  33.  
  34. #get the fully qualified domain name for sql server
  35. az sql server list  -g $AKS_RESOURCE_GROUP --query '[].fullyQualifiedDomainName' -o tsv
  36.     # jzcssql.database.windows.net
  37.  
  38. #get the container registry login server
  39. az acr list -g $AKS_RESOURCE_GROUP --query '[].loginServer' -o tsv
  40.     #jzsccr.azurecr.io
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top