Skip to content

Commit

Permalink
Add to azure role script too
Browse files Browse the repository at this point in the history
  • Loading branch information
pamelafox committed Oct 23, 2024
1 parent 99ea134 commit 8bed0c8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion scripts/setup_postgres_azurerole.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ if (-not $?) {
}
$POSTGRES_USERNAME = (azd env get-value POSTGRES_USERNAME)
$APP_IDENTITY_NAME = (azd env get-value SERVICE_WEB_IDENTITY_NAME)
$AZURE_TENANT_ID = (azd env get-value AZURE_TENANT_ID)

if ([string]::IsNullOrEmpty($POSTGRES_HOST) -or [string]::IsNullOrEmpty($POSTGRES_USERNAME) -or [string]::IsNullOrEmpty($APP_IDENTITY_NAME)) {
Write-Host "Can't find POSTGRES_HOST, POSTGRES_USERNAME, and SERVICE_WEB_IDENTITY_NAME environment variables. Make sure you run azd up first."
exit 1
}

python ./src/backend/fastapi_app/setup_postgres_azurerole.py --host $POSTGRES_HOST --username $POSTGRES_USERNAME --app-identity-name $APP_IDENTITY_NAME
python ./src/backend/fastapi_app/setup_postgres_azurerole.py --host $POSTGRES_HOST --username $POSTGRES_USERNAME --app-identity-name $APP_IDENTITY_NAME --sslmode require --tenant-id $AZURE_TENANT_ID
3 changes: 2 additions & 1 deletion scripts/setup_postgres_azurerole.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ if [ $? -ne 0 ]; then
fi
POSTGRES_USERNAME=$(azd env get-value POSTGRES_USERNAME)
APP_IDENTITY_NAME=$(azd env get-value SERVICE_WEB_IDENTITY_NAME)
AZURE_TENANT_ID=$(azd env get-value AZURE_TENANT_ID)

if [ -z "$POSTGRES_HOST" ] || [ -z "$POSTGRES_USERNAME" ] || [ -z "$APP_IDENTITY_NAME" ]; then
echo "Can't find POSTGRES_HOST, POSTGRES_USERNAME, and SERVICE_WEB_IDENTITY_NAME environment variables. Make sure you run azd up first."
Expand All @@ -13,4 +14,4 @@ fi

. ./scripts/load_python_env.sh

.venv/bin/python ./src/backend/fastapi_app/setup_postgres_azurerole.py --host $POSTGRES_HOST --username $POSTGRES_USERNAME --app-identity-name $APP_IDENTITY_NAME
.venv/bin/python ./src/backend/fastapi_app/setup_postgres_azurerole.py --host $POSTGRES_HOST --username $POSTGRES_USERNAME --app-identity-name $APP_IDENTITY_NAME --sslmode require --tenant-id $AZURE_TENANT_ID

0 comments on commit 8bed0c8

Please sign in to comment.