Skip to content

Commit

Permalink
add RG to the query
Browse files Browse the repository at this point in the history
  • Loading branch information
xpillons committed Mar 2, 2022
1 parent 092ce03 commit d0c89d3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,11 @@ else
export clientId=$(az account show --query user.name -o tsv)
case "${clientId}" in
"systemAssignedIdentity")
vmname=$(curl -s --noproxy "*" -H Metadata:true "http://169.254.169.254/metadata/instance?api-version=2019-08-15" | jq -r '.compute.name')
echo " - logged in Azure with System Assigned Identity from ${vmname}"
export TF_VAR_logged_user_objectId=$(az resource list -n $vmname --query [*].identity.principalId --out tsv)
mds=$(curl -s --noproxy "*" -H Metadata:true "http://169.254.169.254/metadata/instance?api-version=2019-08-15")
vmname=$(echo $mds | jq -r '.compute.name')
rgname=$(echo $mds | jq -r '.compute.resourceGroupName')
echo " - logged in Azure with System Assigned Identity from ${vmname}/${rgname}"
export TF_VAR_logged_user_objectId=$(az resource list -n $vmname -g $rgname --query [*].identity.principalId --out tsv)
export ARM_TENANT_ID=${TF_VAR_tenant_id}
export ARM_SUBSCRIPTION_ID=${subscription_id}
export ARM_USE_MSI=true
Expand Down

0 comments on commit d0c89d3

Please sign in to comment.