Skip to content

Commit a50138f

Browse files
fix: update post-deployment scripts to handle managed identity client ID
1 parent 349ffbf commit a50138f

3 files changed

Lines changed: 20 additions & 3 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,13 @@ jobs:
155155
az account set --subscription "${{ secrets.AZURE_SUBSCRIPTION_ID }}"
156156
157157
echo "Running post-deployment script..."
158-
bash ./infra/scripts/process_sample_data.sh \
158+
bash ./infra/scripts/copy_kb_files.sh \
159159
"${{ env.STORAGE_ACCOUNT_NAME }}" \
160160
"${{ env.STORAGE_CONTAINER_NAME }}" \
161+
"${{ secrets.AZURE_CLIENT_ID }}"
162+
bash ./infra/scripts/run_create_index_scripts.sh \
161163
"${{ env.KEY_VAULT_NAME }}" \
162-
"${{ env.COSMOSDB_ACCOUNT_NAME }}" \
163-
"${{ env.RESOURCE_GROUP_NAME }}" \
164+
"${{ secrets.AZURE_CLIENT_ID }}"
164165
165166
- name: Call Test Automation Workflow
166167
if: success()

infra/scripts/copy_kb_files.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ fi
2626

2727
echo "Getting signed in user id"
2828
signed_user_id=$(az ad signed-in-user show --query id -o tsv)
29+
if [ $? -ne 0 ]; then
30+
if [ -z "$managedIdentityClientId" ]; then
31+
echo "Error: Failed to get signed in user id."
32+
exit 1
33+
else
34+
signed_user_id=$managedIdentityClientId
35+
fi
36+
fi
2937

3038
echo "Getting storage account resource id"
3139
storage_account_resource_id=$(az storage account show --name $storageAccount --query id --output tsv)

infra/scripts/run_create_index_scripts.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ fi
2727

2828
echo "Getting signed in user id"
2929
signed_user_id=$(az ad signed-in-user show --query id -o tsv)
30+
if [ $? -ne 0 ]; then
31+
if [ -z "$managedIdentityClientId" ]; then
32+
echo "Error: Failed to get signed in user id."
33+
exit 1
34+
else
35+
signed_user_id=$managedIdentityClientId
36+
fi
37+
fi
3038

3139
# # Download the create_index and create table python files
3240
# curl --output "01_create_search_index.py" ${baseUrl}"infra/scripts/index_scripts/01_create_search_index.py"

0 commit comments

Comments
 (0)