Learn only the Python you need for Microsoft AI-102 labs β 6 Jupyter Notebooks covering foundations to Azure SDK patterns. Free & open-source.
Microsoft's AI-102: Designing and Implementing a Microsoft Azure AI Solution labs are now Python-only. Students who are new to Python often struggle to follow the lab code β not because of the AI concepts, but because they can't read the Python.
This course bridges that gap. It teaches only the Python you need to confidently read, understand, and modify code in AI-102 lab exercises. No fluff β every example connects directly to patterns found in the official Microsoft Learning GitHub repositories.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
β Student with This Course Ready for β
β no Python ββββββββββββββββββββββββΊ AI-102 Labs β
β experience (6 hours) β
β β
β βββββββββββββββββββββββ β
β β Python Basics β β
β β Data Structures β β
β β Functions & Modulesβ β
β β Files & Config β β
β β REST APIs β β
β β Azure AI Patterns β β
β βββββββββββββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Audience | Benefit |
|---|---|
| π Students new to Python | Learn Python through AI-102 relevant examples |
| π§βπ« MCT / Trainers | Ready-made 6-hour pre-course module |
| πΌ IT Pros switching to AI | Quick ramp-up before certification prep |
| π C# developers | Understand Python equivalents for AI-102 labs |
python-for-ai102/
β
βββ π 01_Python_Foundations.ipynb β Notebook 1
βββ π 02_Data_Structures.ipynb β Notebook 2
βββ π 03_Functions_Modules_ErrorHandling.ipynb β Notebook 3
βββ π 04_Files_JSON_DotEnv.ipynb β Notebook 4
βββ π 05_REST_APIs.ipynb β Notebook 5
βββ π 06_Complete_AI102_Pattern.ipynb β Notebook 6
β
βββ π requirements.txt β All Python packages needed
βββ π .env.example β Sample environment variables template
βββ π README.md β You are here
"Before you can talk to Azure AI, you need to speak Python."
| Topic | AI-102 Relevance |
|---|---|
print() function |
Display API responses, debug output |
| Variables & assignment | Store endpoints, API keys, results |
Data types (str, int, float, bool) |
Understand what kind of data you're working with |
| String operations | URL building, text manipulation |
| f-strings (formatted strings) | Used in every single AI-102 lab |
input() |
Interactive labs that take user text |
| Basic arithmetic | Confidence scores, percentages |
| Comments | Reading lab code annotations |
"Azure AI responses are lists of dictionaries. Master these two, and you can parse anything."
| Topic | AI-102 Relevance |
|---|---|
Lists [] |
Collections of entities, phrases, objects |
| Indexing & slicing | Access specific results |
for loops |
Process each item in a response |
enumerate() |
Loop with position tracking |
Dictionaries {} |
JSON responses map directly to dicts |
.get() safe access |
Avoid crashes on missing keys |
| Nested structures | Navigate real API response trees |
| List comprehensions | Filter results concisely |
"AI-102 labs organize code into functions β and always wrap API calls in try/except."
| Topic | AI-102 Relevance |
|---|---|
Defining functions (def) |
Every lab has functions like analyze_text() |
| Parameters & return values | Pass text in, get results back |
| Default parameters | Optional settings like language="en" |
if/elif/else |
Handle different sentiments, check thresholds |
while loops |
Continuous input loops in labs |
import statements |
Load Azure SDKs and utilities |
os module |
Environment variables, file paths |
json module |
Parse API responses |
try/except/finally |
Graceful error handling |
"Every AI-102 lab starts by loading a .env file. Every response is JSON. Every Vision lab reads an image file."
| Topic | AI-102 Relevance |
|---|---|
| Reading text files | Analyze reviews, documents |
| Writing files | Save results |
.env file pattern |
Store API keys securely |
load_dotenv() + os.getenv() |
The first 3 lines of every lab |
json.load() / json.dump() |
Read/write JSON config & results |
json.loads() / json.dumps() |
Parse API response strings |
Binary file reading ("rb") |
Send images to Vision API |
os.listdir() + os.path.join() |
Batch-process files in a folder |
"At the heart of every Azure AI service is a REST API. Learn the request-response cycle."
| Topic | AI-102 Relevance |
|---|---|
| HTTP methods (GET, POST) | POST data for analysis, GET results |
| Request anatomy (URL, headers, body) | Build complete API requests |
Ocp-Apim-Subscription-Key header |
Azure API authentication |
Content-Type headers |
JSON vs binary (images) |
response.status_code |
Check for success or errors |
response.json() |
Parse the result |
| HTTP status codes | Debug 401, 403, 429 errors |
| Query parameters | API version, feature selection |
| Sending binary image data | Vision API pattern |
"All 5 notebooks come together. This is what real AI-102 lab code looks like."
| Topic | AI-102 Relevance |
|---|---|
| REST API client pattern | Language Detection lab structure |
| SDK client pattern | Text Analytics with TextAnalyticsClient |
| Computer Vision pattern | Image analysis with caption, tags, objects |
| Batch file processing | Analyze all files in a folder |
| Quick reference cheat sheet | Copy-paste patterns for labs |
pip install reference table |
Every Azure SDK package you'll need |
| Component | Minimum | Recommended |
|---|---|---|
| RAM | 4 GB | 8 GB |
| Disk Space | 2 GB free | 5 GB free |
| Internet | Required for AI-102 labs | Required for AI-102 labs |
Note: The 6 training notebooks themselves work offline β no Azure subscription or internet needed. Internet and Azure credentials are only needed when you move to actual AI-102 lab exercises.
| OS | Supported |
|---|---|
| Windows 10/11 | β Yes |
| macOS 12+ | β Yes |
| Ubuntu 20.04+ / Linux | β Yes |
| Software | Version | Purpose | Download |
|---|---|---|---|
| Python | 3.9 or higher | Run all notebooks and labs | python.org/downloads |
| Jupyter Notebook or JupyterLab | Latest | Run .ipynb files interactively |
Installed via pip (see below) |
| VS Code (recommended) | Latest | Code editor with Jupyter support | code.visualstudio.com |
| Extension | Publisher | Purpose |
|---|---|---|
| Python | Microsoft | Python language support |
| Jupyter | Microsoft | Run notebooks inside VS Code |
| Pylance | Microsoft | IntelliSense for Python |
| Software | Purpose |
|---|---|
| Azure CLI | Manage Azure resources from terminal |
| Git | Clone Microsoft Learning lab repos |
| Azure Subscription | Deploy and use AI services |
Download and install Python 3.9+ from python.org.
β οΈ Windows users: Check the box "Add Python to PATH" during installation.
Verify installation:
python --version# Option A: Using Git
git clone https://github.com/<your-org>/python-for-ai102.git
cd python-for-ai102
# Option B: Download ZIP and extract from GitHub
# Then navigate to the extracted folder# Create virtual environment
python -m venv venv
# Activate it
# Windows:
venv\Scripts\activate
# macOS / Linux:
source venv/bin/activatepip install -r requirements.txtπ‘ Tip: For the 6 training notebooks only, you just need the Section 1 packages. The full
requirements.txtalso includes Azure SDKs for when you move to actual labs.
# Copy the example file
cp .env.example .env
# Edit .env with your actual Azure credentials
# Replace placeholder values with your keys and endpoints# Option A: Classic Jupyter
jupyter notebook
# Option B: JupyterLab
jupyter lab
# Option C: VS Code
# Just open the .ipynb file β VS Code handles the restOpen 01_Python_Foundations.ipynb and begin. π
| Time | Notebook | Trainer Notes |
|---|---|---|
| Hour 1 (0:00β1:00) | 01 β Python Foundations | Start slow. Let students type along. Explain f-strings thoroughly β they'll see them everywhere. |
| Hour 2 (1:00β2:00) | 02 β Data Structures | Focus heavily on dictionaries and nested structures. This is the #1 skill for parsing API responses. |
| Hour 3 (2:00β3:00) | 03 β Functions & Modules | Emphasize os, json, and try/except. Walk through the AI-102 error handling pattern. |
| Break (3:00β3:15) | β 15-minute break | |
| Hour 4 (3:15β4:15) | 04 β Files, JSON & .env | Do the .env section live β show how load_dotenv() works. This demystifies the first 5 lines of every lab. |
| Hour 5 (4:15β5:15) | 05 β REST APIs | Draw the request/response diagram on a whiteboard. Explain headers, status codes. |
| Hour 6 (5:15β6:15) | 06 β Complete AI-102 Pattern | This is the payoff. Walk through each pattern and show the equivalent code from an actual AI-102 lab repo. |
- Run every code cell live β don't just show slides
- Encourage students to modify code β change variables, break things, see what happens
- Connect to AI-102 constantly β after each concept, say "In the AI-102 lab, you'll see this when..."
- Use the practice exercises β give students 3β5 minutes to try on their own
- Notebook 6 is the bridge β after this, open an actual AI-102 lab and show students they can now read the code
Once students complete these 6 notebooks, they're ready for the official labs:
| Repository | Covers |
|---|---|
| mslearn-ai-services | Azure AI Services (provisioning, security, monitoring) |
| mslearn-ai-vision | Computer Vision, Image Analysis, OCR |
| mslearn-ai-language | Text Analytics, NLP, Language Understanding |
| mslearn-ai-document-intelligence | Form Recognizer, Document Intelligence |
| mslearn-knowledge-mining | Azure AI Search, Knowledge Mining |
| mslearn-openai | Azure OpenAI, Generative AI |
π Official Course Page: AI-102T00: Designing and Implementing a Microsoft Azure AI Solution
For quick reference β which Python concept maps to which AI-102 lab activity:
Python Concept Where You'll See It in AI-102
βββββββββββββββββββββ βββββββββββββββββββββββββββββββββ
f-strings Building API URLs, printing results
dictionaries EVERY API response is a dictionary
nested dict/list Parsing sentiment scores, entities
json.loads() Parsing REST API response body
os.getenv() Loading endpoint & key from .env
try/except Wrapping every API call
requests.post() Calling REST APIs directly
with open("img","rb") Sending images to Vision API
for item in list Processing each detected entity
client.method() Using Azure SDK clients
pip install Installing Azure SDK packages
| Problem | Solution |
|---|---|
python command not found |
Use python3 instead, or reinstall Python and check "Add to PATH" |
pip command not found |
Use python -m pip install instead |
| Jupyter won't start | Run pip install jupyter notebook then try again |
ModuleNotFoundError |
Run pip install -r requirements.txt |
| Notebooks won't open in VS Code | Install the "Jupyter" extension from Microsoft |
.env values not loading |
Make sure file is named .env (not .env.example) and is in the same folder |
| Azure API returns 401 | Double-check your API key in the .env file |
| Azure API returns 403 | Check your resource's region and endpoint URL |
Add these topics to your repo for discoverability:
python ai-102 azure microsoft-certification jupyter-notebook
azure-ai mct python-tutorial azure-ai-services cloud-computing
If this helped you or your students:
- β Star the repo β it helps others find it
- π΄ Fork it β customize for your classroom
- π’ Share it β tag someone prepping for AI-102
This material is created for educational purposes. Feel free to use, modify, and distribute for training and learning.
- Microsoft Learning AI-102 Lab Repositories β for the lab code patterns these notebooks are based on
- Microsoft Learn β AI-102 Course β official course curriculum
- AI-102 Study Guide β exam skills measured
Built with β€οΈ to help every student succeed in AI-102.