Skip to content

Commit

Permalink
Use shell session to retrieve function app identity
Browse files Browse the repository at this point in the history
  • Loading branch information
ebronson68 committed Sep 17, 2024
1 parent 7ef0655 commit a0c8cc2
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions .github/workflows/azfunction-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -185,21 +185,19 @@ jobs:
- name: Get Azure Function Managed Identity
id: identity
uses: azure/cli@v2
with:
inlineScript: |
set -eu
if [[ "${{ inputs.environment }}" == "production" ]]; then
IDENTITY=$(az functionapp identity show \
-g "${{ inputs.AZURE_FUNCTIONAPP_RESOURCEGROUP }}" \
-n "${{ inputs.AZURE_FUNCTIONAPP_NAME }}" | tee)
else
IDENTITY=$(az functionapp identity show \
-g "${{ inputs.AZURE_FUNCTIONAPP_RESOURCEGROUP }}" \
-n "${{ inputs.AZURE_FUNCTIONAPP_NAME }}" \
--slot "${{ inputs.environment }}" | tee)
fi
echo "functionAppIdentity=$(echo $IDENTITY | jq -r '.principalId')" >> $GITHUB_ENV
run: |
set -eu
if [[ "${{ inputs.environment }}" == "production" ]]; then
IDENTITY=$(az functionapp identity show \
-g "${{ inputs.AZURE_FUNCTIONAPP_RESOURCEGROUP }}" \
-n "${{ inputs.AZURE_FUNCTIONAPP_NAME }}" | tee)
else
IDENTITY=$(az functionapp identity show \
-g "${{ inputs.AZURE_FUNCTIONAPP_RESOURCEGROUP }}" \
-n "${{ inputs.AZURE_FUNCTIONAPP_NAME }}" \
--slot "${{ inputs.environment }}" | tee)
fi
echo "functionAppIdentity=$(echo $IDENTITY | jq -r '.principalId')" >> $GITHUB_ENV
- name: Retrieve key vault name
uses: azure/cli@v2
Expand Down

0 comments on commit a0c8cc2

Please sign in to comment.