github.com/Azure/aad-pod-identity@v1.8.17/examples/rest-api/client/script.sh (about)

     1  #!/bin/sh
     2  
     3  echo "Hello ${RESOURCE}"
     4  
     5  i=0
     6  while true
     7  do
     8      echo "Iteration $i"
     9  
    10      jwt=$(curl -sS http://169.254.169.254/metadata/identity/oauth2/token/?resource=$RESOURCE)
    11      echo "Full token:  $jwt"
    12      token=$(echo $jwt | jq -r '.access_token')
    13      echo "Access token:  $token"
    14      curl -v -H 'Accept: application/json' -H "Authorization: Bearer ${token}" $SERVICE_URL
    15  
    16      i=$((i+1))
    17      sleep 1
    18  done