Skip to content
This repository was archived by the owner on Oct 14, 2023. It is now read-only.

Commit 304cdb3

Browse files
author
Yoichi Kawasaki
committed
Refactors helper scripts
1 parent 2e764aa commit 304cdb3

File tree

3 files changed

+27
-12
lines changed

3 files changed

+27
-12
lines changed

scripts/docker-run-mini.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ expr "$0" : "/.*" > /dev/null || cwd=`(cd "$cwd" && pwd)`
99
#############################################################
1010
DOCKER_ID="<Docker ID>"
1111
CONTAINER_IMAGE_NAME="<Container Image Name>"
12+
RESOURCE_GROUP="<RESOURCE GROUP>"
13+
STORAGE_ACCOUNT_NAME="<STORAGE ACCOUNT NAME>"
1214
#############################################################
1315

1416
FUNC_PROJECT_DIR="$cwd/../v2functions"
@@ -21,5 +23,4 @@ STORAGE_CONNECTION_STRING=$(az storage account show-connection-string \
2123

2224
docker run -p 8080:80 -it \
2325
-e AzureWebJobsStorage="$STORAGE_CONNECTION_STRING" \
24-
-e MyStorageConnectionString="$STORAGE_CONNECTION_STRING"
2526
$DOCKER_ID/$CONTAINER_IMAGE_NAME:$TAG

scripts/docker-run.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@ RESOURCE_GROUP="<RESOURCE GROUPP MAME>"
1313
REGION="<REGION NAME: eastus>"
1414
STORAGE_ACCOUNT_NAME="<STORAGE ACCOUNT NAME>"
1515
COSMOSDB_ACCOUNT_NAME="<COSMOSDB ACCOUNT NAME>"
16-
COMPUTER_VSION_API_SUBSCRIPTION="<COMPUTER VISION API SUBSCRIPTION>"
17-
COMPUTER_VSION_API_ENDPOINT="<COMPUTER VSION API ENDPOINT>"
18-
## example: COMPUTER_VSION_API_ENDPOINT="https://westus.api.cognitive.microsoft.com/"
16+
COGNITIVE_ACCOUNT_NAME="<COGNITIVE ACCOUNT NAME>"
17+
COGNITIVE_RESOURCE_GROUP="<COGNITIVE RESOURCE GROUP>"
1918
#############################################################
2019

21-
FUNC_PROJECT_DIR="$cwd/../v2functions.working"
20+
FUNC_PROJECT_DIR="$cwd/../v2functions"
2221

2322
TAG=`cat $FUNC_PROJECT_DIR/VERSION`
2423

@@ -29,6 +28,13 @@ COSMOSDB_CONNECTION_STRING=$(az cosmosdb list-connection-strings \
2928
--resource-group $RESOURCE_GROUP --name $COSMOSDB_ACCOUNT_NAME \
3029
--query connectionStrings --output tsv | head -1 | awk '{print $1}')
3130

31+
COMPUTER_VSION_API_ENDPOINT=$(az cognitiveservices account show \
32+
-n $COGNITIVE_ACCOUNT_NAME -g $COGNITIVE_RESOURCE_GROUP --output tsv |awk '{print $1}')
33+
34+
COMPUTER_VSION_API_SUBSCRIPTION=$(az cognitiveservices account keys list \
35+
-n $COGNITIVE_ACCOUNT_NAME -g $COGNITIVE_RESOURCE_GROUP --output tsv |awk '{print $1}')
36+
37+
3238
docker run -p 8080:80 -it \
3339
-e AzureWebJobsStorage="$STORAGE_CONNECTION_STRING" \
3440
-e MyStorageConnectionString="$STORAGE_CONNECTION_STRING" \

scripts/update-azfunc-app-settings.sh

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,26 @@
22
set -e -x
33

44
RESOURCE_GROUP="<RESOURCE GROUPP MAME>"
5-
APP_NAME="<FUNCTION APP NAME>" # the name needs to be unique across all apps in Azure.
5+
APP_NAME="<FUNCTION APP NAME>"
66
STORAGE_ACCOUNT_NAME="<STORAGE ACCOUNT NAME>"
77
COSMOSDB_ACCOUNT_NAME="<COSMOSDB ACCOUNT NAME>"
88
COGNITIVE_ACCOUNT_NAME="<COGNITIVE ACCOUNT NAME>"
99
COGNITIVE_RESOURCE_GROUP="<COGNITIVE RESOURCE GROUP>"
1010

11-
STORAGE_ACCOUNT_KEY=$(az storage account keys list --account-name $STORAGE_ACCOUNT_NAME --resource-group $RESOURCE_GROUP --output tsv |head -1 | awk '{print $3}')
12-
COSMOSDB_ACCOUNT_KEY=$(az cosmosdb list-keys --name $COSMOSDB_ACCOUNT_NAME --resource-group $RESOURCE_GROUP --output tsv |awk '{print $1}')
13-
MY_STORAGE_CONNECTION="DefaultEndpointsProtocol=https;AccountName=$STORAGE_ACCOUNT_NAME;AccountKey=$STORAGE_ACCOUNT_KEY;EndpointSuffix=core.windows.net"
14-
MY_COSMOS_DB_CONNECTION="AccountEndpoint=https://$COSMOSDB_ACCOUNT_NAME.documents.azure.com:443/;AccountKey=$COSMOSDB_ACCOUNT_KEY;"
15-
MY_COMPUTER_VISION_ENDPOINT=$(az cognitiveservices account show -n $COGNITIVE_ACCOUNT_NAME -g $COGNITIVE_RESOURCE_GROUP --output tsv |awk '{print $1}')
16-
MY_COMPUTER_VISION_APIKEY=$(az cognitiveservices account keys list -n $COGNITIVE_ACCOUNT_NAME -g $COGNITIVE_RESOURCE_GROUP --output tsv |awk '{print $1}')
11+
12+
STORAGE_CONNECTION_STRING=$(az storage account show-connection-string \
13+
--resource-group $RESOURCE_GROUP --name $STORAGE_ACCOUNT_NAME \
14+
--query connectionString --output tsv)
15+
16+
COSMOSDB_CONNECTION_STRING=$(az cosmosdb list-connection-strings \
17+
--resource-group $RESOURCE_GROUP --name $COSMOSDB_ACCOUNT_NAME \
18+
--query connectionStrings --output tsv | head -1 | awk '{print $1}')
19+
20+
COMPUTER_VSION_API_ENDPOINT=$(az cognitiveservices account show \
21+
-n $COGNITIVE_ACCOUNT_NAME -g $COGNITIVE_RESOURCE_GROUP --output tsv |awk '{print $1}')
22+
23+
COMPUTER_VSION_API_SUBSCRIPTION=$(az cognitiveservices account keys list \
24+
-n $COGNITIVE_ACCOUNT_NAME -g $COGNITIVE_RESOURCE_GROUP --output tsv |awk '{print $1}')
1725

1826
az webapp config appsettings set \
1927
-n $APP_NAME \

0 commit comments

Comments
 (0)