Skip to content

Commit

Permalink
Merge pull request #259 from marlenezw/ignite2024
Browse files Browse the repository at this point in the history
adding blob storage in post provision.
  • Loading branch information
marlenezw authored Nov 13, 2024
2 parents fad663c + a0e9d0a commit 0d3b413
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions infra/hooks/postprovision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ resourceGroupName=$AZURE_RESOURCE_GROUP
searchService=$AZURE_SEARCH_NAME
openAiService=$AZURE_OPENAI_NAME
subscriptionId=$AZURE_SUBSCRIPTION_ID
runningonGH=$GITHUB_ACTIONS

# Ensure all required environment variables are set
if [ -z "$resourceGroupName" ] || [ -z "$searchService" ] || [ -z "$openAiService" ] || [ -z "$subscriptionId" ]; then
Expand All @@ -18,6 +19,21 @@ if [ -z "$resourceGroupName" ] || [ -z "$searchService" ] || [ -z "$openAiServic
exit 1
fi

PRINCIPAL_ID=$(az ad signed-in-user show --query id -o tsv)

#adding blob storage role
if [ "$runningonGH" ]; then
principleType='ServicePrincipal'
else
principleType='User'
fi

az role assignment create \
--role "Storage Blob Data Contributor" \
--scope /subscriptions/"${AZURE_SUBSCRIPTION_ID}"/resourceGroups/"${AZURE_OPENAI_RESOURCE_GROUP}" \
--assignee-principal-type "$principleType" \
--assignee-object-id "${PRINCIPAL_ID}"

# Set additional environment variables expected by app
# TODO: Standardize these and remove need for setting here
azd env set AZURE_OPENAI_API_VERSION 2023-03-15-preview
Expand Down

0 comments on commit 0d3b413

Please sign in to comment.