Skip to content

Commit afbe70c

Browse files
authored
Improvements to load balancer setup script (#1348)
* Script fixes * Script fixes * Update scripts/load-balance-aca-setup.sh
1 parent 62bdbdb commit afbe70c

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

scripts/load-balance-aca-setup.sh

100644100755
Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
#!/bin/sh
22

3-
# To set up AZD environment variabless
3+
# To set up AZD environment variabless
44
# for use with ACA load balancer https://github.com/Azure-Samples/openai-aca-lb
5-
#
6-
# Prereq: az login --use-device-code
7-
# Example usage: bash load-balance-aca-setup.sh <ACA-LB-RESOURCE-GROUP-NAME> <ACA-LB-CONTAINER-APP-URI>
85

6+
# Fill in your resource group name and container app name:
97
resourceGroupName="your-resource-group-name"
108
containerAppName="your-container-app-name"
119

10+
if [ -z "$(az account show)" ]; then
11+
echo "You are not logged in. Please run 'az login' or 'az login --use-device-code' first."
12+
exit 1
13+
fi
14+
15+
echo "Running provisioning using this subscription:"
16+
az account show --query "{subscriptionId:id, name:name}"
17+
echo "If that is not the correct subscription, please run 'az account set --subscription \"<SUBSCRIPTION-NAME>\"'"
18+
1219
# Check if resourceGroupName is empty
1320
if [ -z "$resourceGroupName" ]; then
1421
echo "Error: resourceGroupName is empty"
@@ -21,7 +28,8 @@ if [ -z "$containerAppName" ]; then
2128
exit 1
2229
fi
2330

24-
fqdn=$(az container show --name $containerAppName --resource-group $resourceGroupName --query ipAddress.fqdn --output tsv)
31+
fqdn=$(az containerapp show --name $containerAppName --resource-group $resourceGroupName --query properties.configuration.ingress.fqdn --output tsv)
32+
fqdn="https://$fqdn"
2533

2634
# Check if fqdn is empty
2735
if [ -z "$fqdn" ]; then
@@ -31,4 +39,4 @@ fi
3139

3240
azd env set OPENAI_HOST azure_custom
3341
azd env set AZURE_OPENAI_CUSTOM_URL $fqdn
34-
42+
echo "Successfully set OPENAI_HOST to azure_custom and AZURE_OPENAI_CUSTOM_URL to $fqdn"

0 commit comments

Comments
 (0)