You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: TROUBLESHOOTING.md
+68-18Lines changed: 68 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,11 +17,13 @@ This guide helps you resolve common issues when working with the Azure API Manag
17
17
If you encounter import errors (e.g., `ModuleNotFoundError: No module named 'requests'` or cannot import shared modules), try these steps:
18
18
19
19
1.**Fix Python path configuration**:
20
+
20
21
```bash
21
22
python setup/local_setup.py --generate-env
22
23
```
23
24
24
25
2.**Verify setup**:
26
+
25
27
```bash
26
28
python setup/verify_local_setup.py
27
29
```
@@ -35,27 +37,32 @@ If you encounter import errors (e.g., `ModuleNotFoundError: No module named 'req
35
37
### "The content for this response was already consumed"
36
38
37
39
**Error Message:**
38
-
```
40
+
41
+
```text
39
42
ERROR: The content for this response was already consumed
40
43
```
41
44
42
45
**Root Cause:** This misleading error message often indicates a Bicep template validation error, typically caused by parameter mismatches between the notebook and the Bicep template.
43
46
44
47
**Solution:**
48
+
45
49
1. Run the Azure CLI command with `--debug` to see the actual error:
50
+
46
51
```bash
47
52
az deployment group validate --resource-group <rg-name> --template-file "main.bicep" --parameters "params.json" --debug
48
53
```
49
54
50
55
2. Look for the real error in the debug output, often something like:
51
-
```
56
+
57
+
```text
52
58
The following parameters were supplied, but do not correspond to any parameters defined in the template: 'parameterName'
53
59
```
54
60
55
61
3. Check that all parameters in your notebook's `bicep_parameters` dictionary match the parameters defined in the `main.bicep` file.
56
62
57
63
**Example Fix:**
58
64
If the error mentions `apimSku` parameter not found:
65
+
59
66
```python
60
67
# ❌ Incorrect - includes undefined/unexpected apimSku parameter
61
68
bicep_parameters = {
@@ -72,29 +79,35 @@ bicep_parameters = {
72
79
### "Resource already exists" Conflicts
73
80
74
81
**Error Message:**
75
-
```
82
+
83
+
```text
76
84
The resource already exists and conflicts with...
77
85
```
78
86
79
87
**Solution:**
88
+
80
89
1. Use unique deployment names with timestamps:
90
+
81
91
```bash
82
92
az deployment group create --name "sample-$(date +%Y%m%d-%H%M%S)" ...
83
93
```
84
94
85
95
2. Or delete existing conflicting resources:
96
+
86
97
```bash
87
98
az resource delete --ids /subscriptions/.../resourceGroups/.../providers/...
88
99
```
89
100
90
101
### Module Path Resolution Errors
91
102
92
103
**Error Message:**
93
-
```
104
+
105
+
```text
94
106
Unable to download the module...
95
107
```
96
108
97
109
**Solution:**
110
+
98
111
1. Ensure you're running deployments from the correct directory (sample directory, not project root)
99
112
2. Verify relative paths to shared modules are correct
100
113
3. The utility function `create_bicep_deployment_group_for_sample()` handles this automatically
@@ -104,11 +117,13 @@ Unable to download the module...
104
117
### Azure CLI Not Authenticated
105
118
106
119
**Error Message:**
107
-
```
120
+
121
+
```text
108
122
Please run 'az login' to setup account
109
123
```
110
124
111
125
**Solution:**
126
+
112
127
```bash
113
128
az login
114
129
az account set --subscription "your-subscription-name-or-id"
@@ -124,16 +139,19 @@ az account set --subscription "your-subscription-name-or-id"
124
139
### Insufficient Permissions
125
140
126
141
**Error Message:**
127
-
```
142
+
143
+
```text
128
144
The client does not have authorization to perform action...
129
145
```
130
146
131
147
**Solution:**
148
+
132
149
1. Ensure you have the necessary role assignments:
133
150
-**Contributor** or **Owner** on the resource group/subscription
134
151
-**API Management Service Contributor** for APIM-specific operations
135
152
136
153
2. Check your current permissions:
154
+
137
155
```bash
138
156
az role assignment list --assignee $(az account show --query user.name -o tsv)
139
157
```
@@ -145,7 +163,8 @@ The client does not have authorization to perform action...
145
163
These can be a bit nebulous. When making changes to imported modules, they are not automatically picked up.
146
164
147
165
**Error Message:**
148
-
```
166
+
167
+
```text
149
168
AttributeError: module 'utils' has no attribute 'function_name'
150
169
```
151
170
@@ -174,25 +193,29 @@ importlib.reload(utils)
174
193
### Python Path Issues
175
194
176
195
**Error Message:**
177
-
```
196
+
197
+
```text
178
198
ModuleNotFoundError: No module named 'utils'
179
199
```
180
200
181
201
**Solution:**
182
202
Use the provided setup script:
203
+
183
204
```bash
184
205
python setup/local_setup.py --generate-env
185
206
```
186
207
187
208
### Working Directory Issues
188
209
189
210
**Error Message:**
190
-
```
211
+
212
+
```text
191
213
FileNotFoundError: [Errno 2] No such file or directory: 'main.bicep'
192
214
```
193
215
194
216
**Solution:**
195
217
Use the utility function that handles working directory management:
218
+
196
219
```python
197
220
# ✅ Use this instead of manual directory management
@@ -232,7 +260,8 @@ The api-version '...' is invalid
232
260
This is a bit cryptic. It's helpful to execute the `az` command from the error separately in the terminal and supply the `--debug` flag. You might then see errors such as this one:
233
261
234
262
**Error Message:**
235
-
```
263
+
264
+
```text
236
265
cli.azure.cli.core.azclierror: [WinError 193] %1 is not a valid Win32 application
237
266
az_command_data_logger: [WinError 193] %1 is not a valid Win32 application
238
267
```
@@ -257,20 +286,23 @@ In one case, `%USERPROFILE%\.azure\bin` contained a `bicep.exe` file but with a
257
286
When you delete Azure API Management services or Key Vaults, they are soft-deleted and remain recoverable for a period of time (typically 48 days for APIM, 90 days for Key Vault). These soft-deleted resources continue to reserve their names and can cause deployment conflicts.
258
287
259
288
**Common Issues:**
289
+
260
290
- Deployment fails with "Name already exists" even though resource appears deleted
261
291
- Cannot reuse the same name for a new APIM service or Key Vault
262
292
- Key Vault creation fails during infrastructure deployment
263
293
- Subscription quotas are affected by soft-deleted resources
264
294
265
295
**Error During Infrastructure Deployment:**
266
-
```
296
+
297
+
```text
267
298
Creating Key Vault: kv-sbfc4encghfag
268
299
❌ Failed to create Key Vault: kv-sbfc4encghfag
269
300
This may be caused by a soft-deleted Key Vault with the same name.
270
301
Check for soft-deleted resources: python shared/python/show_soft_deleted_resources.py
Key Vaults can have **purge protection** enabled, which prevents them from being manually purged before their scheduled purge date. This is a security feature that cannot be disabled once enabled.
308
341
309
342
**Error When Purging Protected Key Vaults:**
310
-
```
343
+
344
+
```text
311
345
(MethodNotAllowed) Operation 'DeletedVaultPurge' is not allowed.
312
346
Code: MethodNotAllowed
313
347
Message: Operation 'DeletedVaultPurge' is not allowed.
314
348
```
315
349
316
350
**Identifying Purge Protection:**
317
351
The `show_soft_deleted_resources.py` script automatically detects and displays purge protection status:
0 commit comments