github.com/Azure/aad-pod-identity@v1.8.17/tutorial/scripts/3-deploy-demo/1-create-azure-id.sh (about)

     1  #!/bin/bash
     2  
     3  set -e
     4  
     5  set -x
     6  
     7  # had to create the identity in the generated RG
     8  # https://github.com/Azure/aad-pod-identity/issues/38
     9  # you will need to replace the resource group below with the correct name
    10  # you may need to look in the Azure Portal to find the correct name
    11  # or you can use the CLI with something like 
    12  # $az group list | grep 'k8s'
    13  
    14  if [ -z "$MC_RG" ]
    15  then
    16        echo "K8S Resource Group Name Not Set. Set the env variable with the following command:"
    17        echo "export MC_RG=\"resource-group-name\" "
    18        return 1
    19  fi
    20  
    21  if [ -z "$SUB_ID" ]
    22  then
    23        SUB_ID=$(az account show | jq -r .id)
    24        echo "Subscription ${SUB_ID} detected from environment"
    25  fi
    26  
    27  export principalid=$(az identity create --name demo-aad1 --resource-group $MC_RG --query 'principalId' -o tsv)
    28  az role assignment create --role Reader --assignee $principalid --scope /subscriptions/$SUB_ID/resourcegroups/$MC_RG