Skip to content

Commit 5347792

Browse files
feat: add role assignment for signed-in user in copy_kb_files.sh
1 parent 6e613f4 commit 5347792

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

infra/scripts/copy_kb_files.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ else
4444
echo "Not authenticated with Azure. Attempting to authenticate..."
4545
fi
4646

47+
echo "Getting signed in user id"
48+
signed_user_id=$(az ad signed-in-user show --query id -o tsv)
49+
50+
echo "Getting storage account resource id"
51+
storage_account_resource_id=$(az storage account show --name $storageAccount --query id --output tsv)
52+
53+
# add Storage Blob Data Contributor role to the user
54+
az role assignment create --assignee $signed_user_id --role "Storage Blob Data Contributor" --scope /$storage_account_resource_id
4755

4856
# Using az storage blob upload-batch to upload files with managed identity authentication, as the az storage fs directory upload command is not working with managed identity authentication.
4957
echo "Uploading files to Azure Storage..."

0 commit comments

Comments
 (0)