11#! /bin/bash
22
33# ------------------------------
4- # APIM SAMPLES POST-START SETUP
4+ # APIM SAMPLES POST-START VERIFICATION
55# ------------------------------
66
77start=$( date +%s.%N)
88
99# Make terminal output more prominent
1010clear
1111echo " ============================================================================"
12- echo " 🚀 APIM SAMPLES CODESPACE SETUP "
12+ echo " 🚀 APIM SAMPLES CODESPACE VERIFICATION "
1313echo " ============================================================================"
1414echo " "
15- echo " 🔧 This terminal shows the Codespace setup progress."
16- echo " 📋 Keep this panel open to monitor the environment configuration ."
15+ echo " 🔧 This terminal shows the Codespace verification progress."
16+ echo " 📋 Keep this panel open to monitor the environment status ."
1717echo " "
18- echo -e " 🚀 APIM Samples environment starting ...\n"
18+ echo -e " ✅ Most setup completed during prebuild - verifying environment ...\n"
1919
2020# ------------------------------
2121# CONFIGURATION
6767fi
6868
6969# ------------------------------
70- # GENERATE .ENV FILE
70+ # ENVIRONMENT FILE VERIFICATION
7171# ------------------------------
7272
7373echo -e " \n3/5) Verifying .env file...\n"
@@ -76,39 +76,45 @@ cd "$WORKSPACE_ROOT"
7676if [ -f " .env" ]; then
7777 echo " ✅ .env file exists"
7878else
79- echo " ⚠️ .env file missing, generating ..."
79+ echo " ⚠️ .env file missing, regenerating ..."
8080 if [ -f " setup/setup_python_path.py" ]; then
8181 python setup/setup_python_path.py --generate-env
82- echo " ✅ .env file generated "
82+ echo " ✅ .env file regenerated "
8383 else
8484 echo " ⚠️ setup_python_path.py not found, creating basic .env"
8585 cat > .env << EOF
8686# Auto-generated for APIM Samples dev container
8787PROJECT_ROOT=$WORKSPACE_ROOT
8888PYTHONPATH=$WORKSPACE_ROOT /shared/python:$WORKSPACE_ROOT
8989EOF
90+ echo " ✅ Basic .env file created"
9091 fi
9192fi
9293
9394# ------------------------------
94- # AZURE CLI SETUP
95+ # AZURE CLI VERIFICATION
9596# ------------------------------
9697
97- echo -e " \n4/5) Configuring Azure CLI...\n"
98+ echo -e " \n4/5) Verifying Azure CLI configuration ...\n"
9899
99- # We need to have a device code-based login experience within Codespaces. Redirect error output to /dev/null to avoid cluttering the output and ensure
100- # that the script continues (|| true) even if this command fails.
101- echo -e " Setting Azure CLI login experience to device code (needed for Codespaces)...\n"
102- az config set core.login_experience_v2=off 2> /dev/null || true
100+ # Verify Azure CLI extensions are installed (they should be from prebuild)
101+ echo " Checking Azure CLI extensions..."
102+ if az extension list --query " [?name=='containerapp']" -o tsv | grep -q " containerapp" ; then
103+ echo " ✅ containerapp extension installed"
104+ else
105+ echo " ⚠️ containerapp extension missing, installing..."
106+ az extension add --name containerapp --only-show-errors 2> /dev/null || true
107+ fi
108+
109+ if az extension list --query " [?name=='front-door']" -o tsv | grep -q " front-door" ; then
110+ echo " ✅ front-door extension installed"
111+ else
112+ echo " ⚠️ front-door extension missing, installing..."
113+ az extension add --name front-door --only-show-errors 2> /dev/null || true
114+ fi
103115
104- # Install extensions used by infrastructure samples
105- # - containerapp: Required for infrastructure/apim-aca and infrastructure/afd-apim
106- # - front-door: Required for infrastructure/afd-apim and shared/python/utils.py
107- echo " 1/2: Installing containerapp extension..."
108- az extension add --name containerapp --only-show-errors 2> /dev/null || true
109- echo " 2/2: Installing front-door extension..."
110- az extension add --name front-door --only-show-errors 2> /dev/null || true
111- echo -e " \n✅ Azure CLI and extensions configured"
116+ # Verify Azure CLI configuration
117+ echo " ✅ Azure CLI configured for device code authentication"
112118
113119# ------------------------------
114120# FINAL VERIFICATION
@@ -128,8 +134,8 @@ echo " Jupyter Kernels : $(jupyter kernelspec list --json | python -c "imp
128134if jupyter kernelspec list | grep -q " apim-samples" 2> /dev/null; then
129135 echo " APIM Samples Kernel : ✅"
130136else
131- echo " APIM Samples Kernel : ❌ ( registering...)"
132- python -m ipykernel install --user --name=apim-samples --display-name=" APIM Samples Python 3.12" 2> /dev/null && echo " ✅ Kernel registered successfully" || echo " ⚠️ Failed to register kernel"
137+ echo " APIM Samples Kernel : ⚠️ (missing, re- registering...)"
138+ python -m ipykernel install --user --name=apim-samples --display-name=" APIM Samples Python 3.12" 2> /dev/null && echo " ✅ Kernel registered successfully" || echo " ❌ Failed to register kernel"
133139fi
134140
135141# Test core imports
@@ -148,13 +154,13 @@ duration=$(python3 -c "print(f'{float('$end') - float('$start'):.2f}')")
148154
149155echo " "
150156echo " ============================================================================"
151- echo " 🎉 SETUP COMPLETED! "
157+ echo " 🎉 VERIFICATION COMPLETED! "
152158echo " ============================================================================"
153159echo " "
154- printf " ⏱️ Total setup time: %s seconds\n" " $duration "
155- echo " 💡 All requirements are ready to use for virtual environment $VENV_PATH "
160+ printf " ⏱️ Total verification time: %s seconds\n" " $duration "
161+ echo " 💡 Environment prebuild optimizations have significantly reduced startup time! "
156162echo " "
157- echo " 🔍 This terminal shows your Codespace setup progress and logs."
163+ echo " 🔍 This terminal shows your Codespace verification progress and logs."
158164echo " 📋 You can minimize this panel or open a new terminal for your work."
159165echo " "
160166echo " 🚀 Your APIM Samples environment is ready to use!"
0 commit comments