Skip to content

Commit 936048a

Browse files
Feature/beautify (#20)
1 parent e9c4217 commit 936048a

File tree

14 files changed

+72
-75
lines changed

14 files changed

+72
-75
lines changed

README.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This repository provides a playground to safely experiment with and learn Azure
66

77
_If you are interested in APIM & Azure OpenAI integrations, please check out the excellent [AI Gateway](https://github.com/Azure-Samples/AI-Gateway) GitHub repository._
88

9-
## Objectives
9+
## 🎯 Objectives
1010

1111
1. Educate you on common APIM architectures we see across industries and customers.
1212
1. Empower you to safely experiment with APIM policies.
@@ -16,9 +16,9 @@ _Try it out, learn from it, apply it in your setups._
1616

1717
---
1818

19-
## Getting Started
19+
## 🚀 Getting Started
2020

21-
### Prerequisites
21+
### 📋 Prerequisites
2222

2323
These prerequisites apply broadly across all infrastructure and samples. If there are specific deviations, expect them to be noted there.
2424

@@ -29,7 +29,7 @@ These prerequisites apply broadly across all infrastructure and samples. If ther
2929
- [An Azure Subscription](https://azure.microsoft.com/free/) with Owner or Contributor+UserAccessAdministrator permissions. Execute [shared/jupyter/verify-az-account.ipynb](shared/jupyter/verify-az-account.ipynb) to verify.
3030
- [Sign in to Azure with Azure CLI](https://learn.microsoft.com/cli/azure/authenticate-azure-cli-interactively)
3131

32-
### Initialization
32+
### 🛠️ Initialization
3333

3434
Run through the following steps to create a Python virtual environment before doing anything else:
3535

@@ -43,15 +43,15 @@ Run through the following steps to create a Python virtual environment before do
4343

4444
The first time you run a Jupyter notebook, you'll be asked to install the Jupyter kernel package (ipykernel).
4545

46-
### List of Samples
46+
### 📁 List of Samples
4747

4848
| Sample Name | Description | Supported Infrastructure(s) |
4949
|:-----------------|:----------------------------------------------------------------------------|:-------------------------------------------|
5050
| [General](./samples/general/create.ipynb) | Basic demo of APIM sample setup and policy usage. | All infrastructures |
5151
| [Load Balancing](./samples/load-balancing/create.ipynb) | Priority and weighted load balancing across backends. | apim-aca, afd-apim (with ACA) |
5252
| [AuthX](./samples/authx/create.ipynb) | Authentication and role-based authorization in a mock HR API. | All infrastructures |
5353

54-
### Running a Sample
54+
### ▶️ Running a Sample
5555

5656
1. Locate the specific sample's `create.ipynb` file and adjust the parameters under the `User-defined Parameters` header as you see fit.
5757
1. Ensure that the specified infrastructure already exists in your subscription. If not, proceed to the desired infrastructure folder and execute its `create.ipynb` file. Wait until this completes before continuing.
@@ -61,9 +61,9 @@ Now that infrastructure and sample have been stood up, you can experiment with t
6161

6262
---
6363

64-
## Repo Structure
64+
## 📂 Repo Structure
6565

66-
### High-level
66+
### 🦅 High-level
6767

6868
- All _samples_ can be found in the `samples` folder. Samples showcase functionality and provide a baseline for your experimentation.
6969
- All _infrastructures_ can be found in the `infrastructure` folder. They provide the architectural underpinnings.
@@ -73,14 +73,14 @@ Now that infrastructure and sample have been stood up, you can experiment with t
7373
- Reusable _APIM policies_ are found in the `apim-policies` folder.
7474
- Reusable Jupyter notebooks are found in the `jupyter` folder.
7575

76-
### Sample Setup
76+
### ⚙️ Sample Setup
7777

7878
- Each sample uses an architecture infrastructure. This keeps the samples free of almost all setup.
7979
- Each infrastructure and sample features a `create.ipynb` for creation (and running) of the sample setup and a `main.bicep` file for IaC configuration.
8080
- Each infrastructure contains a `clean-up.ipynb` file to tear down everything in the infrastructure and its resource group. This reduces your Azure cost.
8181
- Samples (and infrastructures) may contain additional files specific to their use cases.
8282

83-
### Infrastructure Architectures
83+
### 🏛️ Infrastructure Architectures
8484

8585
We provide several common architectural approaches to integrating APIM into your Azure ecosystem. While these are high-fidelity setups, they are not production-ready. Please refer to the [Azure API Management landing zone accelerator](https://learn.microsoft.com/azure/cloud-adoption-framework/scenarios/app-platform/api-management/landing-zone-accelerator) for up-to-date production setups.
8686

@@ -95,15 +95,15 @@ We provide several common architectural approaches to integrating APIM into your
9595

9696
---
9797

98-
## Development
98+
## 🛠️ Development
9999

100100
As you work with this repo, you will likely want to make your own customizations. There's little you need to know to be successful.
101101

102102
The repo uses the bicep linter and has rules defined in `bicepconfig.json`. See the [bicep linter documentation](https://learn.microsoft.com/azure/azure-resource-manager/bicep/bicep-config-linter) for details.
103103

104104
**We welcome contributions!** Please consider forking the repo and creating issues and pull requests to share your samples. Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details. Thank you!
105105

106-
### Adding a Sample
106+
### Adding a Sample
107107

108108
Adding a new sample is relatively straight-forward.
109109

@@ -115,11 +115,11 @@ Adding a new sample is relatively straight-forward.
115115
1. Test the sample with all supported infrastructures.
116116
1. Create a pull request for merge.
117117

118-
### Testing & Code Coverage
118+
### 🧪 Testing & Code Coverage
119119

120120
Python modules in `shared/python` are covered by comprehensive unit tests located in `tests/python`. All tests use [pytest](https://docs.pytest.org/) and leverage modern pytest features, including custom markers for unit and HTTP tests.
121121

122-
#### Running Tests Locally
122+
#### 🚀 Running Tests Locally
123123

124124
- **PowerShell (Windows):**
125125
- Run all tests with coverage: `./tests/python/run_tests.ps1`
@@ -136,26 +136,26 @@ You can also run tests manually and see details in the console:
136136
pytest -v --cov=shared/python --cov-report=html:tests/python/htmlcov --cov-report=term tests/python
137137
```
138138

139-
#### Viewing Coverage Reports
139+
#### 📊 Viewing Coverage Reports
140140

141141
After running tests, open `tests/python/htmlcov/index.html` in your browser to view detailed coverage information.
142142

143-
#### Pytest Markers
143+
#### 🏷️ Pytest Markers
144144

145145
- `@pytest.mark.unit` — marks a unit test
146146
- `@pytest.mark.http` — marks a test involving HTTP/mocking
147147

148148
Markers are registered in `pytest.ini` to avoid warnings.
149149

150-
#### Continuous Integration (CI)
150+
#### Continuous Integration (CI)
151151

152152
On every push or pull request, GitHub Actions will:
153153
- Install dependencies
154154
- Run all Python tests in `tests/python` with coverage
155155
- Store the `.coverage` file in `tests/python`
156156
- Upload the HTML coverage report as a workflow artifact for download
157157

158-
#### Additional Notes
158+
#### 📝 Additional Notes
159159

160160
- The `.gitignore` is configured to exclude coverage output and artifacts.
161161
- All test and coverage features work both locally and in CI.
@@ -164,13 +164,13 @@ For more details on pytest usage, see the [pytest documentation](https://docs.py
164164

165165
---
166166

167-
## Supporting Resources
167+
## 📚 Supporting Resources
168168

169169
The APIM team maintains an [APIM policy snippets repo](https://github.com/Azure/api-management-policy-snippets) with use cases we have seen. They are not immediately executable samples and require integrations such as in this repo.
170170

171171
---
172172

173-
## Acknowledgements
173+
## 🙏 Acknowledgements
174174

175175
This project has its roots in work done by [Alex Vieira](https://github.com/vieiraae) on the excellent Azure API Management [AI Gateway](https://github.com/Azure-Samples/AI-Gateway) GitHub repository. Much of the structure is similar and its reuse resulted in significant time savings. Thank you, Alex!
176176

assets/APIM-Samples-199x163.png

30.4 KB
Loading

assets/APIM-Samples.pdn

430 KB
Binary file not shown.

assets/APIM-Samples.png

289 KB
Loading

infrastructure/afd-apim/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ Secure architecture that takes all traffic off the public Internet once Azure Fr
44

55
<img src="./Azure Front Door, API Management & Container Apps Architecture.svg" alt="Diagram showing Azure Front Door, API Management, and Container Apps architecture. Azure Front Door routes traffic to API Management, which then routes to Container Apps. Telemetry is sent to Azure Monitor." title="Azure Front Door, API Management & Container Apps Architecture" width="1000" />
66

7-
## Objectives
7+
## 🎯 Objectives
88

99
1. Provide a secure pathway to API Management via a private link from Front Door
1010
1. Maintain private networking by integrating API Management with a VNet to communicate with Azure Container Apps. (This can also be achieved via a private link there)
1111
1. Empower users to use Azure Container Apps, if desired
1212
1. Enable observability by sending telemetry to Azure Monitor
1313

14-
## Configuration
14+
## ⚙️ Configuration
1515

1616
Adjust the `user-defined parameters` in this lab's Jupyter Notebook's [Initialize notebook variables](./create.ipynb#initialize-notebook-variables) section.
1717

18-
## Execution
18+
## ▶️ Execution
1919

2020
1. Execute this lab's [Jupyter Notebook](./create.ipynb) step-by-step or via _Run All_.

infrastructure/afd-apim/create.ipynb

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"cell_type": "markdown",
1616
"metadata": {},
1717
"source": [
18-
"### Initialize notebook variables\n",
18+
"### 🛠️ 1. Initialize notebook variables\n",
1919
"\n",
2020
"Configures everything that's needed for deployment. \n",
2121
"\n",
@@ -83,7 +83,7 @@
8383
"cell_type": "markdown",
8484
"metadata": {},
8585
"source": [
86-
"### Create deployment using Bicep\n",
86+
"### 🚀 2. Create deployment using Bicep\n",
8787
"\n",
8888
"Creates the bicep deployment into the previously-specified resource group. A bicep parameters file will be created prior to execution."
8989
]
@@ -124,7 +124,7 @@
124124
"cell_type": "markdown",
125125
"metadata": {},
126126
"source": [
127-
"### Approve Front Door private link connection to APIM\n",
127+
"### 🔗 3. Approve Front Door private link connection to APIM\n",
128128
"\n",
129129
"In the deployed Bicep template, Azure Front Door will establish a private link connection to the API Management service. This connection should be approved. Run the following command to approve the connection."
130130
]
@@ -170,7 +170,7 @@
170170
"cell_type": "markdown",
171171
"metadata": {},
172172
"source": [
173-
"### Verify API Request Success via API Management\n",
173+
"### ✅ 4. Verify API Request Success via API Management\n",
174174
"\n",
175175
"As we have not yet disabled public access to APIM, this request should succeed with a **200**."
176176
]
@@ -196,7 +196,7 @@
196196
"cell_type": "markdown",
197197
"metadata": {},
198198
"source": [
199-
"### Disabling API Management public network access\n",
199+
"### 🔒 5. Disabling API Management public network access\n",
200200
"\n",
201201
"The initial `APIM` service deployment above cannot disable public network access. It must be disabled subsequently below."
202202
]
@@ -231,7 +231,7 @@
231231
"cell_type": "markdown",
232232
"metadata": {},
233233
"source": [
234-
"### Verify API Request Success via Azure Front Door & Failure with API Management\n",
234+
"### ✅ 6. Verify API Request Success via Azure Front Door & Failure with API Management\n",
235235
"\n",
236236
"At this time only requests through Front Door should be successful and return a **200**. Requests to APIM that worked previously should result in a **403**."
237237
]
@@ -269,8 +269,7 @@
269269
"cell_type": "markdown",
270270
"metadata": {},
271271
"source": [
272-
"<a id='clean'></a>\n",
273-
"### Clean up resources\n",
272+
"### 🗑️ Clean up resources\n",
274273
"\n",
275274
"When you're finished experimenting, it's advisable to remove all associated resources from Azure to avoid unnecessary cost.\n",
276275
"Use the [clean-up notebook](clean-up.ipynb) for that."

infrastructure/apim-aca/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ This architecture secures API traffic by routing requests through Azure API Mana
44

55
<img src="./API Management & Container Apps Architecture.svg" alt="Diagram showing Azure API Management and Container Apps architecture. API Management routes traffic to Container Apps. Telemetry is sent to Azure Monitor." title="API Management & Container Apps Architecture" width="800" />
66

7-
## Objectives
7+
## 🎯 Objectives
88

99
1. Provide a secure API gateway using Azure API Management
1010
1. Integrate API Management with Azure Container Apps for backend services
1111
1. Enable observability by sending telemetry to Azure Monitor
1212

13-
## Configuration
13+
## ⚙️ Configuration
1414

1515
Adjust the `user-defined parameters` in this lab's Jupyter Notebook's [Initialize notebook variables](./create.ipynb#initialize-notebook-variables) section.
1616

17-
## Execution
17+
## ▶️ Execution
1818

1919
1. Execute this lab's [Jupyter Notebook](./create.ipynb) step-by-step or via _Run All_.

infrastructure/apim-aca/create.ipynb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"cell_type": "markdown",
1818
"metadata": {},
1919
"source": [
20-
"### Initialize notebook variables\n",
20+
"### 🛠️ 1. Initialize notebook variables\n",
2121
"\n",
2222
"Configures everything that's needed for deployment. \n",
2323
"\n",
@@ -76,7 +76,7 @@
7676
"cell_type": "markdown",
7777
"metadata": {},
7878
"source": [
79-
"### Create deployment using Bicep\n",
79+
"### 🚀 2. Create deployment using Bicep\n",
8080
"\n",
8181
"Creates the bicep deployment into the previously-specified resource group. A bicep parameters file will be created prior to execution."
8282
]
@@ -114,7 +114,7 @@
114114
"cell_type": "markdown",
115115
"metadata": {},
116116
"source": [
117-
"### Verify API Request Success\n",
117+
"### ✅ 3. Verify API Request Success\n",
118118
"\n",
119119
"Assert that the deployment was successful by making simple calls to APIM. "
120120
]
@@ -141,8 +141,7 @@
141141
"cell_type": "markdown",
142142
"metadata": {},
143143
"source": [
144-
"<a id='clean'></a>\n",
145-
"### Clean up resources\n",
144+
"### 🗑️ Clean up resources\n",
146145
"\n",
147146
"When you're finished experimenting, it's advisable to remove all associated resources from Azure to avoid unnecessary cost.\n",
148147
"Use the [clean-up notebook](clean-up.ipynb) for that."

infrastructure/simple-apim/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ This architecture provides a basic API gateway using Azure API Management, suita
44

55
<img src="./Simple API Management Architecture.svg" alt="Diagram showing a simple Azure API Management architecture. API Management acts as a gateway for API consumers. Telemetry is sent to Azure Monitor." title="Simple API Management Architecture" width="800" />
66

7-
## Objectives
7+
## 🎯 Objectives
88

99
1. Provide the simplest Azure API Management infrastructure with a public ingress to allow for easy testing
1010
1. Enable observability by sending telemetry to Azure Monitor
1111

12-
## Configuration
12+
## ⚙️ Configuration
1313

1414
Adjust the `user-defined parameters` in this lab's Jupyter Notebook's [Initialize notebook variables](./create.ipynb#initialize-notebook-variables) section.
1515

16-
## Execution
16+
## ▶️ Execution
1717

1818
1. Execute this lab's [Jupyter Notebook](./create.ipynb) step-by-step or via _Run All_.

infrastructure/simple-apim/create.ipynb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"cell_type": "markdown",
1616
"metadata": {},
1717
"source": [
18-
"### Initialize notebook variables\n",
18+
"### 🛠️ 1. Initialize notebook variables\n",
1919
"\n",
2020
"Configures everything that's needed for deployment. \n",
2121
"\n",
@@ -59,7 +59,7 @@
5959
"cell_type": "markdown",
6060
"metadata": {},
6161
"source": [
62-
"### Create deployment using Bicep\n",
62+
"### 🚀 2. Create deployment using Bicep\n",
6363
"\n",
6464
"Creates the bicep deployment into the previously-specified resource group. A bicep parameters file will be created prior to execution."
6565
]
@@ -95,7 +95,7 @@
9595
"cell_type": "markdown",
9696
"metadata": {},
9797
"source": [
98-
"### Verify API Request Success\n",
98+
"### ✅ 3. Verify API Request Success\n",
9999
"\n",
100100
"Assert that the deployment was successful by making simple calls to APIM. "
101101
]
@@ -119,8 +119,7 @@
119119
"cell_type": "markdown",
120120
"metadata": {},
121121
"source": [
122-
"<a id='clean'></a>\n",
123-
"### Clean up resources\n",
122+
"### 🗑️ Clean up resources\n",
124123
"\n",
125124
"When you're finished experimenting, it's advisable to remove all associated resources from Azure to avoid unnecessary cost.\n",
126125
"Use the [clean-up notebook](clean-up.ipynb) for that."

0 commit comments

Comments
 (0)