ci: query identity directly instead of searching in list

This commit is contained in:
Markus Rudy 2024-03-14 10:50:21 +01:00
parent 5684108eb0
commit c8cfb25008

View File

@ -40,10 +40,10 @@ runs:
if: inputs.cloudProvider == 'azure'
shell: bash
run: |
UAMI=$(yq eval ".provider.azure.userAssignedIdentity | upcase" constellation-conf.yaml)
PRINCIPAL_ID=$(az identity list | yq ".[] | select(.id | test(\"(?i)$UAMI\"; \"g\")) | .principalId")
UAMI=$(yq eval ".provider.azure.userAssignedIdentity" constellation-conf.yaml)
PRINCIPAL_ID=$(az identity show --ids "$UAMI" | yq ".principalId")
if [ -z "$PRINCIPAL_ID" ]; then
echo "::error::PRINCIPAL_ID for $UAMI not found"
echo "::error::PRINCIPAL_ID for \"$UAMI\" not found"
echo "::group::Available identities"
az identity list | yq ".[].id"
echo "::endgroup::"