|
| 1 | +# APIM Samples Codespaces Quickstart |
| 2 | + |
| 3 | +Welcome! Please follow these steps to get productive fast: |
| 4 | + |
| 5 | +1. [Authenticate with Azure](#-authenticate-with-azure) |
| 6 | + |
| 7 | +1. [Open notebooks and samples](#-work-with-notebooks-and-samples) |
| 8 | + |
| 9 | +1. [Use common developer workflows](#-common-developer-workflows) |
| 10 | + |
| 11 | +1. [Troubleshoot if anything looks off](#-troubleshooting-tips) |
| 12 | + |
| 13 | +--- |
| 14 | + |
| 15 | +## Environment verification (already done for you) |
| 16 | + |
| 17 | +The post-start script runs automatically and verifies that the virtual |
| 18 | +environment, `.env` file, Azure CLI, and Python are all present. Look for the |
| 19 | +first terminal tab titled **“APIM Samples Codespace Starting”** (or re-open the |
| 20 | +first terminal in VS Code); it shows the output from `.devcontainer/post-start-setup.sh`. |
| 21 | + |
| 22 | +If you ever want to rerun the verification manually, open a terminal and execute: |
| 23 | + |
| 24 | +```bash |
| 25 | +bash .devcontainer/post-start-setup.sh |
| 26 | +``` |
| 27 | + |
| 28 | +--- |
| 29 | + |
| 30 | +## Authenticate with Azure |
| 31 | + |
| 32 | +Use device login to make Azure CLI commands available inside the container. Run |
| 33 | +one of the following in a new terminal: |
| 34 | + |
| 35 | +```bash |
| 36 | +az login |
| 37 | +# or, specify a tenant explicitly |
| 38 | +az login --tenant <your-tenant-id> |
| 39 | +``` |
| 40 | + |
| 41 | +If you do not have Azure permissions, you can skip this step for local-only |
| 42 | +experiments. |
| 43 | + |
| 44 | +--- |
| 45 | + |
| 46 | +## Activate the virtual environment (if needed) |
| 47 | + |
| 48 | +Every new terminal automatically activates `.venv`. If you do not see the |
| 49 | +`(.venv)` prefix, run: |
| 50 | + |
| 51 | +```bash |
| 52 | +source .venv/bin/activate |
| 53 | +``` |
| 54 | + |
| 55 | +This ensures `python`, `pip`, and all tooling reference the prebuilt environment. |
| 56 | + |
| 57 | +--- |
| 58 | + |
| 59 | +## Run the verification script (optional) |
| 60 | + |
| 61 | +To double-check that everything is connected properly, execute: |
| 62 | + |
| 63 | +```bash |
| 64 | +python setup/verify_local_setup.py |
| 65 | +``` |
| 66 | + |
| 67 | +The script validates Azure CLI/Bicep, resource providers, and VS Code settings. |
| 68 | + |
| 69 | +--- |
| 70 | + |
| 71 | +## Work with notebooks and samples |
| 72 | + |
| 73 | +1. Open any notebook in `infrastructure/` or `samples/`. |
| 74 | +2. If prompted to pick a kernel, choose **Python (.venv)**. |
| 75 | +3. Execute cells as usual. |
| 76 | + |
| 77 | +Need guidance for individual samples? Each subfolder contains a README with |
| 78 | +deployment steps and policy details. |
| 79 | + |
| 80 | +--- |
| 81 | + |
| 82 | +## Common developer workflows |
| 83 | + |
| 84 | +| Task | Command | |
| 85 | +|------|---------| |
| 86 | +| Run tests | `pytest` or `tests/python/run_tests.sh` | |
| 87 | +| Run pylint | `tests/python/run_pylint.sh` | |
| 88 | +| Full quality checks | `tests/python/check_python.ps1` or `.sh` | |
| 89 | +| Generate `.env` again | `python setup/local_setup.py --generate-env` | |
| 90 | +| Launch environment setup | `python setup/local_setup.py --complete-setup` | |
| 91 | + |
| 92 | +--- |
| 93 | + |
| 94 | +## ℹ️ Troubleshooting Tips |
| 95 | + |
| 96 | +- **Extensions still installing?** Wait for the VS Code status bar to finish |
| 97 | + spinning. It can take a minute for Copilot and other extensions to activate. |
| 98 | +- **Something feels off?** Check `.devcontainer/post-start-setup.sh` for the |
| 99 | + exact commands the container runs on startup. |
| 100 | + |
| 101 | +--- |
| 102 | + |
| 103 | +Enjoy exploring the APIM Samples project! If you have ideas to improve this |
| 104 | +quickstart, open an issue or PR so that everyone may benefit. Thank you! |
0 commit comments